441 questions
1
vote
1
answer
98
views
How can I avoid declaring full generic parameters when storing a custom typed object, while keeping type safety at compile time?
I've created a small library called StreamX, which acts like a type-safe, index-aware zipper to enable parallel streaming over multiple lists. It supports functional operations like forEach, map, ...
0
votes
0
answers
32
views
Best practices for modifying collection inplace with LINQ
I have a collection with objects of different types, each of them inheriting from a class named Component. I then want to modify the collections by my needs nicely, with use of kind of declarative and ...
1
vote
0
answers
57
views
Declaring a variable of self-referencing generic type in C# 10.0
Good time of the day!
I have a generic interface which has a self-reference:
public interface IBuilder<TObject, TBuilder>
where TBuilder : IBuilder<TObject, TBuilder>
{
public ...
0
votes
1
answer
68
views
Is it necessary to return the same object in methods with fluent interface
in some sources such as the original article of Martin Fowler aren't written that methods would return the same object, and methods in examples return different objects but in some sources(newer) such ...
1
vote
1
answer
113
views
The different between fluent interface and method cascading implemented by method chaining [duplicate]
When I read about it on Wikipedia, it seemed to me that these two are almost the same, but the same article says that they differ not only in the use of DSL.
Note that a "fluent interface" ...
1
vote
2
answers
242
views
What's the difference between 'with command' and 'fluent interface' in Delphi?
Why should I use fluent interface in Delphi instead of using 'with command'?
I heard about both, but I haven't found the difference. I'm trying to find the best one for my project. It seems to work ...
0
votes
3
answers
463
views
c# how to make a conditional method chaining in fluent interface?
I'm developing .NET core app that using selenium, so I've designed the logic using fluent interface that make the code more readable and maintained.
I have a problem which is how to make a conditional ...
0
votes
1
answer
71
views
Fluent Builder Interface lets me set middle name and last name more than once
I'm implementing a Fluent Builder Interface and instead of having null, empty or whitespace checks, I force the developer to fill in the following mandatory fields: firstName, prefix and facultyNumber....
0
votes
0
answers
24
views
How to not expose the data structure in an object while accepting a collection of items with named parameters?
Most of the time, we can replace a fluent interface with named parameters.
class Cart {
fun withItems(vararg items: Item) = this
}
fun aCart(): Cart {
TODO()
}
class Item
fun anItem(): Item ...
0
votes
1
answer
67
views
How to terminate last function in chaining method php
I got some problem and I don't know how to fix it.
this is sample for the problem
class DancingClass {
private static $associate = [];
private static $first;
public static function first($...
0
votes
1
answer
2k
views
When to return 'this' instead of 'void' in a method and why? [duplicate]
What are the benefits (or drawbacks) of returning a reference to 'this' object in a method that modifies itself? When should returning a 'this' be used as apposed to void?
When looking at an answer on ...
0
votes
1
answer
136
views
Double destructor call in C++
I'm trying to create an object-configurator using a fluent interface.
Code:
class Configurator {
public:
Configurator() {
printf("Constructor.\n");
}
~Configurator() {
...
-1
votes
1
answer
109
views
Immediately calling destructor after setting in the fluent interface in C++ [closed]
I want to create a class only for setting params for function.
I'm using a fluent interface for that.
Some function returns the object to setting params and real code will execute in the destructor of ...
0
votes
2
answers
7k
views
Instantiate a generic class T object and return it [duplicate]
I'm working on java selenium tests and I am trying to setup a fluent/method-chaining design code:
I have a generic button class that allows navigating from a page class to the other. Buttons are ...
1
vote
1
answer
401
views
Is it possible to deserialize a yaml document with setters that are not void?
I am working on a project that has a fair amount of data objects that use a "fluent interface" or "method chaining" on their setters so all of the setters in each data object return this. I have ...