System Architecture Lecture 3 CSE 111 Spring 2010 6/22/20151Copyright William E. Howden.

Slides:



Advertisements
Similar presentations
1 CIS224 Software Projects: Software Engineering and Research Methods Lecture 9 Object, Package, Component and Deployment Diagrams (Based on Fowler, 2004,
Advertisements

Testing Object Oriented Programs CSE 111 4/28/20151.
Template, Command, Iterator and Composite CSE 111 5/9/20151Copyright W. Howden.
OOP Design Patterns Chapters Design Patterns The main idea behind design patterns is to extract the high level interactions between objects and.
March R McFadyen1 Architecture Architecture involves the set of significant decisions about the organization of a software system, decisions.
Copyright W. Howden1 Lecture 7: Functional and OO Design Descriptions.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Lecture 5a: Sequence Interaction Diagrams CSE 111 Copyright W. Howden1.
Copyright W. Howden1 Lecture 3: Elaboration and System Architecture.
Copyright W. Howden1 Lecture 6: Design Evaluation and Intro to OO Design Patterns.
Copyright W. Howden1 Lecture 8: O/O Programming. Copyright W. Howden2 Topics OO Programming Languages Developing programs from Designs –Class and method.
Copyright W. Howden1 Lecture 11: UML Terminology and Additional Models and Notation.
Copyright W. Howden1 Lecture 13: Programming by Contract.
1 Lecture 3: Elaboration and System Architecture.
CSE 111: Object Oriented Design. Design “To program is human but to design is divine” (WEH)
Copyright W. Howden1 Lecture 4: Sequence Interaction Diagrams.
Copyright W. Howden1 Lecture 19: Intro to O/O Components.
Copyright W. Howden1 Lecture 14: Callbacks, Singletons and Wrappers.
Copyright W. Howden1 Lecture 5: Collaboration Diagrams.
Lecture 5b: Basic Design Patterns CSE 111. Basic Design Patterns We know our subsystem interface classes and (some of) their methods We need to create.
1 Lecture 2: Elaboration Tasks and Domain Modeling.
Copyright W. Howden1 Lecture 15: Generalization, Polymorphism and States.
Copyright W. Howden1 Lecture 6: Collaboration Diagrams.
Copyright W. Howden1 Lecture 2: Elaboration Tasks and Domain Modeling.
Copyright W. Howden1 Lecture 12: State Chart Models.
Copyright W. Howden1 Lecture 4: Elaboration Tasks and Domain Modeling.
Lecture a: Additional UML Models: Package, Activity, Deployment Lecture b: Generalization, Aggregation and Additional Domain Model Notation Copyright W.
Object-Oriented Analysis and Design
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
Developed by Reneta Barneva, SUNY Fredonia Component Level Design.
Copyright W. Howden1 State Models and the State Pattern.
Lecture 7: UML Class Diagrams CSE 111 7/15/20151Copyright W. Howden.
March R McFadyen1 Figure 30.2 Layers in NextGen They only have three layers in this architecture Each layer is shown as a UML Package No separate.
Chapter 26 Applying Gang of Four Design Patterns 1CS6359 Fall 2012 John Cole.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
More OOP Design Patterns
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
The Design Discipline.
Chapter 13 Starting Design: Logical Architecture and UML Package Diagrams.
Systems Analysis and Design in a Changing World, Fifth Edition
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
4/2/03I-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Software Architecture and Design Readings: Ambler, Chap. 7 (Sections to start.
Design Patterns Part two. Structural Patterns Concerned with how classes and objects are composed to form larger structures Concerned with how classes.
(c) University of Washington08-1 CSC 143 Models and Views Reading: Ch. 18.
GoF Design Patterns (Ch. 26). GoF Design Patterns Adapter Factory Singleton Strategy Composite Façade Observer (Publish-Subscribe)
Software Architectural Styles Andrew Midwinter, Mark Mullen, Kevin Wong, Matt Jones 1.
Systems Analysis and Design in a Changing World, 3rd Edition
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many others 1.
An Introduction to Programming and Object Oriented Design using Java 3 rd Edition. Dec 2007 Jaime Niño Frederick Hosch Chapter 18 Integrating user interface.
Model View Controller MVC Web Software Architecture.
CS-1020 Dr. Mark L. Hornick 1 Event-Driven Programming.
Model View Controller (MVC) Bigger than a Pattern: It’s an Architecture Rick Mercer with help from many of others 1.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
1 CSE 331 Model/View Separation and Observer Pattern slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
Object Oriented Programming in Java Habib Rostami Lecture 10.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 10 Java Fundamentals Objects/ClassesMethods.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
CSC 205 Programming II Lecture 5 AWT - I.
Lecture 4: Elaboration Tasks and Domain Modeling
Structure of a web application
Figure 30.2 Layers in NextGen
Chapter 6 Methods: A Deeper Look
Lecture 4: Sequence Interaction Diagrams
Constructors, GUI’s(Using Swing) and ActionListner
Model, View, Controller design pattern
Chapter 15 Event-Driven Programming and Animations Part 1
CMSC 202 Exceptions.
Presentation transcript:

System Architecture Lecture 3 CSE 111 Spring /22/20151Copyright William E. Howden

System Architecture Identifies the basic parts of the system and their relationships – called: components, modules, subsystems Component interactions – called: send a message to, use Relationships – corresponds to: message being sent, data flow 6/22/2015Copyright William E. Howden2

Component Interfaces When a component is used a method is called in its interface class(es) Interface class may be a facade in the sense that it contains no or little logic Interface class(es) use other classes in the component to perform required action. Those classes may call on methods in the interfaces of other components 6/22/2015Copyright William E. Howden3

System Architecture Patterns/Metaphors General patterns that have found to be useful Sample architectures – Peer to peer – Central Server – Three-tier, based on model view separation and layers – Model View Controller 6/22/2015Copyright William E. Howden4

Peer to Peer 6/22/20155Copyright William E. Howden

Central Server 6/22/20156Copyright William E. Howden

Three-Tier 6/22/20157Copyright William E. Howden

Three-Tier Architecture Nomenclature View (Presentation Tier) DL (Business or Domain Logic, Logic Tier) DB (Data base, Data Tier) 6/22/2015Copyright William E. Howden8

General Design Patterns Used as Part of the Three-Tier Pattern Model-View Separation – View: GUI/Interface – Model: Business Logic/Domain Logic – Separation GUI classes in a separate component from Model GUI event handlers (Java Listeners) – are called when an event such as a button push occurs – they call methods in the Model to perform actions such as get date » may retreive information from model or change its state – shut down and open new screens/dialogs Why? – Management of intellectual complexity – Facilitates testing and changes. Can swap in a new GUI without changing model 6/22/20159Copyright William E. Howden

Three-Tier Design Patterns (cont) Layers design Each layer – is a kind of abstract machine defined using the layers below it – a layer can call on the layers below it but not the ones above it – originated in the THE operating system (Dijkstra) Why? – Facilitate management of intellectual complexity – Facilitates changes 6/22/201510Copyright William E. Howden

Copyright W. Howden11 Three-Tier Design Patterns (cont.) Callbacks – View call on model to get information to display – How does lower level Model component alert View that something needs displaying? – View calls a model method with an identifier for a method to be called when the condition of interest happens. Passed method is called a call back function. View is registering itself for the occurrence of a certain event. – Similar object oriented approaches using call back objects

Copyright W. Howden12 Callbacks in Java – Observer/Observable -1 Observer-observable is a callback pattern Java Classes with same names can be used to implement it Observers – register with observable, assumed to have an update() method Observable – when instructed, will call the observers’ update() method

Copyright W. Howden13 Observer/Observable -2 Observer is an interface – Class who wants to be called back by a lower layer class should implement it – requires an update(Observable obs, Object arg) Observable is a class – Class that will cause the call back to occur should subclass it – Includes methods and data structures used for implementing call backs addObserver(Observer obs) notifyObservers(Object arg)

Copyright W. Howden14 Sample Callback for DatingSystem Requirement: want domain/business logic layer of system to flash a warning on the screen if logged on member is a frequent dater, and then continue normally with logic for logging on Suppose we had a simple GUI interface class and a simple BL (business logic) Model class Use of observer/observable – GUI implements Observer => must implement an update() method. Have this method flash the warning when it is called – BL extends Observable, giving it an addObserver(Observer obs) and notifyObserverMethod()

Copyright W. Howden15 Use of the Callback Assume at start up the constructor for GUI is passed a reference to an instance of the BL GUI constructor calls BL.addObserver(this) to register itself as an observer of BL In the logOn logic in BL: if the special condition is recognized, notifyObservers() is called which causes the registered observers update() methods to be called, which causes the warning to flash

Caveat DS call back example here is contrived - created to illustrate a point Assume when logon occurs in GUI it calls a logon(m) method BL interface (class) logon() could be written to return warning value if member m is a frequent dater. GUI method that called logon() in the BL can display the warning directly, without the need for callbacks 6/22/2015Copyright William E. Howden16

Passive and Active Models and Callbacks A passive Model is updated by the actions of the by the View (or the Controller in MVC (see below)) – The View may call the model to acquire information – No need for callbacks to allow Model to initiate changes to state of View An active Model can be updated by external events not originating from the View (or the Controller in MVC) – View may need to be updated: this is where callbacks are really necessary 6/22/2015Copyright William E. Howden17

Model View Controller View similar to MV – Controller: handles all input events from user sends messages to Model that View would have sent in the MV updates View logic/state, when the update does not depend on Model state changes (e.g. causes next screen to be displayed) – View can still be registered with Model (for callbacks) Controller could also be registered

Model View with Callback

Model View Controller with Callback

Arguments for and against MVC (as opposed to simple MV) For – Controller delinks the view from the model separates the view logic from the view separates the model management from the view – Argument is that you could reuse the view with another model but would still have to change the controller Against Controller is an anachronism from the days when controllers had to perform complex view construction tasks, before complex graphical windowing was included in the OS

Copyright W. Howden22 UML and Components Components – Pieces of the system architecture – Layers, modules, logical tiers – May be nested subcomponents UML packages – Collections of classes and packages, using a special notation (example given later) – May be used for modeling components

Copyright W. Howden23 Subsystems Sometimes used synonymously with module or component, but sometimes more formally as: – “Package plus one or more interfaces that define the services supported by the subsystem” Subsystem interface class is not the same thing as Java Interface. Is simply the class through which the capabilities of the subsystem are used Name of a subsystem interface class may be the same as the name of the subsystem because it “stands for it”. E.g. in DS we have the DL (domain logic = business logic) interface class for the DL middle level component of the three-tier design

Copyright W. Howden24 Subsystems, Facades and Proxies Façade defintion – an interface object that is the single point of entry for the services of a subsystem - a common unified interface for a disparate set of implementations or interfaces Subsystem interface can be a façade which calls methods in an implemented subsystem Could also be a proxy which simulates a subsystem or which communicates with a remote implementation These patterns (façade and proxy) will be discussed later

Copyright W. Howden25 Implementing Subsystems/Components in Java Possible units of organization: – Files – Folders – Classes – Packages

Copyright W. Howden26 Files and Subsystems Files: units of compilation Compilation produces class files for each class in a file Too small a unit for organizing subsystems Class in one file has limited visibility (i.e ability to create an instance of) to classes in other files.

Copyright W. Howden27 Inner Classes and Subsystems Inner Class – Defined inside another class – Has access to variables of enclosing class Subsystems consist of a principal class (e.g. subsystem interface), and its inner classes Problems e.g. – Cannot have static members in inner classes – Cannot access inner classes from the outside

Copyright W. Howden28 Folders and Subsystems Associate subsystems with folders When class file is compiled, compiled class files will go into the same folder

Copyright W. Howden29 Packages Java Package is a collection of classes Package is associated with a folder Can use import statement in a file to identify a source of classes used in file Use package statement to identify a file as belonging to a package Use import to identify sources of referenced classes

Copyright W. Howden30 Packages and Subsystems We will use UML-Java packages for subsystems Assume package has interface classes for the subsystem

Copyright W. Howden31 Additional Packages In addition to our GUI, DL and DB subsystem packages, there are several other packages in the DS design – Globals E.g. MemberData in DS – Utility routines E.g. Classes used for tracing and debugging Will also have a special Start class

Copyright W. Howden32 Dating System Architecture

Copyright W. Howden33 Start Class Logic – creating the subsystems and linking them together