SlideShare a Scribd company logo
Glass V4, More Info For
Your Solution
Mike Edwards
Glass
@mikeedwards83
@glasslu
Sitecore User Group Conference 2015 1
Glass V4, More Info For
Your Solution
Modeling
Mike Edwards
Glass
@mikeedwards83
@glasslu
Sitecore User Group Conference 2015 2
Hello!
Sitecore User Group Conference 2015 3
Mike
Edwards
Sitecore MVP
@mikeedwards83
@glasslu
Modelling
Sitecore User Group Conference 2015 4
NOT THIS KIND
Modelling
Sitecore User Group Conference 2015 5
THIS KIND
Modelling
• Different Patterns
• Common Mistakes
• Techniques
Sitecore User Group Conference 2015 6
Common Patterns
• Active Record
• Data Mapping
• Wrapping
Sitecore User Group Conference 2015 7
Active Record Pattern
In software engineering, the active record pattern is an
architectural pattern found in software that stores in-memory
object data in relational databases. The interface of an object
conforming to this pattern would include functions such as
Insert, Update, and Delete.
- Wiki, Martin Fowler
Sitecore User Group Conference 2015 8
Active Record Pattern
Sitecore User Group Conference 2015 9
The Example
Active Record Pattern - Pro’s
Simple to use:
Sitecore User Group Conference 2015 10
Active Record Pattern - Pro’s
Simple to pass around:
Sitecore User Group Conference 2015 11
Hidden side effects:
Active Record Pattern - Con’s
Sitecore User Group Conference 2015 12
Surprise!!
Pointless
Active Record Pattern - Cons
Coupled to data source:
Sitecore User Group Conference 2015 13
Active Record Pattern - Con’s
Complex:
Sitecore User Group Conference 2015 14
Active Record Pattern - Con’s
Hard to test:
Sitecore User Group Conference 2015 15
How do we
mock this??
Ask the FakeDB
Guys
Data Mapper Pattern
Data Mapper is a Data Access Layer that performs bidirectional
transfer of data between a persistent data store (often a
relational database) and an in memory data representation (the
domain layer). The goal of the pattern is to keep the in memory
representation and the persistent data store independent of
each other and the data mapper itself.
- Wiki, Martin Fowler
Sitecore User Group Conference 2015 16
Data Mapper Pattern
Sitecore User Group Conference 2015 17
The Example
Data Mapper Pattern
Sitecore User Group Conference 2015 18
The Example
Data Mapper Pattern
Sitecore User Group Conference 2015 19
The Example
Data Mapper Pattern
Simple Models
Sitecore User Group Conference 2015 20
Data Mapper Pattern - Pro’s
Easy Testing
Sitecore User Group Conference 2015 21
Data Mapper Pattern - Pro’s
Clear Separation
Sitecore User Group Conference 2015 22
My World Their World
Data Mapper Pattern - Pro’s
Store Anywhere
Sitecore User Group Conference 2015 23
Data Mapper Pattern - Pro’s
Clear Control
Sitecore User Group Conference 2015 24
Hello!!
Data Mapper Pattern - Con’s
Map Unused Data
Sitecore User Group Conference 2015 25
Data Mapper Pattern - Con’s
Expensive Upfront
Sitecore User Group Conference 2015 26
Data Mapper Pattern - Con’s
Disconnection from source
Sitecore User Group Conference 2015 27
Where the hell did you
come from?
Wrappers Models
Wraps the underlying data source and converts the data on
demand. The internal model contains a reference to the original
data source which it uses to perform data conversion.
Sitecore User Group Conference 2015 28
Wrappers Models
Sitecore User Group Conference 2015 29
Wrappers Models - Pro’s
Cheap Up Front
Sitecore User Group Conference 2015 30
No work done here!
Only accessed properties
require conversion.
Wrappers Models - Pro’s
Hidden State Changes
Sitecore User Group Conference 2015 31
What happens if this
changes
Wrappers Models - Pro’s
Hidden State Changes
Sitecore User Group Conference 2015 32
Are these the same?
Wrappers Models - Con’s
Testing Difficulty
Sitecore User Group Conference 2015 33
Can’t test because
of this.
Have to write
data conversion code
Need to understand
this
Wrappers Models - Meet my partner
Coupling
Sitecore User Group Conference 2015 34
I ask for this
Wrappers Models - Meet my partner
Coupling
Sitecore User Group Conference 2015 35
I get this
Common Problems
• Anemic domain model
• Bloated domain model
• Skinny domain model
• Indiscreet domain model
Sitecore User Group Conference 2015 36
Anemic Domain Model
Anemic domain model is the use of a software domain model
where the domain objects contain little or no business logic
(validations, calculations, business rules etc).
- Wiki, Martin Fowler
Sitecore User Group Conference 2015 37
Anemic Domain Model - Example
Sitecore User Group Conference 2015 38
Feed Me!!
Anemic Domain Model
Sitecore User Group Conference 2015 39
Bloated Domain Model
A Bloated Domain Model is the use of a software domain model
that contains a large number of properties that are never access
or required by the application.
- Mike E
Sitecore User Group Conference 2015 40
Bloated Domain Model
Sitecore User Group Conference 2015 41
Bloated Domain Model
Fixed
Sitecore User Group Conference 2015 42
Skinny Domain Model
A Skinny Domain Model is the use of a software domain model
that contains one or very few properties.
- Mike
Sitecore User Group Conference 2015 43
Skinny Domain Model
Skinny Domain model
Sitecore User Group Conference 2015 44
Skinny Domain Model
Fixed
Sitecore User Group Conference 2015 45
USE THE RAW API!
Indiscreet Domain Model
A Indiscreet Domain Model is the use of a software domain
model that exposes all it’s properties publically even if they
should or should not be accessed by external code.
- Mike E
Sitecore User Group Conference 2015 46
Indiscreet Domain Model
Sitecore User Group Conference 2015 47
Indiscreet Domain Model
Fixed
Sitecore User Group Conference 2015 48
Techniques
Sitecore User Group Conference 2015 49
• Interface Models
• Template Models
• Rendering Models
• MVC
• MVP
Interface Models
Sitecore User Group Conference 2015 50
Domain models defined using interfaces only. Interface are
dynamically implemented at run time using a proxy framework.
Interface Models
Sitecore User Group Conference 2015 51
Interface Models
• Multiple Inheritance
• Very little code
• Often Anemic
• Indiscreet
Sitecore User Group Conference 2015 52
Interface Models
Sitecore User Group Conference 2015 53
Spoofing Logic
Template Models
Sitecore User Group Conference 2015 54
Template Models
• Code generation friendly
• Easy to sync
• Bloated
• Indiscreet
• Anemic
Sitecore User Group Conference 2015 55
Rendering Models
Sitecore User Group Conference 2015 56
Rendering Models
• Use case specific
• Minimum number of properties
• Custom methods
• Model explosion
• Magic Properties Problem
• Skinny
Sitecore User Group Conference 2015 57
MVC Models
Model–view–controller (MVC) is a software architectural
pattern for implementing user interfaces. It divides a given
software application into three interconnected parts, so as to
separate internal representations of information from the ways
that information is presented to or accepted from the user.
- - Wiki
Sitecore User Group Conference 2015 58
MVC Models
What do we pass to the view?
Sitecore User Group Conference 2015 59
MVC Models
The View Model
• Explicitly defines the contract
• Easy to expand
• Use convention
• Separates Domain from View
Sitecore User Group Conference 2015 60
MVC Models
Sitecore User Group Conference 2015 61
Easy to find
MVC Models
Sitecore User Group Conference 2015 62
Easy to identify!
And don’t forget MVP!
MVP is a user interface architectural pattern engineered to
facilitate automated unit testing and improve the separation of
concerns in presentation logic.
- Wiki
Sitecore User Group Conference 2015 63
MVP
Sitecore User Group Conference 2015 64
MVP is similar to MVC
Sitecore User Group Conference 2015 65
MVP or MVC?
Sitecore User Group Conference 2015 66
Finished!!
Questions?
Sitecore User Group Conference 2015 67
68
Find Me:
Sitecore User Group Conference 2015 68
Mike
Edwards
Sitecore MVP
@mikeedwards83
@glasslu
mike@glass.lu
[Reserved for sponsor logo’s]
Sitecore User Group Conference 2015 69Sitecore User Group Conference 2015 69
Thank you

