17
votes
Accepted
8
votes
Fluent Validation of Objects
Fluent API
Fluent APIs are generally very useful but one has to be very careful with them as there is a chance of making them overfluent. This means that you try to create an API for every possible ...
6
votes
Chaining list operations in Python
It is possible to write those steps in a single comprehension -- sort of the Python
analogue for chaining in JavaScript or Ruby. It doesn't read too badly if you
convey the logic visually. Without ...
5
votes
Simple fluent library to validate text content
I'll take time to review just one of the APIs which I find is the most confusing one:
...
4
votes
Accepted
Constraining a property setter fluently
This might actually be useful in some cases, however, we first need to get rid of its weaknesses and clean-up the code a little bit:
Every property of ...
4
votes
Fluent Validation of Objects
This API does feel fluent for consumers to use.
You have also included some features I missed in the post you were inspired by.
various severity levels [warning, error]
custom error messages (...
4
votes
Accepted
Instantiating Person objects using the builder pattern
The only advice I have is: Don't do that.
You're abusing generics, massively, IMO.
A data class where all the properties are val is the best compile-time validation ...
4
votes
Accepted
3
votes
Java Fluent Wrapper
Yes, your implementation is sound and possible...however, it doesn't make any sense to have it in the first place, at least not for your example.
...
3
votes
Builder pattern in C# supporting subclassing with nested classes
I'm not sure this qualifies as a review, but here we go anyways.
Don't do this. This is one of the classic use of a design pattern where we shouldn't use one. A design pattern is a solution to a ...
3
votes
Finite State Machine supporting shortest path transitions
Runnable Review
From Reference Docs:
When an object implementing interface Runnable is used to create a
thread, starting the thread causes the object's ...
3
votes
Chaining ConstrainableSet<T>
Like Pieter Witvoet I don't quite understand which problem this code is trying to solve. There is an ObservableCollection Class that partly does the same. Together with validation logic in properties ...
3
votes
Accepted
Switch-like functionality for non-switchable types in Java
Bugs
Unfortunately this doesn't work as expected
Assuming that breakWhen works like break in a regular ...
2
votes
Accepted
Comparing a weak fluent API with a strong fluent API in Java
You already answered yourself. Use the second one when the order matters, although I can't think of a situation when I ever needed that. I expect that in most cases the typical builder pattern will be ...
2
votes
Accepted
Creating complex object step by step
Account
Depending on the requirements it would make sense to make the class immutable by using ...
2
votes
Dart Ioc Container
Is there anything obviously missing here?
No, it is that simple. I recently implemented a generalized versions of the mediator pattern and it has a similar concept (Map with Types as keys). When you ...
2
votes
Accepted
Wrapper for a sales API, with a fluent interface
That SalesAPI is doing way too much. Which violates Single Responsibility Principle (SRP). The fluent interface also feels like over engineering but it can still be ...
2
votes
Java Fluent Wrapper
I get the feeling you just want to call the setters in a chain to spare you from writing item. and ; before and after every call,...
2
votes
Instantiating Person objects using the builder pattern
I have no problem at all with the essence of your idea (safe builders) but I very much dislike the code:
It requires as many generic parameters as there are properties, practically inviting the need/...
1
vote
Chaining list operations in Python
I will state from the beginning that I do not necessarily think that such a 'semi-functional' style is "better" than the nested list comprehensions in the accepted answer, which also have a ...
1
vote
Recursive fluent builder
Drop nested builders and use separate builders for each type of object to be created (GroupBuilder, UserBuilder, ...
1
vote
Java builder for user contact information, with optionals
My understanding from a builder is a bit different. In my opinition, the User should not have a dependency to the Builder (you have a bidirectional dependency which is usually bad anyway). With that ...
1
vote
Fluent API for creating random integer arrays in Java
I think this code is a very good example of how to write fluent APIs, even though there exists far easier ways to get an certain array.
flaws of the fluent interface:
you should let the the user be ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
fluent-interface × 47c# × 20
java × 15
design-patterns × 6
validation × 4
generics × 4
library × 3
immutability × 3
c++ × 2
javascript × 2
c × 2
object-oriented × 2
array × 2
vba × 2
unit-testing × 2
comparative-review × 2
random × 2
api × 2
database × 2
dependency-injection × 2
extension-methods × 2
callback × 2
polymorphism × 2
properties × 2
framework × 2