SlideShare une entreprise Scribd logo
1  sur  19
The Fluent Interface Pattern

Lars-Erik Kindblad
Senior Consultant
Blog: kindblad.com
A common problem in most software projects

 Technical debts increases over time and the code gets harder and
  harder to maintain and add features to




                                                          | Sector, Alliance, Offering
Feature delivery for most projects

                              Technical debt


                                                Complex and messy code
                                               Code and logic is duplicated
                                               No common coding standard
Features Delivered




                                                   No strict architecture
                                                           ++




                                       Time




                                                                              | Sector, Alliance, Offering
Ideal Feature Delivery
Features Delivered




                               Time




                                              | Sector, Alliance, Offering
How to reach ideal delivery?
 Software development is complex
 Not a single solution but a mix of many different things
  •   Write a lot of code
  •   Important to understand the business model
  •   Readable & maintainable code over fancy code
  •   Simplicity over complexity
  •   Decide on a common coding standard
  •   Reuse code instead of code duplication
  •   Create a project framework with common code and logic
  •   Design Patterns – follow generic solutions to commonly occurring problems
      o 100s of design patterns exists
         – Factory Pattern, MVC Pattern, Command Pattern, Fluent Interface Pattern etc.
  • ++

                                                                                     | Sector, Alliance, Offering
The Fluent Interface Pattern

 One of many design patterns that can contribute to a better code
  base
 Fluent Interfaces makes the code easier to read and easier to use
  due to a simpler API that requires less code
 Consists of 2 principles:
  • Method chaining - Traditional code requires one line per command, method
    chaining allows multiple commands per line
  • More readable API – The code can be read like a sentence. Optional as it
    requires more typing due to longer names and more code to write
 Popular to use in frameworks: Moq, Fluent Nhibernate, FluentData
  etc.


                                                                    | Sector, Alliance, Offering
Example – Find a person
Traditional Code:




Fluent Interface Code:



Or:




                                                   | Sector, Alliance, Offering
A more readable Fluent Interface




Or:




                                         | Sector, Alliance, Offering
Designing Fluent Interfaces - Method vs. Property



                               Use a method when having to
                               accept one or more values


                               Use a property when not having
                               to accept any values


                               Use a method to finish the call




                                                      | Sector, Alliance, Offering
Traditional Code




                   | Sector, Alliance, Offering
Fluent Interface Code




                        | Sector, Alliance, Offering
Example #2 – A List of Persons
Traditional Code:




Fluent Code:




                                                     | Sector, Alliance, Offering
Traditional Code




                   | Sector, Alliance, Offering
Fluent Interface Step 1: Add Gateway Pattern




                                               | Sector, Alliance, Offering
Step 2: Add Fluent Interface Pattern




                                       | Sector, Alliance, Offering
Examples from other Frameworks
Moq:




FluentData:




                                               | Sector, Alliance, Offering
When to use Fluent Interfaces

 Anywhere where it makes the code easier to read and easier to use
 Typically in methods that are often invoked
 Together with the Gateway Pattern to hide complex 3rd party code or
  legacy code
 Frameworks




                                                          | Sector, Alliance, Offering
QUESTIONS?

             | Sector, Alliance, Offering
www.capgemini.com



The information contained in this presentation is proprietary. ©2010 Capgemini. All rights reserved

Contenu connexe

Tendances

Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchangeKhasim Saheb
 
The Single Responsibility Principle
The Single Responsibility PrincipleThe Single Responsibility Principle
The Single Responsibility PrincipleLars-Erik Kindblad
 
Unit 15 cobra case
Unit   15 cobra caseUnit   15 cobra case
Unit 15 cobra caseRaju Panga
 
Real-world Entity Framework
Real-world Entity FrameworkReal-world Entity Framework
Real-world Entity FrameworkLynn Langit
 
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...Valerio Cosentino
 
The Business Case behind Cloud Computing - The risks and rewards
The Business Case behind Cloud Computing - The risks and rewardsThe Business Case behind Cloud Computing - The risks and rewards
The Business Case behind Cloud Computing - The risks and rewardsOptimation
 

