CSSE 374: Persistent Frameworks with GoF Design Patterns & Deployment Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812) 877-8974

Slides:



Advertisements
Similar presentations
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Advertisements

UML State Machine Diagrams and Modeling
CSSE 374: Object-Oriented Design Exercise Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides and.
Design Patterns Section 7.1 (JIA’s) Section (till page 259) (JIA’s) Section 7.2.2(JIA’s) Section (JIA’s)
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
CSSE 374: Introduction to Object- Oriented Analysis and Design Q1 Steve Chenoweth Office: Moench Room F220 Phone: (812)
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Layered Architectures The objectives of this chapter are: To understand the principles and importance of Layered Architectures To explain the structure.
Spring 2010ACS-3913 Ron McFadyen1 Command The complex remote control (many pairs of buttons; null command) Undo … pages 216+ Macro … pages 224+
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Architectural Analysis & Design Architectural Layers The Logical Architecture is a large-scale organization of the software classes into packages (or namespaces),
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
Mar 20, R McFadyen1 Persistent Objects Persistent objects are objects that continue to exist after the application program terminates Persistence.
Software Engineering I Object-Oriented Design Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Command Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Reuse Activities Selecting Design Patterns and Components
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
CSSE 374: More GRASP’ing and Use Case Realization Steve Chenoweth Office: Moench Room F220 Phone: (812) These.
Data Access Patterns. Motivation Most software systems require persistent data (i.e. data that persists between program executions). In general, distributing.
CSSE 374: Domain Model Refinements and Iteration 3 Preparations Q1 These slides and others derived from Shawn Bohner, Curt Clifton, Alex Lo, and others.
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.
CSSE 374: Interaction Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides and others derived.
Object Oriented Software Development
Guide to Oracle10G1 Using SQL Queries to Insert, Update, Delete, and View Data Chapter 3.
Behavioral Patterns  Behavioral patterns are patterns whose purpose is to facilitate the work of algorithmic calculations and communication between classes.
CSSE 374: Final Perspectives on Software Architecture and Design These slides derived from Shawn Bohner, Curt Clifton, Alex Lo, and others involved in.
ASP.NET Programming with C# and SQL Server First Edition
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.
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
CSSE 374: More Object Design with Gang of Four Design Patterns Steve Chenoweth Office: Moench Room F220 Phone: (812)
CSSE 374: Introduction to Gang of Four Design Patterns
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
CSSE 374: 3½ Gang of Four Design Patterns These slides derived from Steve Chenoweth, Shawn Bohner, Curt Clifton, and others involved in delivering 374.
CS480 Computer Science Seminar Introduction to Microsoft Solutions Framework (MSF)
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Architecture: Component and Deployment Diagrams Patrick Bailey Keith Vander Linden Calvin College.
Chapter 26 GoF Design Patterns. The Adapter Design Pattern.
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 27. Review UML dynamic view – State Diagrams.
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
CSSE 374: More GRASP’ing for Object Responsibilities
Designing a Persistence Framework With Patterns
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Nov 20, R McFadyen1 Persistent Objects Key ideas/definitions UML representations Mapping patterns Transactional states Example Some commercial.
Database Design Some of these slides are derived from IBM/Rational slides from courses on UML and object-oriented design and analysis. Copyright to the.
Elaboration Iteration 3 – Part 3 - Persistence Framework -
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Data Access with Spring.
A Guide to SQL, Eighth Edition Chapter Six Updating Data.
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS. The Problem: Persistent Objects persistent object An object that can survive the process or thread that.
Behavioural Patterns GoF pg Iterator GoF pg. 257 – 271 Memento GoF pg By: Dan Sibbernsen.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 6: Restaurant.
OO Methodology Elaboration Iteration 3 – Part 3 - More Design Patterns -
The State Design Pattern A behavioral design pattern. Shivraj Persaud
CSSE 374: UML Activity Diagrams
Software Design Refinement Using Design Patterns
Architecture Patterns Design Patterns
Instructor: Dr. Hany H. Ammar
UML Deployment and Component Diagrams, Designing Persistence Framework with Patterns Software Design and Analysis CSCI 2040.
CSSE 374: Domain Model Refinements and Iteration 3 Preparations
Doug Jeffries CS490 Design Patterns May 1, 2003
Frameworks And Patterns
Updating Databases With Open SQL
INHERITANCE.
Updating Databases With Open SQL
Presentation transcript:

CSSE 374: Persistent Frameworks with GoF Design Patterns & Deployment Diagrams Steve Chenoweth Office: Moench Room F220 Phone: (812) These slides derived from Shawn Bohner, Curt Clifton, and others involved in delivering 374.

Learning Outcomes: Patterns, Tradeoffs Identify criteria for the design of a software system and select patterns, create frameworks, and partition software to satisfy the inherent trade-offs. Using GoF Patterns in Iteration 3  Finish up Template Pattern  State Pattern  Command Pattern Deployment Diagrams Q3

Persistence Framework – a service to provide object to record mapping In a Persistence Framework a record is to an object, as a _________ is to a graphical object in a GUI Framework.  Think for 15 seconds…  Turn to a neighbor and discuss it for a minute

Recall: A Persistence Framework Domain LayerPersistence Framework Relational Database Name City RHIT Terre Haute Purdue W. Lafayette Indiana U. Bloomington Butler U. Indianapolis University Table :University name = Butler city = Indianapolis University object PersistenceFaçade get(OID, class):Object put(OID, object) Retrieve from RDB get(OID, University) Store object in RDB put(OID, Butler U.) Use Objects (Pretend to) Store as Objects (Really) Store as Relations

