Agile tour is comming soon and I will be part of it.
If you attend, dont miss my talk on : Top 5 des meilleures façon d’améliorer votre code. Yes it will be in french, of course.
Eric De Carufel, Parallel Extensions, Parallel Computing, C#, .NET, Design Patterns, OOP, Famework.NET 2.0, 3.0, 3.5, Visual Studio.
Agile tour is comming soon and I will be part of it.
If you attend, dont miss my talk on : Top 5 des meilleures façon d’améliorer votre code. Yes it will be in french, of course.
var command1 = new Command1(); var command2 = new Command2("Test"); command1.NextInChain = command2; command1.Execute(null);Here is the same construct in a fluent manner:
var chain = new ChainBuilder<ChainCommand>() .Add<Command1>() .Add<Command2>(() => new Command2("Test")) .Build(); chain.Execute(null);Which one do you like the most? In my case I prefer the fluent way. Building a chain of responsibility in not that difficult if you have only a handful of element to chain, but if you have more it become boring to remember to link the previous element to the next. My builder take car of that for you. Because of “fluent” concept you always now what comes next. For exmaple the ChainBuilder class only expose some overload of Add and a Build method.
@ 4/16/2013 07:59:00 AM 0 commentaires
Label: C#, Fluent interfaces, OOP, Pattens