Tendances (6)

Mule anypoint exchange
Mule anypoint exchangeMule anypoint exchange
Mule anypoint exchange
 
The Single Responsibility Principle
The Single Responsibility PrincipleThe Single Responsibility Principle
The Single Responsibility Principle
 
Unit 15 cobra case
Unit   15 cobra caseUnit   15 cobra case
Unit 15 cobra case
 
Real-world Entity Framework
Real-world Entity FrameworkReal-world Entity Framework
Real-world Entity Framework
 
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
A Model-Based Approach for Extracting Business Rules out of Legacy Informatio...
 
The Business Case behind Cloud Computing - The risks and rewards
The Business Case behind Cloud Computing - The risks and rewardsThe Business Case behind Cloud Computing - The risks and rewards
The Business Case behind Cloud Computing - The risks and rewards
 

En vedette

Application Layer in PHP
Application Layer in PHPApplication Layer in PHP
Application Layer in PHPPer Bernhardt
 
Responsive Design - Quick & Dirty
Responsive Design - Quick & DirtyResponsive Design - Quick & Dirty
Responsive Design - Quick & DirtyArno Selhorst
 
Webinar: Responsive Design
Webinar: Responsive DesignWebinar: Responsive Design
Webinar: Responsive Designkuehlhaus AG
 
Avoid code duplication! Principles & Patterns
Avoid code duplication! Principles & PatternsAvoid code duplication! Principles & Patterns
Avoid code duplication! Principles & PatternsLars-Erik Kindblad
 
How to build more reliable, robust and scalable distributed systems
How to build more reliable, robust and scalable distributed systemsHow to build more reliable, robust and scalable distributed systems
How to build more reliable, robust and scalable distributed systemsLars-Erik Kindblad
 
Anforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML GrundlagenAnforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML GrundlagenChristian Baranowski
 
Domain Driven Design und Nosql
Domain Driven Design und Nosql Domain Driven Design und Nosql
Domain Driven Design und Nosql ArangoDB Database
 
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionierenMobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionierenMarkus Greve
 
Publish & Subscribe to events using an Event Aggregator
Publish & Subscribe to events using an Event AggregatorPublish & Subscribe to events using an Event Aggregator
Publish & Subscribe to events using an Event AggregatorLars-Erik Kindblad
 
Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8chmoser79
 
Domain-driven design - eine Einführung
Domain-driven design - eine EinführungDomain-driven design - eine Einführung
Domain-driven design - eine Einführungdie.agilen GmbH
 
SwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
SwissICT Fachgruppe UX: Definition und Bedeutung von User ExperienceSwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
SwissICT Fachgruppe UX: Definition und Bedeutung von User ExperienceNetcetera
 
Message Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusMessage Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusLars-Erik Kindblad
 
Beyond GUI - Die Zukunft digitaler Interfaces
Beyond GUI - Die Zukunft digitaler InterfacesBeyond GUI - Die Zukunft digitaler Interfaces
Beyond GUI - Die Zukunft digitaler InterfacesSENSORY-MINDS
 
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?Thomas Gläser
 
Inversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionInversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionDinesh Sharma
 
Mobile Development mit ASP.NET MVC 4
Mobile Development mit ASP.NET MVC 4Mobile Development mit ASP.NET MVC 4
Mobile Development mit ASP.NET MVC 4Digicomp Academy AG
 

En vedette (20)

Application Architecture
Application ArchitectureApplication Architecture
Application Architecture
 
Application Layer in PHP
Application Layer in PHPApplication Layer in PHP
Application Layer in PHP
 
Ready or not: No UI vom Verschwinden des Graphical User Interfaces
Ready or not: No UI vom Verschwinden des Graphical User InterfacesReady or not: No UI vom Verschwinden des Graphical User Interfaces
Ready or not: No UI vom Verschwinden des Graphical User Interfaces
 
