Skip to content

Commit 9ecb1b2

Browse files
committed
Work on iluwatar#184, changed category, added difficulty tag, more real applications and credits, added implementation approaches
1 parent bbd7864 commit 9ecb1b2

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

fluentinterface/index.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,25 @@ layout: pattern
33
title: Fluent Interface
44
folder: fluentinterface
55
permalink: /patterns/fluentinterface/
6-
categories: Architectural
7-
tags: Java
6+
categories: Other
7+
tags:
8+
- Java
9+
- Difficulty-Intermediate
810
---
911

1012
**Intent:** A fluent interface provides an easy-readable, flowing interface, that often mimics a domain specific language. Using this pattern results in code that can be read nearly as human language.
1113

14+
**Implementation:**
15+
16+
A fluent interface can be implemented using any of
17+
18+
* Method Chaining - calling a method returns some object on which further methods can be called.
19+
* Static Factory Methods and Imports
20+
* Named parameters - can be simulated in Java using static factory methods.
21+
1222
![Fluent Interface](./etc/fluentinterface.png "Fluent Interface")
1323

24+
1425
**Applicability:** Use the Fluent Interface pattern when
1526

1627
* you provide an API that would benefit from a DSL-like usage
@@ -20,9 +31,12 @@ tags: Java
2031

2132
* [Java 8 Stream API](http://www.oracle.com/technetwork/articles/java/ma14-java-se-8-streams-2177646.html)
2233
* [Google Guava FluentInterable](https://github.com/google/guava/wiki/FunctionalExplained)
23-
* [JOOQ](http://www.jooq.org/doc/3.0/manual/getting-started/use-cases/jooq-as-a-standalone-sql-builder/)
24-
25-
**Credits**
26-
27-
* [Fluent Interface - Martin Fowler](http://www.martinfowler.com/bliki/FluentInterface.html)
28-
* [Evolutionary architecture and emergent design: Fluent interfaces - Neal Ford](http://www.ibm.com/developerworks/library/j-eaed14/)
34+
* [JOOQ](http://www.jooq.org/doc/3.0/manual/getting-started/use-cases/jooq-as-a-standalone-sql-builder/)
35+
* [Mockito](http://mockito.org/)
36+
* [Java Hamcrest](http://code.google.com/p/hamcrest/wiki/Tutorial)
37+
38+
**Credits**
39+
40+
* [Fluent Interface - Martin Fowler](http://www.martinfowler.com/bliki/FluentInterface.html)
41+
* [Evolutionary architecture and emergent design: Fluent interfaces - Neal Ford](http://www.ibm.com/developerworks/library/j-eaed14/)
42+
* [Internal DSL](http://www.infoq.com/articles/internal-dsls-java)

0 commit comments

Comments
 (0)