|
From: Jens Winter on 23 Aug 2006 17:26 breeto(a)yahoo.com wrote: > I think "fluent interface" might be the answer you're looking for... > > http://www.martinfowler.com/bliki/FluentInterface.html Yes! That's the term I was looking for. Thank you! Ciao, Jens
From: H. S. Lahman on 24 Aug 2006 11:05
Responding to Winter... > What I meant was that the construct uses methods that can be > concatenated. This way it is possible to for example initialize an > object that has a hierarchical structure. Alas, my instinctive reaction is: Don't Do That! B-) One can argue that the entire OO paradigm is designed to eliminate the hierarchical structure in traditional procedural development that led to the legendary Spaghetti Code. Similarly, the sort of composition implied in the first sentence works well in functional programming but it is antithetical to OO development. But... > > An alternative sample to the above code could be something like this: > > Expectation expectation = new Expectation(); > expectation.SetMethod("receive"); > expectation.SetExpectedResult(message); So far I don't see anything hierarchical. The 'expectation' object could be a ConcreteObserver from the Observer pattern that is just registering a callback to a message. > mockSubscriber.AddExpectation(expectation, 1); I'm not sure about the intent here because of the '1' argument. Without that one could simply be instantiating the relationship between ConcreteSubject (mockSubscriber) and ConcreteObserver (expectation) in the Observer pattern. ************* There is nothing wrong with me that could not be cured by a capful of Drano. H. S. Lahman hsl(a)pathfindermda.com Pathfinder Solutions http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman "Model-Based Translation: The Next Step in Agile Development". Email info(a)pathfindermda.com for your copy. Pathfinder is hiring: http://www.pathfindermda.com/about_us/careers_pos3.php. (888)OOA-PATH |