Responsive Design - Quick & Dirty
Responsive Design - Quick & DirtyResponsive Design - Quick & Dirty
Responsive Design - Quick & Dirty
 
Webinar: Responsive Design
Webinar: Responsive DesignWebinar: Responsive Design
Webinar: Responsive Design
 
Avoid code duplication! Principles & Patterns
Avoid code duplication! Principles & PatternsAvoid code duplication! Principles & Patterns
Avoid code duplication! Principles & Patterns
 
Systementwurf mit UML
Systementwurf mit UMLSystementwurf mit UML
Systementwurf mit UML
 
How to build more reliable, robust and scalable distributed systems
How to build more reliable, robust and scalable distributed systemsHow to build more reliable, robust and scalable distributed systems
How to build more reliable, robust and scalable distributed systems
 
Anforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML GrundlagenAnforderungsanalyse und UML Grundlagen
Anforderungsanalyse und UML Grundlagen
 
Domain Driven Design und Nosql
Domain Driven Design und Nosql Domain Driven Design und Nosql
Domain Driven Design und Nosql
 
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionierenMobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
Mobile Patterns - Wie Apps und Co. digitale Interfaces revolutionieren
 
Publish & Subscribe to events using an Event Aggregator
Publish & Subscribe to events using an Event AggregatorPublish & Subscribe to events using an Event Aggregator
Publish & Subscribe to events using an Event Aggregator
 
Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8Roadmap von Microsoft UI Technologien und Windows 8
Roadmap von Microsoft UI Technologien und Windows 8
 
Domain-driven design - eine Einführung
Domain-driven design - eine EinführungDomain-driven design - eine Einführung
Domain-driven design - eine Einführung
 
SwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
SwissICT Fachgruppe UX: Definition und Bedeutung von User ExperienceSwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
SwissICT Fachgruppe UX: Definition und Bedeutung von User Experience
 
Message Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBusMessage Oriented Architecture using NServiceBus
Message Oriented Architecture using NServiceBus
 
Beyond GUI - Die Zukunft digitaler Interfaces
Beyond GUI - Die Zukunft digitaler InterfacesBeyond GUI - Die Zukunft digitaler Interfaces
Beyond GUI - Die Zukunft digitaler Interfaces
 
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
Sci-Fi Interfaces - Innovationsmotor für Mensch-Maschine-Interfaces?
 
Inversion of Control and Dependency Injection
Inversion of Control and Dependency InjectionInversion of Control and Dependency Injection
Inversion of Control and Dependency Injection
 
Mobile Development mit ASP.NET MVC 4
Mobile Development mit ASP.NET MVC 4Mobile Development mit ASP.NET MVC 4
Mobile Development mit ASP.NET MVC 4
 

Similaire à The Fluent Interface Pattern

NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET Dmytro Mindra
 
Domain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsMark Windholtz
 
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...Prolifics
 
Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...Grid Dynamics
 
Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...Grid Dynamics
 
Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...Grid Dynamics
 
Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...Grid Dynamics
 
2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use itMark Windholtz
 
Tools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy codeTools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy codeDennis Doomen
 
TeamSpirit
TeamSpiritTeamSpirit
TeamSpiritVideoguy
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural stylesMajong DevJfu
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware ProgrammingPostSharp Technologies
 
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...Perforce
 
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)Arnaud Bouchez
 
2011 iska - tim m - domain driven design
2011   iska - tim m - domain driven design2011   iska - tim m - domain driven design
2011 iska - tim m - domain driven designTim Mahy
 

Similaire à The Fluent Interface Pattern (20)

20120709 cyber patterns2012
20120709 cyber patterns201220120709 cyber patterns2012
20120709 cyber patterns2012
 
Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
Domain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic PatternsDomain Driven Design Big Picture Strategic Patterns
Domain Driven Design Big Picture Strategic Patterns
 
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
 
Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...
 
Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...Conversational commerce: emerging architectures for smart & useful chatbots -...
Conversational commerce: emerging architectures for smart & useful chatbots -...
 
Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...
 
Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...Conversational commerce: emerging architectures for smart & useful chatbots. ...
Conversational commerce: emerging architectures for smart & useful chatbots. ...
 
