Elaboration Iteration 3 – Part 3 - Persistence Framework -

Slides:



Advertisements
Similar presentations
Chapter 11 Component-Level Design
Advertisements

CSSE 374: Persistent Frameworks with GoF Design Patterns & Deployment Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812)
1 Layers Data from IBM-Rational and Craig Larman’s text integrated into these slides. These are great references… Slides from these sources have been modified.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
NJIT More GRASP Patterns Chapter 22 Applying UML and Patterns Craig Larman Prepared By: Krishnendu Banerjee.
Architectural Analysis & Design Architectural Layers The Logical Architecture is a large-scale organization of the software classes into packages (or namespaces),
Mar 20, R McFadyen1 Persistent Objects Persistent objects are objects that continue to exist after the application program terminates Persistence.
Reuse Activities Selecting Design Patterns and Components
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Chapter 25 More Design Patterns.
Client/Server Software Architectures Yonglei Tao.
CSSE 374: Even More Object Design with Gang of Four Design Patterns These slides derived from Shawn Bohner, Curt Clifton, and others involved in delivering.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
What is Architecture  Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project  In the.
GRASP Principles. How to Design Objects The hard step: moving from analysis to design How to do it? –Design principles (Larman: “patterns”) – an attempt.
GRASP Patterns Presented By Dr. Shazzad Hosain. Patterns A pattern describes a problem and solution, and given a name. Examples are Singleton, Adapter,
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Chapter 17. GRASP General Responsibility Assignment Software Patterns (Principles) OOD: after identifying requirements, create domain model, define responsiblities.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Chapter 17 GRASP: Designing Objects with Responsibilities. 1CS6359 Fall 2011 John Cole.
COMP 6471 Software Design Methodologies Winter 2006 Dr Greg Butler
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
Designing a Persistence Framework With Patterns
GRASP: Designing Objects with Responsibilities
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
Unit 4 Object-Oriented Design Patterns NameStudent Number CAI XIANGHT082182A KYAW THU LINHT082238Y LI PENGFEIHT082220L NAUNG NAUNG LATTHT082195L PLATHOTTAM.
OO Methodology Elaboration Iteration 3 – Part 2 Refining Models.
CS 4233 Review Feb February Review2 Outline  Previous Business – My.wpi.edu contains all grades to date for course – Review and contact.
Chapter 36 More Object Design with GoF Patterns 1CS6359 Fall 2011 John Cole.
08 - StructuralCSC4071 Structural Patterns concerned with how classes and objects are composed to form larger structures –Adapter interface converter Bridge.
Structural Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
OO Methodology Elaboration Iteration 2 - Design Patterns -
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Gang of Four Patterns 23 total 15 useful How are they different from GRASP Patterns?
OO Methodology Elaboration Iteration 3 – Part 1 Refining Models.
BEHAVIORAL PATTERNS 13-Sep-2012 Presenters Sanjeeb Kumar Nanda & Shankar Gogada.
Interface Patterns. Adapter Provides the interface a client expects, using the services of a class with a different interface Note Avoid using object.
Copyright © Craig Larman All Rights Reserved COMP-350 Object-Oriented Analysis and Design GRASP: Designing Objects with Responsibilities Reference:
OO Methodology Elaboration Phase Iteration 1- Part 3.
Proxy Pattern defined The Proxy Pattern provides a surrogate or placeholder for another object to control access to it by creating a representative object.
CS 210 Proxy Pattern Nov 16 th, RMI – A quick review A simple, easy to understand tutorial is located here:
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
GRASP: More Patterns for Assigning Responsibilities Presented By Dr. Shazzad Hosain.
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS. The Problem: Persistent Objects persistent object An object that can survive the process or thread that.
OO Methodology Elaboration Iteration 3 – Part 3 - More Design Patterns -
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Engineering 1. Analysis  Design 2 Characteristics of good design 3 The design must implement all of the explicit requirements contained in the.
OO Methodology Elaboration Phase Iteration 1- Part 2.
Elaboration: Iteration 2. Elaboration: Iteration 2 Basics Iteration 1 ends with : All the software has been tested: The idea in the UP is to do early,
Software Design Refinement Using Design Patterns
Conception OBJET GRASP Patterns
UML Deployment and Component Diagrams, Designing Persistence Framework with Patterns Software Design and Analysis CSCI 2040.
Apply Expert, Creator, Controller, Low Coupling, High Cohesion
Component-Level Design
Layers Data from IBM-Rational and Craig Larman’s text integrated into these slides. These are great references… Slides from these sources have been modified.
Frameworks And Patterns
Informatics 122 Software Design II
Object-Oriented Design
OBJECT ORIENTED ANALYSIS AND DESIGN
Informatics 122 Software Design II
Chapter 6: Architectural Design
Software Development Process Using UML Recap
Presentation transcript:

Elaboration Iteration 3 – Part 3 - Persistence Framework - OO Methodology Elaboration Iteration 3 – Part 3 - Persistence Framework -

Table of Contents Iteration 1 Iteration 2 Iteration 3 Use-Case Model Process Sale Use Case Domain Model Design Model Iteration 2 GRASP: More Patterns for Assigning Responsibilities Designing Use-Case Realizations with GoF Design Patterns Iteration 3 Related Use Cases Modeling Generalization Refining the Domain Model Adding New SSDs and Contracts Modeling Behavior in Statechart Diagrams Designing the Logical Architecture with Patterns Organizing the Design and Implementation Model Packages Introduction to Architectural Analysis and the SAD Designing More Use-Case Realization with Paterns Designing a Persistence Framework with Patterns

