Implementing Fluent Interface in Java
Yesterday my friend Neeraj came across the concept (?) called "Fluent Interface". He told that he successfully implemented it in Java. Today I read lot of articles on it, and finally I was too successful to implement it in Java using a very-very simple program.
About Fluent Interface:
Fluent Interface is used to create a readable model i.e. to convert APIs to English-like sentences. It is slightly harder to write but much easier to read.
"Martin Fowler coined the term "FluentInterface" to describe objects that expose an interface that flows, and is designed to be readable and concise. The cost of this fluency is additional effort required to design the interface for your object and the slight increase in complexity. These types of interfaces are often utilized to create configurations for your objects but can progress into an internal Domain Specific Language or DSL." [Excerpt from Randy Patterson's blog post ]
Some useful pointers:
http://www.martinfowler.com/bliki/FluentInterface.html
http://www.bofh.org.uk/articles/2005/12/21/fluent-interfaces
No comments:
Post a Comment