2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it2019-Nov: Domain Driven Design (DDD) and when not to use it
2019-Nov: Domain Driven Design (DDD) and when not to use it
 
thrift-20070401
thrift-20070401thrift-20070401
thrift-20070401
 
Tools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy codeTools and practices to help you deal with legacy code
Tools and practices to help you deal with legacy code
 
TeamSpirit
TeamSpiritTeamSpirit
TeamSpirit
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming
 
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
 
Interacting Domain Specific Languages
Interacting Domain Specific LanguagesInteracting Domain Specific Languages
Interacting Domain Specific Languages
 
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
 
2011 iska - tim m - domain driven design
2011   iska - tim m - domain driven design2011   iska - tim m - domain driven design
2011 iska - tim m - domain driven design
 

Dernier

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Dernier (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

The Fluent Interface Pattern

  • 1. The Fluent Interface Pattern Lars-Erik Kindblad Senior Consultant Blog: kindblad.com
  • 2. A common problem in most software projects  Technical debts increases over time and the code gets harder and harder to maintain and add features to | Sector, Alliance, Offering
  • 3. Feature delivery for most projects Technical debt Complex and messy code Code and logic is duplicated No common coding standard Features Delivered No strict architecture ++ Time | Sector, Alliance, Offering
  • 4. Ideal Feature Delivery Features Delivered Time | Sector, Alliance, Offering
  • 5. How to reach ideal delivery?  Software development is complex  Not a single solution but a mix of many different things • Write a lot of code • Important to understand the business model • Readable & maintainable code over fancy code • Simplicity over complexity • Decide on a common coding standard • Reuse code instead of code duplication • Create a project framework with common code and logic • Design Patterns – follow generic solutions to commonly occurring problems o 100s of design patterns exists – Factory Pattern, MVC Pattern, Command Pattern, Fluent Interface Pattern etc. • ++ | Sector, Alliance, Offering
  • 6. The Fluent Interface Pattern  One of many design patterns that can contribute to a better code base  Fluent Interfaces makes the code easier to read and easier to use due to a simpler API that requires less code  Consists of 2 principles: • Method chaining - Traditional code requires one line per command, method chaining allows multiple commands per line • More readable API – The code can be read like a sentence. Optional as it requires more typing due to longer names and more code to write  Popular to use in frameworks: Moq, Fluent Nhibernate, FluentData etc. | Sector, Alliance, Offering
  • 7. Example – Find a person Traditional Code: Fluent Interface Code: Or: | Sector, Alliance, Offering
  • 8. A more readable Fluent Interface Or: | Sector, Alliance, Offering
  • 9. Designing Fluent Interfaces - Method vs. Property Use a method when having to accept one or more values Use a property when not having to accept any values Use a method to finish the call | Sector, Alliance, Offering
  • 10. Traditional Code | Sector, Alliance, Offering
  • 11. Fluent Interface Code | Sector, Alliance, Offering
  • 12. Example #2 – A List of Persons Traditional Code: Fluent Code: | Sector, Alliance, Offering
  • 13. Traditional Code | Sector, Alliance, Offering
  • 14. Fluent Interface Step 1: Add Gateway Pattern | Sector, Alliance, Offering
  • 15. Step 2: Add Fluent Interface Pattern | Sector, Alliance, Offering
  • 16. Examples from other Frameworks Moq: FluentData: | Sector, Alliance, Offering
  • 17. When to use Fluent Interfaces  Anywhere where it makes the code easier to read and easier to use  Typically in methods that are often invoked  Together with the Gateway Pattern to hide complex 3rd party code or legacy code  Frameworks | Sector, Alliance, Offering
  • 18. QUESTIONS? | Sector, Alliance, Offering
  • 19. www.capgemini.com The information contained in this presentation is proprietary. ©2010 Capgemini. All rights reserved