Iteration 3 Requirements Provide failover to local services when the remote services cannot be accessed. Provide support for POS device handling, such as the cash drawer and coin dispenser Handle credit payment authorization Support for persistent objects

Designing a Persistence Framework Objectives Design part of a framework with the Template Method, State, and Command patterns Introduce issues in object-relational(O-R) mapping Implement lazy materialization with Virtual Proxies Requirements the NextGen application requires storing and retrieving information in a persistent storage mechanism, such as relational database (e.g. ProductSpefication ) Persistent Objects objects that require persistent storage Solution a persistence service from a persistence framework a persistence framework is a general, reusable, and extendable set of types that provides functionality to support persistent objects Persistence service is usually written to work with RDB (O-R mapping service) In terms of the layered architecture, a persistence service is a subsystem within the technical service layer

Frameworks is a cohesive set of interfaces and classes that collaborate to provide services for the core, unvarying part of a logical subsystem contains concrete and abstract classes that define interfaces to conform to, object interactions to participate in, and other invariants usually requires the framework user to define subclasses of existing framework classes to make use of, customize, and extend the framework services relies on the Hollywood Principle – “don’t call us, we’ll call you”

Persistence Framework Requirements store and retrieve objects in a persistent storage mechanism commit and rollback transactions Key Ideas Mapping mapping between a class and its persistent store(table), and between object attributes and the fields in a record Object Identity To easily relate records to objects, and to ensure there are no inappropriate duplicates Database Mapper responsible for materialization and dematerialization Materialization and Dematerialization materialization is to transform a non-object representation into objects Caches Transaction State of Object the state of objects in terms of their relationship to the current transactions Transaction Operations commit, rollback Lazy Materialization materialized on demand Virtual Proxies lazy materialization can be implemented using a smart reference known as a virtual proxy

Representing Objects as Tables How to map an object to a record define a table in a RDB for each persistent object class object attributes containing primitive data types mat to columns UML Data Modeling Profile a coherent set of UML stereotypes, tagged values, and constraints for modeling RDB

Object Identifier Consistent way to relate objects to records OID Assign an object identifier(OID) to each record and object OID an alphanumeric value unique to a specific object within in objects, an OID is represented by OID interface or class, and in RDB OID is stored as a character string

Accessing Persistence Service Facade to Persistence Subsystem a unified interface to persistence subsystem DB Adapter collaborates with Persistence Facade

Mapping Objects: Database Mapper Who should be responsible for materialization and dematerialization of objects persistent object itself by Information Expert (direct mapping) strong coupling of the persistent object class to persistent storage knowledge using Database Mapper (indirect mapping) Database Mapper a different mapper class is defined for each persistent object class

Framework Design with Template Method Pattern define the skeleton of an algorithm in a method(template method), with some varying and unvarying parts, deffering some steps to subclasses. template method invokes other methods, some of which may be overridden in a subclass(hook method)

An Application of Template Method Painting in GUI Framework

Materialization with Template Method Skeleton algorithm for get method in AbstractMapper if (object in cache) return it else create the object from its representation in storage save object in cache

Materialization with Template Method Overriding the hook method

Materialization with Template Method getObjectFromStorage hook method is also a candidate template method

Persistence Framework

Configuring Mappers with a MapperFactory a solutin to get each mapper with a different operation within the Factory class MapperFactory { public IMapper getProduct SpecificationMapper() {...} public IMapper getsalemapper() { ... } ... } violate Protected Variations better solution using data-driven, factory assign a set of IMappers { public Map getAllMappers() { ... } class PersistenceFacade private java.util.Map mappers = MapperFactory.getInstance().getAllMappers(); public Object get(OID oid, class persistenceClass) IMapper mapper = (IMapper) mappers.get(persistenceclass); return mapper.get(oid);

Transaction States and the State Pattern persistent objects can be inserted, deleted, or modified operating on a persistent object does not cause an immediate database update, rather an explicit commit operation must be performed

Context for State Pattern Common technical services Repeating case logic structure public void commit() { switch (state) { case OLD_DIRTY: //... break; case OLD_CLEAN: ... } public void rollback()

State Pattern Context/Problem Solution An object’s behavior is dependent on its state, and its methods contain case logic reflecting conditional state-dependent actions. Solution Create state classes for each state, implementing a common interface. Delegate state-dependent operations from the context object to its current state object.

Applying State Pattern

Designing a Transaction with the Command Pattern Transaction is a set of tasks that must all complete successfully, or none must be completed. (atomic) the tasks of a transaction include inserting, updating, deleting objects. e.g. a transaction can contain two inserts, one update, and three deletes. Transaction is a good candidate class contains tasks tasks can be queued, and delayed for execution, reordered for performance, integrity, etc. Command Pattern Context/Problem How to handle requests or tasks that need functions such as sorting, queueing, delaying, logging, or undoing? Solution Make each task a class that implements a common interface Example GUI actions should be stacked and can be undoed server-side handles client requests by queueing, prioritizing, executing them

Designing a Transaction with the Command Pattern Commands for database operations

Lazy Materialization with a Virtual Proxy It is sometimes desirable to defer the materialization of an object until it absolutely required, for performance Virtual Proxy is a proxy for another object that materializes the real subject when it is first referenced is a lightweight object that stands for a real object