Design Mechanisms

advertisement
Design Mechanisms
The path to successful projects
Lars Fredholm
MagicIT
Bio
 Lars Fredholm, System Enginer
 IBM, RSV, LANI, MSC, MagicIT AB
 C, Clipper, VO, SQL-Windows, VB/MTS, Java
 Rose Experience since 1993 (Rose 2.x)
Today:
 Rational OOAD/Rose Certified Instructor, MCP
 Consulting in Rational’s Tools
Architectural Mechanisms?
The Architect Mind
 What does it mean technically?
Architectural Mechanisms?
Technical functionality that is needed
GUI
Window
Navigatio
n
Persistency
Broker/
Transaction
Stateless/
State
Concurrency/
Distribution
Securit
y
Master/
Detail
Communicatio
n
Legacy
System/
Language/
Errors
Reportin
g
Device
s
Architectural Mechanisms
Three Categories
 Architectural Mechanism Categories
– Analysis Mechanisms (conceptual)
– Design Mechanisms (concrete)
– Implementation Mechanisms (actual)
 Exampel
– Persistence => Database => Sybase
Architectural Mechanisms
have Characteristics
 Persistency
– Granularity: 1 to 10 Kbytes per row
– Volume: up to 200000 rows
– Access frequency
•
•
•
•
Create: 500 per day
Read: 2,000 access per hour
Update: 1,000 per day
Delete: 50 per day
 Communication
– Synchronicity
– Message Size
– Protocol
Parts in RUP
regarding Design Mechanisms
 Inception / Early Elaboration
– Requirements (functional and supplementary)
– Build Technical Prototypes
– SAD, Software Architecture Document
 Elaboration
– Model Design Mechanisms
– Design Guidelines
– Use Case Realization
 Construction
– Code Templates
Inception Phase
Milestone: Can we do this project?
 Functional Requirements
– Use Case survey, System scope, Priority
 Non functional Requirements
– Technical Prototypes (prove concept)
 Candidate Architecture
– Architecture Mechanisms
 Project Plan
– Cost and schedule
Functional Requirements
Use Case Model Survey
 Gives Early Abstractions - Analysis Classes
Week
Project
Company
Use-Case Model
Employee
Map to Analysis Classes
Analysis Classes are early Classes
 Mapping Mechanisms and Analysis Classes
Analysis Class
Analysis Mechanism(s)
Week
Persistency, Security
Project
Persistency, Security
Employee
Persistency, Legacy Interface
Company
Persistency, Legacy Interface
ProjectController
Transaction
Non Functional Requirements
Supplementary Specifications
 GUI
 Devices
 Environment
 Storage
 Communication
 Performance
 Distribution
Supplementary
Specifications
Technical Prototypes
Technical prototypes proves the choice of
Architecture and reduces Risks early
 Validate Mechanism with Prototype
 If a Prototype doesnt exist, build it!
– GUI applet, graphical applet
– Report applet, scanner applet
– Database applet, transactions applet
– Object broker applet
– External system applet, import/export applet
– Stress applets
– Security applets
Candidate Architecture
Software Architecture Document
 Describes the Architecture by examples
 Shows Architecture significant examples of:
– Use Cases
– Realizations
– Class Diagrams
– Process Diagrams
– Component Diagrams
– Deployment Diagrams
– Data Model
SAD
Software Architecture Document
The Candidate Architecture
Elaboration Phase
Milestone: Have we managed all questions
regarding the Systems architecture?
 Design Mechanisms
– Design Patterns to Reuse
• Tested & proved technical Prototypes
– Design Guidelines
• Rules to follow when designing the System
 Use Case Realization
– Use Case Scenarios with Iteration and Class
Diagrams
Design Mechanisms
Design Mechanisms:
 Design Patterns
Design Pattern
Parameterized Collaboration of components that
solves a general design problem
 Iteration Diagrams
– Objects & Messages, Dynamic view
 VOPC (View of Participating Classes)
– Class Diagram, Static view
 Technical Prototype
– Code snippets
Design Mechanisms,
Design Pattern Styles
 Inheritance
– Use Structural behavior from Super Class
 Delegation
– Use build-in behavior from Subsystem
 Role Classes (templates)
