20101007 how smart use cases drive web development
-
Upload
sander-hoogendoorn -
Category
Technology
-
view
5.271 -
download
2
description
Transcript of 20101007 how smart use cases drive web development
![Page 1: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/1.jpg)
Sander HoogendoornPrincipal Technology Officer
Capgemini
HOW SMART USE CASES DRIVE WEB DEVELOPMENT
![Page 2: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/2.jpg)
2HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Capgemini
� Principal technology officer
� Global agile thought leader
� Chief architect Accelerated Delivery Platform (ADP)
Other
� Author books and +200 articles in international magazines
� Appreciated speaker at +80 international conferences
� Microsoft Partner Advisory Council .NET
� Capping IT Off Blog
� Columns in Software Release Magazine, SDN Magazine
� Editorial boards Software Release Magazine, TiTM
� Advisory board @Portunity
Web
� www.sanderhoogendoorn.com
� www.smartusecase.com
� Twitter / LinkedIn : aahoogendoorn
SANDER HOOGENDOORN
![Page 3: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/3.jpg)
3HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGENDA
Comparing requirements
techniques
Modeling
smart use cases
Smart use case driven
software architecture
Introducing
the task pattern
Generating code
from smart use cases
Unit testing
smart use cases
![Page 4: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/4.jpg)
4HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGENDA
Comparing requirements
techniques
Modeling
smart use cases
Smart use case driven
software architecture
Introducing
the task pattern
Generating code
from smart use cases
Unit testing
smart use cases
![Page 5: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/5.jpg)
User stories, huge cases and smart use cases
REQUIREMENT TECHNIQUES COMPARED
![Page 6: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/6.jpg)
6HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
USER STORIES – APPLES AND PEARS
Often too unstructured
Unsuitable in complex
environments
![Page 7: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/7.jpg)
7HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
COMPLEX IT LANDSCAPES
![Page 8: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/8.jpg)
8HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
HUGE CASES Hard to build,
impossible to test
![Page 9: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/9.jpg)
9HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
DIFFERENT LEVELS OF USE CASES
Cloud level
Kite level
Sea level
Fish level
Clam level
High summary
Summary
User goal
Sub-function
Too low
Products
Selling products
Search
book
Insert
orderline
Sell book
![Page 10: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/10.jpg)
10HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
DIFFERENT LEVELS OF USE CASES
![Page 11: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/11.jpg)
11HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Traditional
use cases
Smart
use cases
Format Textual Visual
Granularity Different Unified
Estimate Hard Easy
Unit of work Lousy Good
Reuse Incidental Normal
Traceability Possible Normal
Testability Poor Good
Traditional 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
� 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
DIFFERENT LEVELS OF USE CASES
![Page 12: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/12.jpg)
12HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGENDA
Comparing requirements
techniques
Modeling
smart use cases
Smart use case driven
software architecture
Introducing
the task pattern
Generating code
from smart use cases
Unit testing
smart use cases
![Page 13: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/13.jpg)
A YAGNI approach to requirements
SMART USE CASES
![Page 14: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/14.jpg)
14HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
In traditional software development
� Analysis and design is done upfront
� Development only starts after all design is complete and perfect
Consequences
� No room for new or changing insights
� Possibly unnecessary work
Therefore
� Eliminate waste
� Maximize the amount of work not done
� Postpone work until you really need it
Benefits
� No unnecessary analysis and design work
� Allows for new and changing insights
� No handover, immediate feedback
YAGNI. YOU AIN’T GONNA NEED IT
![Page 15: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/15.jpg)
15HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGILE REQUIREMENTS - APPROACH
D
E
F
SmartUse Cases
A
Project
Scope
D
Use Cases
A
B C
Hierarchical
Processes
B
D
D
Hierarchical
Processes
Chronological
Processes
Cloud Level Kite Level Sea Level Fish Level
C
![Page 16: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/16.jpg)
16HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
CLOUD LEVEL
![Page 17: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/17.jpg)
17HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
KITE LEVEL
![Page 18: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/18.jpg)
18HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Guidelines
� Identify re-use
� Model one form per use case
� Model one use case per web part
� Isolate unknown or complex functionality
� Model complex calculations
� Identify reports and analysis
� Isolate interaction with others
� Model services in service orientation
� Avoid low level interaction
(database, technical services)
IDENTIFYING SUB-FUNCTION LEVEL USE CASES
![Page 19: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/19.jpg)
19HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MODELING SMART USE CASES
![Page 20: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/20.jpg)
20HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MODELING SMART USE CASES – SEA AND FISH LEVEL
![Page 21: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/21.jpg)
21HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
DESCRIBING USE CASES – SEA AND FISH LEVEL
![Page 22: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/22.jpg)
Stereotypes
SMART USE CASES
![Page 23: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/23.jpg)
23HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Stereotypes in UML
� Marking model items gives explicit meaning to
the model
� Predefined stereotypes
� Custom definable stereotypes
Smart use case stereotypes
� Standardize analysis and design
� “This is a master-detail on product and order”
� “This service on customer is an aggregate”
� “We need a file import for handling the XMI”
� Facilitate easy estimation
� Commoditize realization of smart use case
� Facilitate easier (and automated) testing
SMART USE CASE STEREOTYPES
![Page 24: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/24.jpg)
24HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGENDA
Comparing requirements
techniques
Modeling
smart use cases
Smart use case driven
software architecture
Introducing
the task pattern
Generating code
from smart use cases
Unit testing
smart use cases
![Page 25: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/25.jpg)
An overview
SMART USE CASE DRIVEN ARCHITECTURE
![Page 26: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/26.jpg)
26HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Database consumer
� Domain oriented
� Data provided by database(s)
� But often database independent
Service consumer
� Domain oriented
� Data provided by service or middleware
� But protocol independent (SOAP or REST?)
Service provider
� Service oriented
� Data provided by contacts
� But domain oriented using data contracts
USING REFERENCE ARCHITECTURES
![Page 27: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/27.jpg)
27HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Presentation
Process
Domain
Data / Services
Outside world
Pages
UserControls
Panels
Use cases
Workflow
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
[Mapping]
Table Gateways
Queries
[Mapping]
Database
![Page 28: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/28.jpg)
28HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Exact SAP BizTalk Java
Presentation
Process
Domain
Data / Services
Outside world
Pages
UserControls
Panels
Use cases
Workflow
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
[Mapping]
Service gateways
Service locators
[Mapping]
Services / ESB
![Page 29: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/29.jpg)
29HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Presentation
Process
Domain
Data / Services
Outside world
Service contracts
Operation contracts
Data contracts
Use cases
Services
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
[Mapping]
Table Gateways / Service Gateways
Queries / Service Locators
[Mapping]
Database
Services / ESB
Exact SAP BizTalk Java
![Page 30: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/30.jpg)
30HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
ARCHITECTURE IN CODE
Web
� Pages, controls
Process
� Use cases / Tasks / Flow
Domain
� Factories / Repositories
� Domain Objects / Business rules
� Enums / Value Objects / References
� Search Objects
Data / Services
� Gateways
� Mappings / Describers
Database
![Page 31: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/31.jpg)
31HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGENDA
Comparing requirements
techniques
Modeling
smart use cases
Smart use case driven
software architecture
Introducing
the task pattern
Generating code
from smart use cases
Unit testing
smart use cases
![Page 32: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/32.jpg)
Introducing the Task Pattern
SMART USE CASE DRIVEN ARCHITECTURE
![Page 33: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/33.jpg)
33HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Presentation
Process
Domain
Data / Services
Outside world
Pages
UserControls
Panels
Use cases
Workflow
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
[Mapping]
Table Gateways
Queries
[Mapping]
Database
![Page 34: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/34.jpg)
34HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Smart use cases
� Act as primary unit of work
� Model process and work flow
� Make traceable in code
� Interact with presentation and domain layers
� Create layer supertype (task)
� Create classes for individual smart use cases
Why?
� Create traceability
� Facilitate reuse
� Implement model view controller
� Facilitate easier functional testing
� Cheapen application maintenance
SMART USE CASES IN CODE
![Page 35: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/35.jpg)
35HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
SMART USE CASES IN CODE
![Page 36: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/36.jpg)
36HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Command pattern – Definition
� Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations
Task pattern – Definition
� Encapsulate a smart use case as an object, thereby letting you parameterize it from different requests.
In practice
� Implement smart use cases independently
� Define a navigation mechanism
� Use smart use cases independently
� Allows for reuse of your smart use cases!
Useful when
� Always ☺
� Create a task manager!
TASK PATTERN
![Page 37: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/37.jpg)
37HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN
![Page 38: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/38.jpg)
38HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN IN PRACTICE
![Page 39: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/39.jpg)
39HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN IN PRACTICE – RUNNING A USE CASE
![Page 40: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/40.jpg)
40HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN
![Page 41: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/41.jpg)
41HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN – START FIRST USE CASE
![Page 42: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/42.jpg)
42HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN – START SECOND USE CASE
![Page 43: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/43.jpg)
43HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN – WEB PAGE WITH SECOND USE CASE
![Page 44: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/44.jpg)
44HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN – POST CONDITIONS SECOND USE CASE
![Page 45: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/45.jpg)
45HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN – CONTINUE FIRST USE CASE
![Page 46: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/46.jpg)
46HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN – WEB PAGE WITH FIRST USE CASE
![Page 47: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/47.jpg)
47HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TASK PATTERN – POST CONDITIONS FIRST USE CASE
![Page 48: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/48.jpg)
Task management with the Manager-Provider Pattern
SMART USE CASE DRIVEN ARCHITECTURE
![Page 49: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/49.jpg)
49HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Definition
� Create a simple static facade (manager) for a
(set of) interfaced implementations (providers)
In practice
� Manager holds one or a collection of providers
� Provider implement a particular interface
� Manager has methods to call methods from
interface
� At run-time, using dependency injection, actual
providers are injected
MANAGER-PROVIDER PATTERN
![Page 50: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/50.jpg)
50HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MANAGER – VALIDATIONMANAGER
![Page 51: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/51.jpg)
51HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
INTERFACE
![Page 52: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/52.jpg)
52HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MANAGER – INITIALIZATION (USING DEPENDENCY INJECTION)
![Page 53: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/53.jpg)
53HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
CONFIGURATION OF IMPLEMENTATION
![Page 54: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/54.jpg)
54HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MANAGER - EXECUTING METHODS
![Page 55: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/55.jpg)
55HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
CLIENT – CALLING METHODS
![Page 56: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/56.jpg)
56HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Useful when
� Generic services need to be called, which may have different implementations
� Manager prevents having to loop through each of a list of providers
� Flexibility to add or remove providers without changing application code
� Providers differ e.g. in development code, test code or deployed code
Use for
� Task Management
� View Management
� Binding and Persisting
� Resource Management
� State Management
� Logging
� Datasource interaction
� Testing!
MANAGER-PROVIDER PATTERN
![Page 57: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/57.jpg)
57HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGENDA
Comparing requirements
techniques
Modeling
smart use cases
Smart use case driven
software architecture
Introducing
the task pattern
Generating code
from smart use cases
Unit testing
smart use cases
![Page 58: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/58.jpg)
An introduction to pragmatic model driven development
GENERATING CODE FROM SMART USE CASES
![Page 59: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/59.jpg)
59HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Forms
Use cases
Domain
objects
Data / Serviceclasses
Databases
Software Architecture
TobagoMDA
Test
scenario’s
Frameworks
Specifications
Existing
Applications
Businessmodels
DomainModel
Smartuse cases
User interface
specification1. Map your
business processes
to smart use cases
1. Map your
business processes
to smart use cases
2. Set up your
domain model
2. Set up your
domain model3. Establish
your software
architecture(s)
3. Establish
your software
architecture(s)
4. Generate
your code using
a text template
engine
4. Generate
your code using
a text template
engine
5. Finalize your
application
5. Finalize your
application
![Page 60: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/60.jpg)
60HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Characteristics
� Load UML model (expressed in XMI)
� Load templates (from flat files)
� Combine elements from UML model with templates to generate deliverables
Templates
� Templates contains code that runs in template engine
� Templates might use a folder model
Generation process
� Ability to generate all or individual UML model elements
� Which UML model elements are supported?
� Generated deliverables can be code but also any other document type
MODEL DRIVEN DEVELOPMENT – TEMPLATE ENGINES
![Page 61: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/61.jpg)
61HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MODEL DRIVEN DEVELOPMENT - TEMPLATE ENGINES
Template engine knows (part of) the UML meta
model
Template engine knows (part of) the UML meta
model
Properties can be used in templates
Properties can be used in templates
![Page 62: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/62.jpg)
62HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MODEL DRIVEN DEVELOPMENT - TEMPLATES
![Page 63: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/63.jpg)
63HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
GENERATE MANY THINGS E.G. TABLE CREATE SCRIPTS
![Page 64: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/64.jpg)
A quick example
GENERATING CODE
![Page 65: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/65.jpg)
65HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
A SIMPLE SMART USE CASE MODEL
uc Manage Customer
Site Administrator
(from A ctors)
«master detail»
Manage Customer
«search»
Select Customer
«define»
Define Contact
«extend»
«incl ude»
![Page 66: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/66.jpg)
66HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
A SIMPLE DOMAIN MODEL
class Budapest.Business
«business class»
Cust omer
+ Name: string
+ Address: string
+ Postcode: Postcode
+ City: string
+ Country: SmartRef
+ Website: Url [0..1]
«business class»
Contact
+ Name: string
+ Email: Email [0..1]
+ Phone: PhoneNumber [0..1]
+ Department: Departments
«enumeration»
Depart ments
Sal es
Purchasing
Helpdesk
Management
*
![Page 67: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/67.jpg)
67HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
USING TOBAGO MDA
![Page 68: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/68.jpg)
68HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
GENERATED CODE IN ASP.NET
![Page 69: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/69.jpg)
69HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
GENERATED CODE IN SILVERLIGHT
![Page 70: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/70.jpg)
70HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
AGENDA
Comparing requirements
techniques
Modeling
smart use cases
Smart use case driven
software architecture
Introducing
the task pattern
Generating code
from smart use cases
Unit testing
smart use cases
![Page 71: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/71.jpg)
Unit testing at the right level
UNIT TESTING SMART USE CASES
![Page 72: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/72.jpg)
72HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Presentation
Process
Domain
Data / Services
Outside world
Pages
UserControls
Panels
Use cases
Workflow
Domain objects / Entities
Factories / Repositories
Enums / Value objects / Smart references
[Mapping]
Table Gateways
Queries
[Mapping]
Database
![Page 73: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/73.jpg)
73HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
UNIT TESTING SMART USE CASES
Unit test what?
� Methods from the task pattern
� Methods that are called from presentation
� Methods that collaborate with other use cases
� Methods that interact with domain
How?
� Create unit test for each smart use case
� Run methods from smart use case
� Validate outcome (using asserts)
Why?
� Great code coverage
� Regressions testing on smart use cases
� Code generation makes light work
![Page 74: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/74.jpg)
74HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
UNIT TESTING SMART USE CASES
Test methods from Task Pattern
Run method
Validate outcome
![Page 75: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/75.jpg)
75HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
UNIT TESTING SMART USE CASES
Test methods that interact with domain
Set up (in)valid domain object
Run method from use case
Validate outcome
![Page 76: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/76.jpg)
Introducing a light weight smart use case unit testing framework
UNIT TESTING SMART USE CASES
![Page 77: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/77.jpg)
77HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Test environment
� Create test manager (using manager-provider)
� Mock actual use case environment
� Log events from environment to test manager
� Asserts by querying test manager
Task management
� (Possibly) avoid other task getting started
View management
� Don’t request actual web pages or forms
� Method calls from web pages are tested
Domain
� Handle actual validation, saves, removes
� Make sure business rules validate
Validation
� Validate, but handle by logging
A LIGHTWEIGHT SMART USE CASE UNIT TESTING FRAMEWORK
![Page 78: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/78.jpg)
78HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
CONFIGURING TEST ENVIRONMENT
![Page 79: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/79.jpg)
79HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TEST MANAGER – LOGGING EVENTS
![Page 80: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/80.jpg)
80HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
MOCKING ENVIRONMENT – LOGGING EVENTS
![Page 81: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/81.jpg)
81HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TEST MANAGER – QUERYING EVENTS
![Page 82: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/82.jpg)
82HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
TEST MANAGER – RUNNING TESTS
Test methods that interact with domain
Set up (in)valid domain object
Run method from use case
Validate outcome
![Page 83: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/83.jpg)
TAKEAWAYS
![Page 84: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/84.jpg)
84HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Smart use cases
� Solid unit of work in agile projects
� Easy estimation
� Identifying functional re-use early in projects
� Guarantee front-to-back traceability
� Great unit for (automated) testing
� Apply stereotypes for even more
standardization
� Use a REAL modeling tool
Software architecture
� Provide separate smart use cases layer
� Handles process, interaction and work flow
� Controller ++
TAKEAWAYS
![Page 85: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/85.jpg)
85HOW SMART USE CASES DRIVE WEB DEVELOPMENT©2010 Capgemini. All Rights Reserved
Coding
� Implement task pattern
� Implement task management
� Modeling provides for model driven
development
Testing
� Smart use cases allow for automated testing
� Great code coverage on all layers
� Mock actual task environment
� Run tests automated in nightly builds
TAKEAWAYS
![Page 86: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/86.jpg)
www.accelerateddeliveryplatform.com
WWW.SMARTUSECASE.COM
![Page 87: 20101007 how smart use cases drive web development](https://reader033.fdocuments.net/reader033/viewer/2022060109/555611d2d8b42ae0238b4c1e/html5/thumbnails/87.jpg)
www.sanderhoogendoorn.com
www.smartusecase.com
@aahoogendoorn
REFERENCES AND QUESTIONS