Hello, Dmitry. What do you think about marking Builder classes with a specific Interface or somehow else just to highlight that this class/interface is a builder? What do you think about (possibility) for IDE support for hierarchical builders code formatting?
Theoretically you could introduce some IBuilder interface with a T Build() method. It is of course of singular use, because you cannot overload two of those without explicit interface members. Similarly you could have IBuildableUsing with a property T New { get; } returning the builder - this is also not overloadable. As to your second question, I don't quite understand what you're asking.
```interface IBuildableUsing where TBuilder : IBuilder where TSubject : IBuildableUsing { TBuilder New { get; } } interface IBuilder where T : IBuildableUsing { T Build(); }```
You can chain methods in any order by returning a reference of the working object (fluent interface idea). In this case (Stepwise Builder) the order of object construction is strictly defined.
I have purchased your design patterns course in Udemy earlier.... Nice content..
Great! Note that these videos are also added to the course. Enjoy!
Hello, Dmitry. What do you think about marking Builder classes with a specific Interface or somehow else just to highlight that this class/interface is a builder? What do you think about (possibility) for IDE support for hierarchical builders code formatting?
Theoretically you could introduce some IBuilder interface with a T Build() method. It is of course of singular use, because you cannot overload two of those without explicit interface members. Similarly you could have IBuildableUsing with a property T New { get; } returning the builder - this is also not overloadable. As to your second question, I don't quite understand what you're asking.
```interface IBuildableUsing
where TBuilder : IBuilder
where TSubject : IBuildableUsing
{
TBuilder New { get; }
}
interface IBuilder
where T : IBuildableUsing
{
T Build();
}```
@@DmitriNesteruk youtrack.jetbrains.com/issue/RSRP-440686 It's actual for hierarchical builders.
Isn't it sounds like Method Chaining pattern/approach?
You can chain methods in any order by returning a reference of the working object (fluent interface idea).
In this case (Stepwise Builder) the order of object construction is strictly defined.
Very nice. I like it a lot
Neat!