– Reuse same behavior as modeled in Role Classes
Design Mechanisms,
Rose Design Model
Design Model
<<layer>>
User Services
Use Case
Realizations
<<layer>>
Business
Services
Design
Mechanisms
<<layer>>
Data Services
Design Mechanisms,
Package Overview
Design Mechanisms,
Technical Use Case Diagram
<<mechanism>>
Persistency
<<mechanism>>
Distribution
<<mechanism>>
Security
Mechanism Client
<<mechanism>>
Imaging
<<mechanism>>
Transaction
<<mechanism>>
GUI Navigation
Security Mechanism
by Inheritance
Security Mechanism,
Iteration Diagram
Get Permission
rights for
Resource:
3 * 5 binary bits
1=Select,
2=New,
3=Update,
4=Softdelete,
5=Harddelete
Check if
permission exist
Client
: Business
Object
: cls
Security
: cls
Session
1: ObjectPerm(String, clsSession)
2: ObjectPerm(String, clsSession)
3: ObjectPerm(String, PermissionType, RecordStatus)
4: Check Security Bit
Security Mechanism,
VOPC, View of Participating Classes
Security Mechanism,
Code Examples
'Check Permissions for resource
Public Function ChkRights(Session as clsSession, Resource as Object, Permission as Integer) As Boolean
On Error GoTo Catche
Dim strPerm as String
Try:
strPerm = Resource.ObjectPerm(Session)
Select Case Permission
Case 1 'Check VIEW permissions_ blnOk = Mid(strPerm,1,1)
Case 2 'Check NEW permissions _ blnOk = Mid(strPerm,2,1)
Case 3 'Check UPDATE permissions _ blnOk = Mid(strPerm,3,1)
Case 4 'Check DELETE permissions _ blnOk = Mid(strPerm,4,1)
Case Else _ blnOk=False
End Select
ChkRights=blnOk
Exit Function
Catche:
Err.Raise Err.number, Err.description, Err.source, Err.helpFile
End Function
Imaging Mechanism
by Delegation
Security Mechanism,
Iteration Diagram
subsystem :
ImageView
Client
1: ImageNew( )
2: ImageScan( )
3: ImageSaveAs( )
4: PageInsertScan( )
5: ImageSave(VT_BOOL)
Imaging Mechanism,
VOPC, View of Participating Classes
<<subsystem>>
ImageSevices
ImageView
Mechanism Client
(from User Services)
Imaging Mechanism,
Tech. Prototypes – Proved Concept
Transaction Mechanism
by Role Classes
Transaction Mechanism,
Iteration Diagram
5: Error Exception
1: Transaction
Atomic SQL
3: ObjectSave()
role :
Controller
role : Business
Object
Client
4: SetComplete( )
6: SetAbort( )
ObjectContext
6) Errors
ROLLBACK
2: GetObjectContext( )
global :
AppServer
Get Transaction
Server Control
ObjectContext
4) Successful
COMMIT
: Object
Context
Transaction Mechanism,
VOPC, View of Participating Classes
Transaction Mechanism,
Code snippets – Templates
'Operation on <<role>> Controller Class in Application Server
Public Function Transaction() As Boolean
On Error GoTo Catche
Dim objCtxObj As ObjectContext
Try:
'Get MTS context Object from Global AppServer
Set objCtxObj = GetObjectContext()
'Inform MTS of Transaction Completion
If Not objCtxObj Is Nothing Then objCtxObj.SetComplete
Exit Function
Catche:
'Inform MTS of Transaction Abortion
If Not objCtxObj Is Nothing Then objCtxObj.SetAbort
Err.Raise Err.number, Err.description, Err.source, Err.helpFile
End Function
Design Guidelines
Handbook for designers
The Communication Tool
Use Case Realization
Use-Case Model
Use Case
Design Model
Use-Case Realization
Realization Package:
 Iteration Diagrams
– Dynamic View
 VOPC (View of Participating Classes)
– Class Diagram - Static view
Realization,
Package Overview
Realization,
Use case Behavior distributed to classes
Preparera intäktsfil
(from Användningsfal l)
Interndebiterings
underlag
(from Användningsfal l)
<<realizes>>
<<realization>>
Åtgärd Skapa intäktsfel
<<realizes>>
<<realization>>
Registrera skada
Skapa kundfakturafil
(from Användningsfal l)
<<realizes>>
<<realization>>
Hantera skada
Use Case Realization,
Realization with Design Mechanisms
Receptionist
Receive Order
(from Användningsfal l)
(from Aktörer)
 Receptionist is a person working in the Reception
with Customers.
 Order is received from Customer by Receptionist.
The Paper is Scanned and Customer information
captured by the System.
Use Case Realization,
Realization with Design Mechanisms
 Enter New Order is a part of the