More Related Content

PPTX
Glass.Mapper.Sc V4 Presentation
PPTX
Lightning Web Components by Abdul Gafoor
PDF
Build 2014 - Running Java and Oracle Applications on Microsoft Azure
PDF
How to build a Java Web App in the Cloud
ODP
Spring cloud for microservices architecture
PDF
Cloud Service Integration with WSO2 Developer Studio and WSO2 ESB
PDF
angular-wakanda ngParis meetup 15 at 42
PDF
Connectors for the New Enterprise with WSO2 ESB 4.8
Glass.Mapper.Sc V4 Presentation
Lightning Web Components by Abdul Gafoor
Build 2014 - Running Java and Oracle Applications on Microsoft Azure
How to build a Java Web App in the Cloud
Spring cloud for microservices architecture
Cloud Service Integration with WSO2 Developer Studio and WSO2 ESB
angular-wakanda ngParis meetup 15 at 42
Connectors for the New Enterprise with WSO2 ESB 4.8

What's hot (14)

PPTX
Build HTML5 Sites/Apps with Kendo UI Core
PPTX
Wavemaker RAD for the Cloud with CloudJee - Future Direction 2014
PPTX
SSR with React - Connecting Next.js with WordPress
PDF
WaveMaker Next: Webinar - Presentation
PDF
End to-end W3C - JS.everywhere(2012) Europe
PDF
From Web App Model Design to Production with Wakanda
PPTX
Next.js vs React | what to choose for frontend development_
PDF
iOS团队开发实践经验
PPTX
Geek night micro front ends
PPTX
Java in azure dev ops
PPTX
Tanner Ellen - Forcelandia 2016 - Dev Stack.pptx
PDF
Java 8: Nashorn & avatar.js di Enrico Risa al JUG Roma
PDF
ExtJS: La piattaforma vincente (tools)
PPTX
JavaFX and HTML5 - Like Curds and Rice
Build HTML5 Sites/Apps with Kendo UI Core
Wavemaker RAD for the Cloud with CloudJee - Future Direction 2014
SSR with React - Connecting Next.js with WordPress
WaveMaker Next: Webinar - Presentation
End to-end W3C - JS.everywhere(2012) Europe
From Web App Model Design to Production with Wakanda
Next.js vs React | what to choose for frontend development_
iOS团队开发实践经验
Geek night micro front ends
Java in azure dev ops
Tanner Ellen - Forcelandia 2016 - Dev Stack.pptx
Java 8: Nashorn & avatar.js di Enrico Risa al JUG Roma
ExtJS: La piattaforma vincente (tools)
JavaFX and HTML5 - Like Curds and Rice
Ad

