Upload
sander-hoogendoorn
View
108
Download
0
Tags:
Embed Size (px)
DESCRIPTION
In this unstable economy, organizations target software development at shorter time-to-market and high productivity. Model driven development has a promise of raising productivity in projects. However, many approach fail to deliver this promise. During this high-paced, interactive talk speakers Sander Hoogendoorn (Principal Technology Officer and agile thought leader at Capgemini) and Rody Middelkoop (Technical evangelist at Avisi, and lecturer at the Hogeschool Arnhem Nijmegen) share their very pragmatic approach to delivering software using model driven development. First, Sander will elaborate on the modeling and code generation approach, that relies on smart use cases and smart use case stereotype, a solid software architecture and domain driven design. Next, Rody will take the stage and demonstrate how this approach effects building Java web applications, generating a fully deployable Java EAR live on stage! Although other architectures and frameworks can be applied, Rody will use open source Java frameworks such as Ant, FreeMarker, Struts2, Spring and JPA/Hibernate3.
Citation preview
1<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Sander Hoogendoorn, Capgemini
Rody Middelkoop, Avisi
Pragmatic model driven development in Java using Pragmatic model driven development in Java using
smart use cases and domain driven developmentsmart use cases and domain driven development
Sander HoogendoornSander Hoogendoorn
Capgemini
� Principal technology officer
� Capgemini agile thought leader
� Certified global software engineer (SE4)
� Chief architect Accelerated Delivery Platform
Other
� Author books (UML, agile) and articles
� Speaker at conferences
2<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Speaker at conferences
� Microsoft Partner Advisory Council .NET
� Columnist Software Release Magazine, SDN Magazine
� Editorial board Software Release Magazine
� Editorial board Tijdschrift IT Management
� Advisory board @Portunity
� Member expert panel Computable
Web
� www.sanderhoogendoorn.com
� www.accelerateddeliveryplatform.com
Rody MiddelkoopRody Middelkoop
Avisi
� Technical consultant
Hogeschool Arnhem Nijmegen (HAN)
� Lecturer Software Engineering
Other
� Sun Certified Java Programmer / Developer
3<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Author of several articles
� Contributor Livre
� Speaker at conferences
Web
� www.avisi.nl
� rodymiddelkoop.blogspot.com
AgendaAgenda
Introduction
� Model driven development
� Pragmatic model driven development
� Our approach
� Benefite
Smart use cases
� Modeling smart use cases
� Smart use cases in code
4<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Smart use cases in code
Domain driven design
� Domain objects
� Smart references
� Value objects
Generating code
� Text templating
� Using Tobago MDA
Demo’s
5<TITLE>© Copyright Capgemini 2008 All Rights Reserved
An introduction
Model driven developmentModel driven development
Model driven developmentModel driven development
Why?
� Bridge gap between design and code
� Improve quality of delivered software
� Raise productivity
� Achieve platform and framework independency
� Increase testability
How?
� Proprietary techniques
SH
6<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Proprietary techniques
� DSL’s (textual and graphical)
� UML
� Database
� India
What?
� Modeling tool code generation
� Development tool code generation
� Intermediate code generation
7<TITLE>© Copyright Capgemini 2008 All Rights Reserved
To model driven development
A A pragmaticpragmatic approachapproach
Forms
Use cases
Domain
Software Architecture
TobagoMDA Frameworks
Specifications
Existing
Applications
Domain
Smartuse cases
User interface
specification1. Map your 1. Map your
business processes business processes
to smart use casesto smart use cases
1. Map your 1. Map your
business processes business processes
to smart use casesto smart use cases
4. Generate 4. Generate
code using a code using a
text template text template
engineengine
4. Generate 4. Generate
code using a code using a
text template text template
engineengine
5. Finalize your 5. Finalize your
applicationapplication
5. Finalize your 5. Finalize your
applicationapplication
8<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Domain
objects
Data / Serviceclasses
Databases
Test
scenario’s
Businessmodels
DomainModel
2. Create the 2. Create the
domain modeldomain model
2. Create the 2. Create the
domain modeldomain model3. Establish3. Establish
your software your software
architecture(s)architecture(s)
3. Establish3. Establish
your software your software
architecture(s)architecture(s)
9<TITLE>© Copyright Capgemini 2008 All Rights Reserved
What makes a use cases smart?
Smart use casesSmart use cases
Different levels of use casesDifferent levels of use cases
Cloud level
Kite level
High summary
Summary
MergeMerge
companiescompanies
MergeMerge
mortgage systemsmortgage systems
Place Place
10<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Sea level
Fish level
Clam level
User goal
Sub-function
Too low
SelectSelect
productproduct
InsertInsert
orderlineorderline
Place Place
orderorder
Different levels of use casesDifferent levels of use cases
‘Regular’ use cases
� Only user goal level use cases
� Use cases ‘as they are intended’
� A single use case describesa single elementary business process
� Differ in granularity too much
� Law of Large Numbers does not apply
Smart use cases
UnifiedVery
differentGranularity
VisualTextualFormat
Smart
use case
Regular
use case
11<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Smart use cases
� User goal and sub function level use cases
� Good unit of work and estimation
� A single elementary business process is modeledin a single use case diagram
� A single user goal level use case + auxiliary use cases at sub-function level
� Very similar granularity
NormalIncidentalRe-use
LikelyPossibleTraceability
in code
GoodLousyUnit of work
EasierHardEstimates
12<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Modeling smart use casesModeling smart use cases
Modeling smart use casesModeling smart use cases
Approach
� Create a use case diagram for each
elementary business process
� Model a (user goal level) use case that
maps to the elementary business process
� Name it after the elementary business
process
13<TITLE>© Copyright Capgemini 2008 All Rights Reserved
process
� Identify the actors executing the use case
� Identify the sub-function level use cases
� Model include and extend relationships
� Identify supporting actors
Identifying subIdentifying sub--function level use casesfunction level use cases
Guidelines
� Identify re-use
� Model one form per use case
� Model one use case per functional web
part
� Isolate unknown functionality
14<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Isolate unknown functionality
� Identify complex functionality
� Show extensive reporting
� Model complex calculations
� Isolate interaction with others
� Avoid low level (database) interaction
Modeling smart use casesModeling smart use cases
15<TITLE>© Copyright Capgemini 2008 All Rights Reserved
16<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Decorating the model
Smart use case stereotypesSmart use case stereotypes
Smart use case stereotypesSmart use case stereotypes
What?
� Classify model elements
� Do not add meaning to model
� Define custom stereotypes
Why?
� Speed up analysis and design
RM
17<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Speed up analysis and design
� Map design to software architecture
� Generate lots of code!
� Standarize functional testing
AddingAdding stereotypesstereotypes SH
18<TITLE>© Copyright Capgemini 2008 All Rights Reserved
AddingAdding stereotypesstereotypes
19<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Smart use case stereotypesSmart use case stereotypes
20<TITLE>© Copyright Capgemini 2008 All Rights Reserved
21<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Smart use cases and domain design
Mapping to software Mapping to software architecturearchitecture
Presentation
Process
Domain
Pages
UserControls
Panels
Use cases
Workflow
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
22<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Data / Services
Outside world
Enums / Value objects / Smart references
[Mapping]
Table Gateways
Queries
[Mapping]
Database
Presentation
Process
Domain
Pages
UserControls
Panels
Use cases
Workflow
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
23<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Exact SAP BizTalk Java
Data / Services
Outside world
Enums / Value objects / Smart references
[Mapping]
Service gateways
Service locators
[Mapping]
Services / ESB
Presentation
Process
Domain
Service contracts
Operation contracts
Data contracts
Use cases
Services
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
24<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Data / Services
Outside world
Enums / Value objects / Smart references
[Mapping]
Table Gateways / Service Gateways
Queries / Service Locators
[Mapping]
Database
Services / ESB
Exact SAP BizTalk Java
25<TITLE>© Copyright Capgemini 2008 All Rights Reserved
A brief introduction
Domain driven designDomain driven design
Domain driven designDomain driven design
Definition
� Base complex domain designs on the model
� Primary focus is on the domain and domain logic
In practice
� Model the domain
� Apply the extended domain driven vocabulary
� Build the domain layer
26<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Build the domain layer
� Hook in process layer
� Plug in data / services layer
Useful when
� The domain of your application is core
� Two tier is not (never?) desirable
� Application needs to function independent of back office, data sources or services
Domain driven designDomain driven design
Vocabulary
� Entity / Domain object
� Association
� Value object
� Aggregate
� Repository
27<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� Repository
� Factory
� Service
Additional vocabulary
� Enumeration
� Smart reference
Example Example –– Class diagramClass diagram
28<TITLE>© Copyright Capgemini 2008 All Rights Reserved
29<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Properties and property types
DefiningDefining classesclasses
Properties and property typesProperties and property types
Basic types
� string, integer, DateTime
� Include nullable wrapping
Enumerations
� Set up at design time, unchangeable at run-time
� Genders, Categories
Value objects
� No specific instances
RM
30<TITLE>© Copyright Capgemini 2008 All Rights Reserved
� No specific instances
� Isbn, Email, Url, Money
Smart references
� Changeable at run-time, such as ContractType
Associations
� Cached domain objects such as Country, Nationality
� First level citizens such as Customer, Product
31<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Value objectValue object
Value object Value object -- ImplementingImplementing
32<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Value object Value object –– In useIn use
33<TITLE>© Copyright Capgemini 2008 All Rights Reserved
34<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Smart referenceSmart reference
Smart reference Smart reference -- TableTable
35<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Smart Smart referencereference -- In In entityentity
36<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Smart reference Smart reference –– In useIn use
37<TITLE>© Copyright Capgemini 2008 All Rights Reserved
38<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Text templatingText templating
Model driven development Model driven development –– Template enginesTemplate engines
How?
� Define project
� Define patterns
� Import model
� Generate deliverable
� Finalize code
Additional features
SH
39<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Additional features
� Combine model elements
� Combine types of model elements
� Remember location
Changing the model withour losing code
� Partial classes
� Inherited classes
� Marking code
Tobago MDA Tobago MDA –– www.accelerateddeliveryplatform.comwww.accelerateddeliveryplatform.com
40<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Tobago MDATobago MDA
41<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Tobago MDATobago MDA
42<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Model driven development Model driven development -- Template enginesTemplate engines
Template engine Template engine knows (part of) knows (part of) the UML meta the UML meta
modelmodel
Template engine Template engine knows (part of) knows (part of) the UML meta the UML meta
modelmodel
Properties can Properties can be used in be used in templatestemplates
Properties can Properties can be used in be used in templatestemplates
RM
43<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Presentation
Process
Data / Services
Freemarker
Sitemesh
DisplayTag
Struts2
XWork Actions
EJB3 Services
EJB3 DataAccessObjects
Spring
44<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Outside world MySQL
Domain
JPA Domain objects
Enums
Value objects
Smart references
Spring
Model driven development Model driven development -- TemplatesTemplates
45<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Generate many things e.g. Table create scriptsGenerate many things e.g. Table create scripts
46<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Generate many things e.g. Table create scriptsGenerate many things e.g. Table create scripts
47<TITLE>© Copyright Capgemini 2008 All Rights Reserved
48<TITLE>© Copyright Capgemini 2008 All Rights Reserved
Demo!
Generating codeGenerating code
www.accelerateddeliveryplatform.comwww.accelerateddeliveryplatform.com SH
49<TITLE>© Copyright Capgemini 2008 All Rights Reserved
50<TITLE>© Copyright Capgemini 2008 All Rights Reserved
www.accelerateddeliveryplatform.com
Twitter: aahoogendoorn LinkedIn: aahoogendoorn rodym
References and questionsReferences and questions