GUI Navigation Mechanism
Client
role :
DetailPage
1: PrinterPrint( )
3: ObjectNew( )
6: ObjectView( )
9: ObjectEdit( )
12: ObjectSave( )
15: ObjectDelete( )
18: RowNext( )
20: RowPrevious( )
22: WindowClose( )
5: ObjectNew( )
8: ObjectView(Long)
11: ObjectEdit(Long)
14: ObjectSave( )
17: ObjectDelete(Long)
interface :
iWindow
2: PrintForm
4: ObjectNew(Boolean, iWindow)
7: ObjectView(Boolean, iWindow)
10: ObjectEdit(Boolean, iWindow)
13: ObjectSave( )
16: ObjectDelete(iWindow)
19: NextRow( )
21: PreviousRow( )
23: Unload
role :
DetailPage
Use Case Realization,
Realization with Design Mechanisms
 GUI Navigation Mechanism
 Role Class PageDetail cloned to frmOrder
: frmOrder
: Receptionist
Mechanism
GUI Navigation
1: ObjectNew( )
Use Case Realization,
Realization with Design Mechanisms
 Imaging Mechanism
 No need to model deeper into Subsystem
 Already fully modeled in Mechanisms
: frmOrder
: ImageView
: Receptionist
Mechanism
GUI Navigation
1: ObjectNew( )
2: Scan
Mechanism
Imaging
3: ImageNew( )
Use Case Realization,
Realization with Design Mechanisms
 Persistency Mechanism - clone clsOrder
: frmOrder
: ImageView
: clsOrder
: Receptionist
Mechanism
GUI Navigation
1: ObjectNew( )
2: Scan
3: ImageNew( )
Mechanism
Imaging
4: Enter Data
Mechanism
Persistency
5: ObjectSave( )
6: ObjectNew(Recordset, clsSession, Long, String)
7: ObjectSave(Recordset, clsSession, Recordset, Boolean)
Use Case Realization,
Realization with Design Mechanisms
 All Mechanisms
frmOrder :
iWindow
: ImageView
: Order
Controller
: clsOrder
: Receptionist
Mechanism
GUI Navigation
1: ObjectNew( )
2: Scan
Mechanism
Imaging
3: ImageNew( )
4: (Enter Data)
5: ObjectSave( )
6: RetreiveOrder( )
Mechanism
Transaction
Mechanism
Security
Mechanism
Persistency /
Distribution
7: ObjectPerm(String, clsSession)
8: ObjectNew(Recordset, clsSession, Long, String)
9: WindowClose( )
Use Case Realization,
Long version
 Without Mechanisms – a long long version
frmOrder :
iWindow
: frmOrder
: ImageView
: Order
Controller
: clsOrder
: clsOrderList
: iMenu
: Receptionist
1: ObjectNew( )
2: Init(clsApplication, iWindow)
3: ObjectNew( )
4: MenuDetailNew( )
5: Scan
6: ImageNew( )
7: ImageScan( )
8: ImageSaveAs( )
9: (Enter Data)
10: ObjectSave( )
11: ObjectSave( )
12: Data( )
13: RetreiveOrder( )
14: ObjectPerm(String, clsSession)
15: ObjectNew(Recordset, clsSession, Long, String)
16: Fetch(Recordset, clsSession, Long, String)
17: ObjectSave(Recordset, clsSession, Recordset, Boolean)
18: Validate(Boolean, clsSession, Recordset, String, Variant)
19: WindowClose( )
20: MenuReset( )
Construction Phase
Milestone: Are we ready to install?
 Is it Good Quality code?
 Are executables Stable and Tested?
 Is System documented and mantainable?
 Will User receive high usability?
 Is it inside timeframe (TTM)?
Code Templates
Code snippets with variation points
 Design Mechanisms gives reusable
beaviour
 Resusable beaviour are code segments with
variation points (Roles)
 Copy boring repeating code
 Focus on essential programming tasks
 Reusable code already tested
 Code Templates could be written
Automation
Enhanced by Design Mechanisms
Code Automation:
 Rose Code Generation (Stubs)
 Copy & Paste programming
 Code Wizards
 Template Tools
 Rose Reversing Code (Round Trip)
Summary
Using Design mechanisms
 Inception
– Anaysis Mechanisms identifies risks early
 Elaboration
– Design Mechanisms reduces risks early
– Design Mechanisms accelerates modeling
 Construction
– Templates code reduces risks early
– Templates code accelerates coding
– Templates code increases quality of the code
Thank You!
Design Mechanisms
The Vehicle to successful projects
www.magicIT.com
Lars Fredholm
Download