-
Notifications
You must be signed in to change notification settings - Fork 60
Description
I believe that this library is mixing a couple code Design Patterns and that make it harder to understand intuitively for its users. The library's QueryBuilder methods mix and match parts of the Functional Patter and Builder Pattern which can lead to some confusion.
Methods like Limit and the rest of the methods in this library should not return the QueryBuilder type. The reason being that the library is using the Builder Pattern which modifies the state, but returning the instance masquerades the pattern as a Functional Programming pattern. It is an unexpected user experience that the state is modified when using the library when it returns a instance as that is not apart of the well known Builder Pattern. In that pattern the modifying methods return void to signal that you are modifying the underlying state. In the Functional pattern the underlying state is not modified so it then returns a new instance to you which contains a new state but the original is preserved.
I would pick a direction for the library so it is easier and more intuitive to use.
The desired out come in my opinion would be to copy LinQ and follow the Functional Programming pattern but I would settle for copying C# StringBuilder and following the Builder Pattern.
It would also be really helpful if we could make copying the QueryBuilder class easier if the Builder Pattern is preserved. var newQuery = query.Clone()
as it would make things like looping over the same query easier to perform in code by just updating the Skip property on each for loop iteration.