Recall: Maps between Persistent Object & Database University Table :University name = Butler city = Indianapolis oid = xyz123 OID name city XI001 RHIT Terre Haute wxx246 PurdueW. Lafayette xxz357 Indiana U.Bloomington xyz123 Butler U.Indianapolis 1

Recall: Façade Design Pattern w/Brokers PersistenceFacade getInstance( ): PersistenceFacade get(OID, class) : Object put(OID, Object) ProductSpecification RDBMapper get(OID):Object put(OID, Object) > DBMapper get(OID):Object put(OID, Object class ProductSpecification FlatFileMapper get(OID):Object put(OID, Object Manufacturer RDBMapper get(OID):Object put(OID, Object Each mapper gets and puts objects in its own unique way, depending on the kind of data store and format.

Recall: Template Method Pattern Problem: How can we record the basic outline of an algorithm in a framework (or other) class, while allowing extensions to vary the specific behavior? Solution: Create a template method for the algorithm that calls (often abstract) helper methods for the steps. Subclasses can override/implement these helper methods to vary the behavior.

Recall Example: Template Method used for Swing GUI Framework GUIComponent update( ) paint( ) framework class Template Method Hook Method rogrammer’s Class Programmer’s Class MyButton paint( ) Hook method overridden to supply class specific detail // unvarying part of algorithm public void update { clearBackground( ); clearBackground( ); //call the hook method //call the hook method paint( ); paint( );} // unvarying part of algorithm public void update { clearBackground( ); clearBackground( ); //call the hook method //call the hook method paint( ); paint( );}

Sacrificing Quality for Quantity… It’s a bit like all you can eat fast food!

Template Method in NexGen POS 1/2 > DBMapper get(OID):Object put(OID):Object Abstract PersistenceMapper +get(OID):Object {leaf} #getObjectFromStorage( ):Object template method hook method {abstract} Q1

Template Method in NexGen POS 2/2 ProductDescription RDBMapper # getObjectFromStorage(OID):Object AbstractPersistenceMapper + get(OID):Object {concrete} # getObjectFromStorage(OID):Object {abstract} DBMapper //template method public final Object get(OID oid) { obj = cachedObjects.get(oid); if (obj == null) { //hook method obj = getObjectFromStorage(oid); cachedObject.put(oid, obj); } return obj; } //hook method override protected Object getObjectFromStorage(OID oid) { String key = oid.toString( ); dbRec = SQL execution result of “Select* from PROD_DESC where key =“ +key ProductDescription = new ProductDescription(); pd.setPrice(dbRec.getColumn(“PRICE”); …etc

Persistence Framework NextGen PersistencePersistence PersistenceFacade class Abstract RDBMapper > DBMapper Abstract PersistenceMapper 1 ProductDescription RDBMapper ProductDescription FileWithXMLMapper ProductDescription InMemoryTestDataMapper SaleRDBMapper

Transactional States & the State Pattern New [new (not from DB)] Old Clean OldDeleteDeleted [from DB] save delete rollback / reload commit / insert commit / delete delete rollback / reload commit / update OldDirty Database transactions need: -insert, delete, modify -Delayed updates /Explicit Commits (rollback) Database transactions need: -insert, delete, modify -Delayed updates /Explicit Commits (rollback)

State Pattern Problem: When the behavior of an object, obj, changes depending on its state, how can we avoid complicated conditional statements? Solution: Create state classes implementing a common interface. Delegate state-dependent methods from obj to the current state object. Q2,3

Example: State Pattern in TCP TCPConnection Open( ) Close( ) Acknowledgement( ) TCPState Open( ) Close( ) Acknowledgement( ) TCPEstablished Open( ) Close( ) Acknowledgement( ) TCPListen Open( ) Close( ) Acknowledgement( ) TCPClosed Open( ) Close( ) Acknowledgement( ) state  open( )

State Pattern in Persistence Framework state  commit( this ); PersistentObject commit( ) delete( ) Rollback( ) save( ) setState(PObjectState) oid: OID state: PObjectState PObjectState commit (PersistentObject obj); delete (PersistentObject obj); rollback (PersistentObject obj); save (PersistentObject obj); OldDirty State commit( …) delete(…) rollback(…) OldClean State delete(…) save (…) New State commit( …) * 1Q4

Your project and persistence What values are you storing in your system? Where are these being stored? What would happen if you actually tried to store “objects” as these are used in your program? Most famous example of persistence? Salvador Dali’s “limp watches” painting, officially called “Persistence of Memory.”

A 2 nd Cartoon of the Day Used by permission.

Command Pattern Problem: When we need to record operations so we can undo them, or execute them later, what should we do? Solution: Define a Command interface that represents all possible operations. Create subclasses of it for each kind of operation and instances for each actual operation. Q5,6

Uses for the Command Pattern Undo/redo Prioritizing and Queuing operations Composing multi-part operations Progress bars Macro recording Q7

Command Pattern in NextGen POS 21

Command pattern in your system Got any commands you need to save, like in a linked list?  May need to undo later?  May need to turn them into a script?  May want to see them “reenacted” in some model?

Deployment Diagrams Recall two key Architectural views:  Logical Architecture  Deployment Architecture Deployment Diagrams provide the means to express how the physical components of the system are organized

Outer boxes represent machines Lines represent communication Nested boxes show “execution environment nodes” Can label with protocols Software artifact

Deployment Diagrams On the board, draw a deployment diagram of your project system, as it will run. Explain what equipment issues could relate to your plan for deployment. Deployment diagram for a system combining in-house and 3 rd party software. From /Article/27899/0/page/3. /Article/27899/0/page/3