SlideShare a Scribd company logo
Software Development
Training wheels
Naveen Muguda
Training Wheels
• Programming with Static Classes
• Data Driven Design
• Transaction scripts
• Anemic Domain Model
Complexity vs Familiarity
• lineItemList.stream().map(lineItem ->
lineItem.getTerms().getPrice()).reduce(ZERO, BigDecimal::add)
• map()
• reduce()
• anonymous function
• Is this code complex or is the programming style unfamiliar?
currying
• function add (a, b) { return a + b; }
• function add (a) { return function (b) { return a + b; } }
• add(3)(4);
• var add3 = add(3);
• add3(4);
• https://en.wikipedia.org/wiki/Currying
Currying (continued)
• add x y = x + y
• map (add 2) [1, 2, 3] -- gives [3, 4, 5]
• add2 y = add 2 y
• map add2 [1, 2, 3]
Static classes
• public class Position{
• public double latitude; public double longitude; }
• public class PositionUtility {
• public static double distance( Position position1, Position position2 )
public static double heading( Position position1, Position position2 )
}
• Positions are parameters to PositionUtility
Static classes(..continued)
• double distance = PositionUtility.distance( myHouse, coffeeShop );
double heading = PositionUtility.heading( myHouse, coffeeShop);
Object Oriented Programming
• public class Position {
• public double distance( Position position )}
• public double heading( Position position ) {}
• private double latitude; private double longitude; }
Object Oriented Programming(..continued)
• Position myHouse = new Position( , );
• Position coffeeShop = new Position( , );
• double distance = myHouse.distance( coffeeShop );
• double heading = myHouse.heading( coffeeShop );
Currying vs Object Orientedness
• add(3, 4) => PositionUtil.distance(Position position1, Position
position2 )
• add 3 = > Position house = new ….
• add3(4) = > house.distance(coffeeShop)
• ‘identity’
Stack in procedural style
structure stack:
maxsize : integer
top : integer
items : array of item
procedure push(stk : stack, x : item):
if stk.top = stk.maxsize:
report overflow error
else:
stk.items[stk.top] ← x
stk.top ← stk.top + 1
procedure pop(stk : stack):
if stk.top = 0:
report underflow error
else:
stk.top ← stk.top − 1
r ← stk.items[stk.top]
Stack in Object Oriented style
public Class Stack
{
private ...
public Stack(){}
public push(){}
public pop(){}
}
Encapsulation and Information Hiding
• Changes to fields(from array to linked list), will cascade to other
methods
• Lazy initialization in the constructor, will move additional behavior to
push and pop
capsule
• a small (glass or plastic) container that has something (such as a
liquid) inside of it.
• There is an inside and outside to the capsule
• There is no or partial understanding of the contents of the capsule for
the outside
Invariants
• size of the stack = total valid pushs – total valid pops
• stk.top is at the top of the data in the stack
• The responsibility of maintaining these invariants lie with Stack
• Stack is in charge of its destiny
• Single place to reason
encapsulation
• encapsulate what varies
• encapsulating with classes frees a dimension of change
• Object oriented-ness provides currying at the object level
Spring2.0 feature
• http://tinyurl.com/j7wykok
Design Approaches
Different schools
• Data Driven Design: Head, Tail, Body, 4 Legs
• Event Driven Design: Start, Stop, Speed Up, Slow Down
• Responsibility Driven Design: eat, run, stand, sit, sleep, poop
Data driven design
• Modelling done for Data(ER diagrams, DFDs)
• Programs are massagers, routers and processors of data
• No recommendations on modularizing the behavior
• Typically this behavior is placed in classes Service, Util, Helper or
Manager.
• Useful for building CRUDy applications
• https://en.wikipedia.org/wiki/Data-driven_programming
Responsibility Driven Design
focuses on the contract by asking:
• What actions is this object responsible for?
• What information does this object share?
RDD:Objects
• things that have machine like behaviors that can be plugged together
to work in concert
• play well-defined roles and encapsulate scripted responses and
information
• Subsystem: logical grouping of collaborators.
RDD:responsibilities
• an obligation to perform a task or know information
• public(checkout), private, subordinate(provider), sequencing
Data Driven vs Responsibility Driven Design
• https://practicingruby.com/articles/responsibility-centric-vs-data-
centric-design
Control Style
• distribution of control responsibilities that results in developing a
control style.
• Central
• Clustered
• Delegated
• https://en.wikipedia.org/wiki/Responsibility-driven_design
• Same school of thought as Kent Beck and Ward
Cunningham(http://wiki.c2.com/?ResponsibilityDrivenDesign)
Transaction Scripts
• business applications modelled as a series of transactions.
• Each transaction will have its own Transaction Script
• A Transaction Script organizes all this logic primarily as a single
procedure
• although common subtasks can be broken into sub procedures.
• Not (functionally)scalable
Transaction Scripts: Symptoms
• AddHandler
• RemoveHandler
• ViewHandler
• PaymentHandler
Domain Model
• https://www.cp.eng.chula.ac.th/~wiwat/EAA/EAAdomain.pdf
Fowler Speak: Anemic Domain Model
• Domain objects are just bags of getters and setters
• No behavior in Domain objects
• a set of service objects which capture all the domain logic.
• Services use domain model for data
• http://www.martinfowler.com/bliki/AnemicDomainModel.html
invariants
• Remember the stack example, similarly maintaining invariant
• The responsibility of getting the terms lies with Checkout and not an
external utility/Service
(Application)Services
Application Services (..continued)
• This layer is kept thin. It does not contain business rules or knowledge,
but only coordinates tasks
• delegates work to collaborations of domain objects in the next layer
down.
• The key point here is that the Service Layer is thin - all the key logic
lies in the domain layer.
• Domain objects are re-used, services are typically not
Application Services (..continued)
• In general, the more behavior you find in the services, the more likely
you are to be robbing yourself of the benefits of a domain model.
• If all your logic is in services, you've robbed yourself blind.
Rich Domain Model
• https://www.link-intersystems.com/blog/2011/10/01/anemic-vs-rich-
domain-models/
• Services in a service-oriented architecture are usually application
services that encapsulate use cases.
• The only difference to plain transaction scripts is often that they
use parameter objects that are named after domain objects.
Static Object
Data Driven
Responsibility
Driven
Transaction
Script
Domain
Model
Anemic Domain
Model
Rich Domain
Model
Procedural
Static Object
Data Driven
Responsibility
Driven
Transaction
Script
Domain
Model
Anemic Domain
Model
Rich Domain
Model
Domain
Driven Design
Naked Objects
Domain Driven Design
• https://en.wikipedia.org/wiki/Domain-driven_design
• Entity
• Value Object An object that contains attributes but has no conceptual
identity. They should be treated as immutable.
• Service
• Factory.
Entity
• An object that is not defined by its attributes, but rather by a thread
of continuity and its identity.
• have life cycles that can radically change their form and content
• class definitions, responsibilities, attributes, and associations should
revolve around who they are
• Eg. Cart, Checkout, Order, Store
Services
• The operation relates to a domain concept that is not a natural part of
an Entity or Value Object
• The interface is defined in terms of other elements in the domain
model
• The operation is stateless
Services (..continued)
• They exist in three layers
• Application
• Domain
• Infrastructure
• http://tinyurl.com/z2yeutt
Application Services
• Application Services are the interface used by the outside world,
where the outside world can’t communicate via our Entity objects,
but may have other representations of them.
• Application Services could map outside messages to internal
operations and processes
• communicating with services in the Domain and Infrastructure layers
to provide cohesive operations for outside clients.
• Don’t contain any business logic
• Not part of domain layer
Domain services
• Domain services are the coordinators, allowing higher level
functionality between many different smaller parts.
• Part of domain model
• Can contain business logic
Factories and Repositories
• http://tinyurl.com/jdhuebj
• Factory encapsulates the knowledge needed to create a complex
object
• Can use FactoryMethod, AbstractFactory or Builder
• Can create Entities and ValueObjects
Repositories
• To do anything with an object, you have to hold a reference to it. How
do you get that reference?
• One way is to create the object
• A second way is to traverse an association. You start with an object you
already know and ask it for an associated object.
• Repositories are the second way
• Example: StoreRegistry
Naked Objects
• https://en.wikipedia.org/wiki/Naked_objects
Take Aways
• Domain Model >> Data Model
• Domain Objects >> bags of getters and setters
• Heart and Brain of your system is Domain Model
• Domain Objects(and services) are responsible for all of our business
logic
• Entities have identity and continuity
• Entities trump Services
• Layers preceding Domain Model have as little logic as possible
• Domain Objects react to ’business events’ and delegate

More Related Content

What's hot

Intro to Neo4j and Graph Databases
Intro to Neo4j and Graph DatabasesIntro to Neo4j and Graph Databases
Intro to Neo4j and Graph Databases
Neo4j
 
How Graph Databases efficiently store, manage and query connected data at s...
How Graph Databases efficiently  store, manage and query  connected data at s...How Graph Databases efficiently  store, manage and query  connected data at s...
How Graph Databases efficiently store, manage and query connected data at s...
jexp
 
DITA 1.3 Keyscopes
DITA 1.3 KeyscopesDITA 1.3 Keyscopes
DITA 1.3 Keyscopes
Leigh White
 
Migrate
MigrateMigrate
Migrate
cherryhillco
 
NoSQL Graph Databases - Why, When and Where
NoSQL Graph Databases - Why, When and WhereNoSQL Graph Databases - Why, When and Where
NoSQL Graph Databases - Why, When and Where
Eugene Hanikblum
 
Introduction: Relational to Graphs
Introduction: Relational to GraphsIntroduction: Relational to Graphs
Introduction: Relational to Graphs
Neo4j
 
Graph Analytics: Graph Algorithms Inside Neo4j
Graph Analytics: Graph Algorithms Inside Neo4jGraph Analytics: Graph Algorithms Inside Neo4j
Graph Analytics: Graph Algorithms Inside Neo4j
Neo4j
 
Interpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsInterpreting Relational Schema to Graphs
Interpreting Relational Schema to Graphs
Neo4j
 
Getting started with Graph Databases & Neo4j
Getting started with Graph Databases & Neo4jGetting started with Graph Databases & Neo4j
Getting started with Graph Databases & Neo4j
Suroor Wijdan
 

What's hot (9)

Intro to Neo4j and Graph Databases
Intro to Neo4j and Graph DatabasesIntro to Neo4j and Graph Databases
Intro to Neo4j and Graph Databases
 
How Graph Databases efficiently store, manage and query connected data at s...
How Graph Databases efficiently  store, manage and query  connected data at s...How Graph Databases efficiently  store, manage and query  connected data at s...
How Graph Databases efficiently store, manage and query connected data at s...
 
DITA 1.3 Keyscopes
DITA 1.3 KeyscopesDITA 1.3 Keyscopes
DITA 1.3 Keyscopes
 
Migrate
MigrateMigrate
Migrate
 
NoSQL Graph Databases - Why, When and Where
NoSQL Graph Databases - Why, When and WhereNoSQL Graph Databases - Why, When and Where
NoSQL Graph Databases - Why, When and Where
 
Introduction: Relational to Graphs
Introduction: Relational to GraphsIntroduction: Relational to Graphs
Introduction: Relational to Graphs
 
Graph Analytics: Graph Algorithms Inside Neo4j
Graph Analytics: Graph Algorithms Inside Neo4jGraph Analytics: Graph Algorithms Inside Neo4j
Graph Analytics: Graph Algorithms Inside Neo4j
 
Interpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsInterpreting Relational Schema to Graphs
Interpreting Relational Schema to Graphs
 
Getting started with Graph Databases & Neo4j
Getting started with Graph Databases & Neo4jGetting started with Graph Databases & Neo4j
Getting started with Graph Databases & Neo4j
 

Viewers also liked

WW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The Hague
WW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The HagueWW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The Hague
WW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The Hague
Olaf Janssen
 
Commercial for CE Courses
Commercial for CE CoursesCommercial for CE Courses
Commercial for CE Courses
GLemelin
 
Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...
Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...
Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...
Olaf Janssen
 
Maria Fojk Edu Learn Conference Presentation
Maria Fojk Edu Learn Conference PresentationMaria Fojk Edu Learn Conference Presentation
Maria Fojk Edu Learn Conference PresentationFIT Ltd
 
Kaip padidinti gydymo režimo laikymąsi
Kaip padidinti gydymo režimo laikymąsiKaip padidinti gydymo režimo laikymąsi
Kaip padidinti gydymo režimo laikymąsi
Dainius Jakučionis
 
iPractice banners
iPractice bannersiPractice banners
iPractice bannersDiana Try
 
PRESENTATION JONAS BROTHERS
PRESENTATION JONAS BROTHERSPRESENTATION JONAS BROTHERS
PRESENTATION JONAS BROTHERSguest1d85e39
 
Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...
Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...
Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...
Stroom
 
Focus the digital revolution
Focus the digital revolutionFocus the digital revolution
Focus the digital revolution
Narvik High School College
 
The Splendid Island Of Moorea
The Splendid Island Of MooreaThe Splendid Island Of Moorea
The Splendid Island Of Mooreaguest5920b7d
 
You Can Dance Roztańczone Miasto 2007
You Can Dance Roztańczone Miasto 2007You Can Dance Roztańczone Miasto 2007
You Can Dance Roztańczone Miasto 2007
Next
 
Things you don't see every day‏
Things you don't see every day‏Things you don't see every day‏
Things you don't see every day‏amr hassaan
 
Terugblik Wikipedian-in-Residence en mogelijkheden met Wikipedia in 2015
Terugblik Wikipedian-in-Residence en  mogelijkheden met Wikipedia in 2015Terugblik Wikipedian-in-Residence en  mogelijkheden met Wikipedia in 2015
Terugblik Wikipedian-in-Residence en mogelijkheden met Wikipedia in 2015
Olaf Janssen
 
E Tqf Open Source Lms
E Tqf Open Source LmsE Tqf Open Source Lms
E Tqf Open Source Lms
FIT Ltd
 
Victoria, Eli, Mica
Victoria, Eli, MicaVictoria, Eli, Mica
Victoria, Eli, Micaguesta08c073
 

Viewers also liked (20)

WW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The Hague
WW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The HagueWW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The Hague
WW2 underground newspapers on Wikipedia using DBPedia , 12-2-2016, The Hague
 
Poligonos
PoligonosPoligonos
Poligonos
 
Anschp25
Anschp25Anschp25
Anschp25
 
Commercial for CE Courses
Commercial for CE CoursesCommercial for CE Courses
Commercial for CE Courses
 
Presentaciomateria
PresentaciomateriaPresentaciomateria
Presentaciomateria
 
Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...
Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...
Evaluation Wikipedian-in-Residence National Library & Archives of the Netherl...
 
Maria Fojk Edu Learn Conference Presentation
Maria Fojk Edu Learn Conference PresentationMaria Fojk Edu Learn Conference Presentation
Maria Fojk Edu Learn Conference Presentation
 
Victorian Era
Victorian EraVictorian Era
Victorian Era
 
Kaip padidinti gydymo režimo laikymąsi
Kaip padidinti gydymo režimo laikymąsiKaip padidinti gydymo režimo laikymąsi
Kaip padidinti gydymo režimo laikymąsi
 
iPractice banners
iPractice bannersiPractice banners
iPractice banners
 
PRESENTATION JONAS BROTHERS
PRESENTATION JONAS BROTHERSPRESENTATION JONAS BROTHERS
PRESENTATION JONAS BROTHERS
 
Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...
Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...
Presentatie Onderstroom 2015 op Stroom Event 29 september 2015 in LantarenVen...
 
Focus the digital revolution
Focus the digital revolutionFocus the digital revolution
Focus the digital revolution
 
The Splendid Island Of Moorea
The Splendid Island Of MooreaThe Splendid Island Of Moorea
The Splendid Island Of Moorea
 
You Can Dance Roztańczone Miasto 2007
You Can Dance Roztańczone Miasto 2007You Can Dance Roztańczone Miasto 2007
You Can Dance Roztańczone Miasto 2007
 
Things you don't see every day‏
Things you don't see every day‏Things you don't see every day‏
Things you don't see every day‏
 
Blog4
Blog4Blog4
Blog4
 
Terugblik Wikipedian-in-Residence en mogelijkheden met Wikipedia in 2015
Terugblik Wikipedian-in-Residence en  mogelijkheden met Wikipedia in 2015Terugblik Wikipedian-in-Residence en  mogelijkheden met Wikipedia in 2015
Terugblik Wikipedian-in-Residence en mogelijkheden met Wikipedia in 2015
 
E Tqf Open Source Lms
E Tqf Open Source LmsE Tqf Open Source Lms
E Tqf Open Source Lms
 
Victoria, Eli, Mica
Victoria, Eli, MicaVictoria, Eli, Mica
Victoria, Eli, Mica
 

Similar to Software Development: Beyond Training wheels

Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
Up2 Technology
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
Chris Renner
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
IndraKhatri
 
How DITA Got Her Groove Back: Going Mapless with Don Day
How DITA Got Her Groove Back: Going Mapless with Don DayHow DITA Got Her Groove Back: Going Mapless with Don Day
How DITA Got Her Groove Back: Going Mapless with Don Day
Information Development World
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
JavedKhan524377
 
Feature driven agile oriented web applications
Feature driven agile oriented web applicationsFeature driven agile oriented web applications
Feature driven agile oriented web applicationsRam G Athreya
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
Marcos Labad
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
Allan Mangune
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
iqbalphy1
 
Marco Mancuso - Data Context Interaction
Marco Mancuso - Data Context InteractionMarco Mancuso - Data Context Interaction
Marco Mancuso - Data Context InteractioncosenzaLab
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDavid Mann
 
10 Big Data Technologies you Didn't Know About
10 Big Data Technologies you Didn't Know About 10 Big Data Technologies you Didn't Know About
10 Big Data Technologies you Didn't Know About
Jesus Rodriguez
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
anguraju1
 
Migrate all the things!
Migrate all the things!Migrate all the things!
Migrate all the things!
Dave Vasilevsky
 
Software Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iSoftware Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-i
Taymoor Nazmy
 
Done in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyDone in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easy
Roel Hartman
 
Pragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecture
Piotr Pelczar
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
Eduards Sizovs
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
Geoff Harcourt
 

Similar to Software Development: Beyond Training wheels (20)

SDWest2005Goetsch
SDWest2005GoetschSDWest2005Goetsch
SDWest2005Goetsch
 
Domain Driven Design
Domain Driven DesignDomain Driven Design
Domain Driven Design
 
An Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHPAn Introduction to Domain Driven Design in PHP
An Introduction to Domain Driven Design in PHP
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
How DITA Got Her Groove Back: Going Mapless with Don Day
How DITA Got Her Groove Back: Going Mapless with Don DayHow DITA Got Her Groove Back: Going Mapless with Don Day
How DITA Got Her Groove Back: Going Mapless with Don Day
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
 
Feature driven agile oriented web applications
Feature driven agile oriented web applicationsFeature driven agile oriented web applications
Feature driven agile oriented web applications
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
 
Software design with Domain-driven design
Software design with Domain-driven design Software design with Domain-driven design
Software design with Domain-driven design
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
Marco Mancuso - Data Context Interaction
Marco Mancuso - Data Context InteractionMarco Mancuso - Data Context Interaction
Marco Mancuso - Data Context Interaction
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4Reporting
 
10 Big Data Technologies you Didn't Know About
10 Big Data Technologies you Didn't Know About 10 Big Data Technologies you Didn't Know About
10 Big Data Technologies you Didn't Know About
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
Migrate all the things!
Migrate all the things!Migrate all the things!
Migrate all the things!
 
Software Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-iSoftware Engineering Lec5 oop-uml-i
Software Engineering Lec5 oop-uml-i
 
Done in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easyDone in 60 seconds - Creating Web 2.0 applications made easy
Done in 60 seconds - Creating Web 2.0 applications made easy
 
Pragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecturePragmatic Monolith-First, easy to decompose, clean architecture
Pragmatic Monolith-First, easy to decompose, clean architecture
 
Introduction to DDD
Introduction to DDDIntroduction to DDD
Introduction to DDD
 
React.js at Cortex
React.js at CortexReact.js at Cortex
React.js at Cortex
 

More from Naveenkumar Muguda

Ads quality
Ads qualityAds quality
Ads quality
Naveenkumar Muguda
 
Components: An overlooked abstraction
Components: An overlooked abstractionComponents: An overlooked abstraction
Components: An overlooked abstraction
Naveenkumar Muguda
 
Powerful software linkedin
Powerful software linkedinPowerful software linkedin
Powerful software linkedin
Naveenkumar Muguda
 
Yin Yangs of Software Development
Yin Yangs of Software DevelopmentYin Yangs of Software Development
Yin Yangs of Software Development
Naveenkumar Muguda
 
Programming in the large
Programming in the largeProgramming in the large
Programming in the large
Naveenkumar Muguda
 
Abstract Algebra and Category Theory
Abstract Algebra and Category Theory Abstract Algebra and Category Theory
Abstract Algebra and Category Theory
Naveenkumar Muguda
 
Fp
FpFp
Invariants & inversions
Invariants & inversionsInvariants & inversions
Invariants & inversions
Naveenkumar Muguda
 
Functional Programming, simplified
Functional Programming, simplifiedFunctional Programming, simplified
Functional Programming, simplified
Naveenkumar Muguda
 
Log* with Cassandra
Log* with CassandraLog* with Cassandra
Log* with Cassandra
Naveenkumar Muguda
 
Refactoring et al
Refactoring et alRefactoring et al
Refactoring et al
Naveenkumar Muguda
 
System design
System designSystem design
System design
Naveenkumar Muguda
 

More from Naveenkumar Muguda (12)

Ads quality
Ads qualityAds quality
Ads quality
 
Components: An overlooked abstraction
Components: An overlooked abstractionComponents: An overlooked abstraction
Components: An overlooked abstraction
 
Powerful software linkedin
Powerful software linkedinPowerful software linkedin
Powerful software linkedin
 
Yin Yangs of Software Development
Yin Yangs of Software DevelopmentYin Yangs of Software Development
Yin Yangs of Software Development
 
Programming in the large
Programming in the largeProgramming in the large
Programming in the large
 
Abstract Algebra and Category Theory
Abstract Algebra and Category Theory Abstract Algebra and Category Theory
Abstract Algebra and Category Theory
 
Fp
FpFp
Fp
 
Invariants & inversions
Invariants & inversionsInvariants & inversions
Invariants & inversions
 
Functional Programming, simplified
Functional Programming, simplifiedFunctional Programming, simplified
Functional Programming, simplified
 
Log* with Cassandra
Log* with CassandraLog* with Cassandra
Log* with Cassandra
 
Refactoring et al
Refactoring et alRefactoring et al
Refactoring et al
 
System design
System designSystem design
System design
 

Recently uploaded

Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
manasideore6
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
An Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering TechniquesAn Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering Techniques
ambekarshweta25
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
Kamal Acharya
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
itech2017
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 

Recently uploaded (20)

Fundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptxFundamentals of Induction Motor Drives.pptx
Fundamentals of Induction Motor Drives.pptx
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
An Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering TechniquesAn Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering Techniques
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Online aptitude test management system project report.pdf
Online aptitude test management system project report.pdfOnline aptitude test management system project report.pdf
Online aptitude test management system project report.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABSDESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
DESIGN AND ANALYSIS OF A CAR SHOWROOM USING E TABS
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 

Software Development: Beyond Training wheels

  • 2.
  • 3. Training Wheels • Programming with Static Classes • Data Driven Design • Transaction scripts • Anemic Domain Model
  • 4. Complexity vs Familiarity • lineItemList.stream().map(lineItem -> lineItem.getTerms().getPrice()).reduce(ZERO, BigDecimal::add) • map() • reduce() • anonymous function • Is this code complex or is the programming style unfamiliar?
  • 5. currying • function add (a, b) { return a + b; } • function add (a) { return function (b) { return a + b; } } • add(3)(4); • var add3 = add(3); • add3(4); • https://en.wikipedia.org/wiki/Currying
  • 6. Currying (continued) • add x y = x + y • map (add 2) [1, 2, 3] -- gives [3, 4, 5] • add2 y = add 2 y • map add2 [1, 2, 3]
  • 7.
  • 8. Static classes • public class Position{ • public double latitude; public double longitude; } • public class PositionUtility { • public static double distance( Position position1, Position position2 ) public static double heading( Position position1, Position position2 ) } • Positions are parameters to PositionUtility
  • 9. Static classes(..continued) • double distance = PositionUtility.distance( myHouse, coffeeShop ); double heading = PositionUtility.heading( myHouse, coffeeShop);
  • 10. Object Oriented Programming • public class Position { • public double distance( Position position )} • public double heading( Position position ) {} • private double latitude; private double longitude; }
  • 11. Object Oriented Programming(..continued) • Position myHouse = new Position( , ); • Position coffeeShop = new Position( , ); • double distance = myHouse.distance( coffeeShop ); • double heading = myHouse.heading( coffeeShop );
  • 12. Currying vs Object Orientedness • add(3, 4) => PositionUtil.distance(Position position1, Position position2 ) • add 3 = > Position house = new …. • add3(4) = > house.distance(coffeeShop) • ‘identity’
  • 13. Stack in procedural style structure stack: maxsize : integer top : integer items : array of item procedure push(stk : stack, x : item): if stk.top = stk.maxsize: report overflow error else: stk.items[stk.top] ← x stk.top ← stk.top + 1 procedure pop(stk : stack): if stk.top = 0: report underflow error else: stk.top ← stk.top − 1 r ← stk.items[stk.top]
  • 14. Stack in Object Oriented style public Class Stack { private ... public Stack(){} public push(){} public pop(){} }
  • 15. Encapsulation and Information Hiding • Changes to fields(from array to linked list), will cascade to other methods • Lazy initialization in the constructor, will move additional behavior to push and pop
  • 16. capsule • a small (glass or plastic) container that has something (such as a liquid) inside of it. • There is an inside and outside to the capsule • There is no or partial understanding of the contents of the capsule for the outside
  • 17. Invariants • size of the stack = total valid pushs – total valid pops • stk.top is at the top of the data in the stack • The responsibility of maintaining these invariants lie with Stack • Stack is in charge of its destiny • Single place to reason
  • 18. encapsulation • encapsulate what varies • encapsulating with classes frees a dimension of change • Object oriented-ness provides currying at the object level
  • 21. Different schools • Data Driven Design: Head, Tail, Body, 4 Legs • Event Driven Design: Start, Stop, Speed Up, Slow Down • Responsibility Driven Design: eat, run, stand, sit, sleep, poop
  • 22. Data driven design • Modelling done for Data(ER diagrams, DFDs) • Programs are massagers, routers and processors of data • No recommendations on modularizing the behavior • Typically this behavior is placed in classes Service, Util, Helper or Manager. • Useful for building CRUDy applications • https://en.wikipedia.org/wiki/Data-driven_programming
  • 23. Responsibility Driven Design focuses on the contract by asking: • What actions is this object responsible for? • What information does this object share?
  • 24. RDD:Objects • things that have machine like behaviors that can be plugged together to work in concert • play well-defined roles and encapsulate scripted responses and information • Subsystem: logical grouping of collaborators.
  • 25. RDD:responsibilities • an obligation to perform a task or know information • public(checkout), private, subordinate(provider), sequencing
  • 26. Data Driven vs Responsibility Driven Design • https://practicingruby.com/articles/responsibility-centric-vs-data- centric-design
  • 27. Control Style • distribution of control responsibilities that results in developing a control style. • Central • Clustered • Delegated • https://en.wikipedia.org/wiki/Responsibility-driven_design • Same school of thought as Kent Beck and Ward Cunningham(http://wiki.c2.com/?ResponsibilityDrivenDesign)
  • 28.
  • 29. Transaction Scripts • business applications modelled as a series of transactions. • Each transaction will have its own Transaction Script • A Transaction Script organizes all this logic primarily as a single procedure • although common subtasks can be broken into sub procedures. • Not (functionally)scalable
  • 30. Transaction Scripts: Symptoms • AddHandler • RemoveHandler • ViewHandler • PaymentHandler
  • 31.
  • 33.
  • 34.
  • 35.
  • 36. Fowler Speak: Anemic Domain Model • Domain objects are just bags of getters and setters • No behavior in Domain objects • a set of service objects which capture all the domain logic. • Services use domain model for data • http://www.martinfowler.com/bliki/AnemicDomainModel.html
  • 37. invariants • Remember the stack example, similarly maintaining invariant • The responsibility of getting the terms lies with Checkout and not an external utility/Service
  • 39. Application Services (..continued) • This layer is kept thin. It does not contain business rules or knowledge, but only coordinates tasks • delegates work to collaborations of domain objects in the next layer down. • The key point here is that the Service Layer is thin - all the key logic lies in the domain layer. • Domain objects are re-used, services are typically not
  • 40. Application Services (..continued) • In general, the more behavior you find in the services, the more likely you are to be robbing yourself of the benefits of a domain model. • If all your logic is in services, you've robbed yourself blind.
  • 41. Rich Domain Model • https://www.link-intersystems.com/blog/2011/10/01/anemic-vs-rich- domain-models/ • Services in a service-oriented architecture are usually application services that encapsulate use cases. • The only difference to plain transaction scripts is often that they use parameter objects that are named after domain objects.
  • 43. Static Object Data Driven Responsibility Driven Transaction Script Domain Model Anemic Domain Model Rich Domain Model Domain Driven Design Naked Objects
  • 44. Domain Driven Design • https://en.wikipedia.org/wiki/Domain-driven_design • Entity • Value Object An object that contains attributes but has no conceptual identity. They should be treated as immutable. • Service • Factory.
  • 45. Entity • An object that is not defined by its attributes, but rather by a thread of continuity and its identity. • have life cycles that can radically change their form and content • class definitions, responsibilities, attributes, and associations should revolve around who they are • Eg. Cart, Checkout, Order, Store
  • 46. Services • The operation relates to a domain concept that is not a natural part of an Entity or Value Object • The interface is defined in terms of other elements in the domain model • The operation is stateless
  • 47. Services (..continued) • They exist in three layers • Application • Domain • Infrastructure • http://tinyurl.com/z2yeutt
  • 48. Application Services • Application Services are the interface used by the outside world, where the outside world can’t communicate via our Entity objects, but may have other representations of them. • Application Services could map outside messages to internal operations and processes • communicating with services in the Domain and Infrastructure layers to provide cohesive operations for outside clients. • Don’t contain any business logic • Not part of domain layer
  • 49. Domain services • Domain services are the coordinators, allowing higher level functionality between many different smaller parts. • Part of domain model • Can contain business logic
  • 50. Factories and Repositories • http://tinyurl.com/jdhuebj • Factory encapsulates the knowledge needed to create a complex object • Can use FactoryMethod, AbstractFactory or Builder • Can create Entities and ValueObjects
  • 51. Repositories • To do anything with an object, you have to hold a reference to it. How do you get that reference? • One way is to create the object • A second way is to traverse an association. You start with an object you already know and ask it for an associated object. • Repositories are the second way • Example: StoreRegistry
  • 53. Take Aways • Domain Model >> Data Model • Domain Objects >> bags of getters and setters • Heart and Brain of your system is Domain Model • Domain Objects(and services) are responsible for all of our business logic • Entities have identity and continuity • Entities trump Services • Layers preceding Domain Model have as little logic as possible • Domain Objects react to ’business events’ and delegate

Editor's Notes

  1. StoreRegistry
  2. Compare with StoreCheckoutFactory
  3. Responsibility of cart, checkout, provider etc.
  4. Delegation between Checkout and Providers
  5. Controller vs WebProxy, Controller vs Facade
  6. StoreCheckoutFactory