Similar to SUGCON 2015 Modelling (20)

PPTX
Attain Clean Code in Sitecore Solutions using Design Patterns
PDF
Enterprise PHP Architecture through Design Patterns and Modularization (Midwe...
PPTX
Philly Sitecore User Group Meetup | Post-Symposium Knowledge Share
PDF
The Heart of Data Modeling Webinar: State of the Union Data Modeling
PPTX
Domain Driven Design in the Browser - Cameron Edwards
ODP
Into the domain
PDF
Data Modelling For Software Engineers (Devoxx GR 2025).pdf
PDF
Modeling Webinar: State of the Union for Data Innovation - 2016
PPTX
1-SDLC - Development Models – Waterfall, Rapid Application Development, Agile...
PPTX
05 entity framework
PDF
Modelling a complex domain with Domain-Driven Design
PPTX
Sitecore 8 XP – A Dream for Digital Marketers
PPTX
SUG Bangalore - Kick Off Session
PDF
Data-Ed Online: Data Architecture Requirements
PDF
Data-Ed: Data Architecture Requirements
PDF
Software design with Domain-driven design
PPTX
Sitecore Dev User Group Meetup in Milwaukee - Perficient - Rick Bauer
PPTX
Up to speed in domain driven design
PPTX
Design Patterns on Sitecore: The Good, the Bad and the Ugly
PDF
Data mining, prediction and machine learning with Sitecore xDB
Attain Clean Code in Sitecore Solutions using Design Patterns
Enterprise PHP Architecture through Design Patterns and Modularization (Midwe...
Philly Sitecore User Group Meetup | Post-Symposium Knowledge Share
The Heart of Data Modeling Webinar: State of the Union Data Modeling
Domain Driven Design in the Browser - Cameron Edwards
Into the domain
Data Modelling For Software Engineers (Devoxx GR 2025).pdf
Modeling Webinar: State of the Union for Data Innovation - 2016
1-SDLC - Development Models – Waterfall, Rapid Application Development, Agile...
05 entity framework
Modelling a complex domain with Domain-Driven Design
Sitecore 8 XP – A Dream for Digital Marketers
SUG Bangalore - Kick Off Session
Data-Ed Online: Data Architecture Requirements
Data-Ed: Data Architecture Requirements
Software design with Domain-driven design
Sitecore Dev User Group Meetup in Milwaukee - Perficient - Rick Bauer
Up to speed in domain driven design
Design Patterns on Sitecore: The Good, the Bad and the Ugly
Data mining, prediction and machine learning with Sitecore xDB
Ad

SUGCON 2015 Modelling

Editor's Notes

  • #2: DO NOT REMOVE THIS SLIDE
  • #23: DO NOT REMOVE THIS SLIDE