Skip to main content
17 votes
Accepted

Chaining list operations in Python

This is more "streaming" in a sense: ...
superb rain's user avatar
  • 4,021
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 ...
t3chb0t's user avatar
  • 44.7k
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 ...
FMc's user avatar
  • 13.1k
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: ...
t3chb0t's user avatar
  • 44.7k
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 ...
t3chb0t's user avatar
  • 44.7k
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 (...
dfhwze's user avatar
  • 14.2k
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 ...
Simon Forsberg's user avatar
4 votes
Accepted

Fluent Validation of Objects

Cleaner consumer interface WarnIfTrue / WarnIfFalse ...
Flater's user avatar
  • 5,720
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. ...
Bobby's user avatar
  • 8,166
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 ...
IEatBagels's user avatar
  • 12.7k
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 ...
dfhwze's user avatar
  • 14.2k
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 ...
Olivier Jacot-Descombes's user avatar
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 ...
RoToRa's user avatar
  • 11.6k
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 ...
K.H.'s user avatar
  • 2,728
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 ...
Peter Csala's user avatar
  • 10.8k
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 ...
D__'s user avatar
  • 21
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 ...
Nkosi's user avatar
  • 3,296
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,...
TorbenPutkonen's user avatar
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/...
Koen AIS's user avatar
  • 144
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 ...
Tasos Papastylianou's user avatar
1 vote

Recursive fluent builder

Drop nested builders and use separate builders for each type of object to be created (GroupBuilder, UserBuilder, ...
aventurin's user avatar
  • 520
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 ...
slowy's user avatar
  • 1,916
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 ...
Martin Frank's user avatar
  • 3,033

Only top scored, non community-wiki answers of a minimum length are eligible