Refers to a practice of coding object-oriented APIs with the aim of improving readability of the interface, normally implemented using method chaining.
0
votes
1answer
59 views
Fluent interface builder
I'm working on a fluent interface builder that takes:
an array of strings, each of which becomes a key to an object that is a function that follows the fluent interface pattern
a terminator function ...
7
votes
1answer
77 views
Database abstraction layer for multiple providers
There's been a lot of questions lately about database provider and repository design especially without entity framework or alike.
I thought I try myself to create a reusable framework for this kind ...
6
votes
3answers
78 views
Table printing code using a fluent interface
Let's say you want to display something like:
One Two Three Four
1 2 3 4
And since you hate the idea of predefining the widths of the columns you ...
7
votes
1answer
79 views
HTML-rendering framework for emails
Sometimes I need to auto-generate html-emails. To make this task a little bit easier I created a simple framework that takes care of rendering HTML. Because I'm mainly interested in generating HTML ...
3
votes
0answers
42 views
Easily add Accessibility to your app as an afterthought. Yes, as an afterthought
Accessible apps allow more users to use your app; however, it is usually an afterthought for developers, and it makes your XML layout files messy whether Accessibility was a forethought or ...
0
votes
1answer
47 views
Guided object builder
Sometimes when designing a fluent-api it's important to build an object in a specific way/sequence.
I tried to create such a guided builder and came-up with this:
...
4
votes
2answers
105 views
Initializing immutable objects with a nested builder
I need to initialize several parameters of an object but I also wanted to make it immutable. At the same time I don't want the constructor to take all several parameters because some of them are ...
5
votes
2answers
317 views
Simple builder pattern implementation for building immutable objects
This is a builder pattern implementation to build immutable Person objects:
Person class
...
1
vote
0answers
42 views
Fluent method arguments validation
I've put together a small fluent utility class for argument validation. Part of the code looks as follows:
...
1
vote
0answers
82 views
PHPSpec, testing code that uses fluent mock
I've just completed writing a spec for a Doctrine2 repository. The repo contains only one method so far, the spec for which takes in an OAuth Identity token object (that contains an ID that matches up ...
5
votes
2answers
91 views
Find attribute on class property
Since reading Robert Martin's book "Clean Code" I have been inspired to revisit and refactor some of my code to break it down into succinct methods and small specialised classes.
Given the need to ...
3
votes
1answer
123 views
Css builder and parser
As part of a larger project I've created recently a simple CssBuilder and CssParser. It's composed of three classes and can ...
5
votes
2answers
91 views
Fluent API for creating random integer arrays in Java
Now I have this fluent API for creating random integer arrays. I can say that I want an array of particular length, having a particular minimum/maximum values and using a particular (or default) ...
1
vote
1answer
138 views
RPG Character with fluent interface
(Follow-up on RPG Character Builder)
This implements a fluent interface for RPG game characters. Is this a valid implementation?
There are 3 characters: Paladin, <...
5
votes
1answer
60 views
Attempting a fluent API for creating random int arrays
I have attempted doing a fluent API for creating random int arrays, and the following is what I came up with:
fluent_arrays.h:
...
6
votes
1answer
2k views
Fluent Repository/QueryBuilder
I've been toying around making my repositories a bit more fluent for a while. I was ending up with crazy long method names when I had to query on multiple conditions. So I've been working on a way to ...
7
votes
2answers
340 views
Fluent Interface for a XmlQueryBuilder
In this answer I suggested using a fluent interface "builder" to replace all the hard-coded, repetitive and quite error-prone inline XML string concatenations.
This code might need a bit of tweaking ...
10
votes
6answers
2k views
Fluent interface and polymorphism for building a scene with shapes
I would like to improve the interfaces of some polymorphic classes going from positional to named parameters and I came up with the fluent interface.
The following is the most clean, compact and ...
8
votes
1answer
815 views
Fluent interface for manipulating employee records
I wanted to try experimenting with fluent interface design in the C programming language. That's why I wanted to ask you, Dear Code Review users, comments on the way I have implement this simple ...