CS432_Wk6_DesignPatterns_Slides.ppt

544 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
544
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

CS432_Wk6_DesignPatterns_Slides.ppt

  1. 1. CS 432 Object-Oriented Analysis and Design Week 6 Design Patterns Architecture Designs
  2. 3. Design Principles-Protection From Variations <ul><li>Parts of a system that are unlikely to change are segregated from those that will </li></ul><ul><li>Drives the multilayer design pattern </li></ul><ul><ul><li>Stable business logic can be protected from variations in the user interface </li></ul></ul><ul><ul><li>Changes in the business logic are isolated to the controller class </li></ul></ul>
  3. 4. Design Principles-Indirection <ul><li>Indirection is an implementation of the protection from variations principle </li></ul><ul><li>Decouples classes or other system components by placing an intermediate classes between them </li></ul><ul><li>Used in many corporate security systems between an internal network and the Internet </li></ul><ul><ul><li>A proxy server catches all incoming messages and redistributes them to the recipients </li></ul></ul>
  4. 5. Importance of Design Patterns <ul><li>Standard design templates can speed OO design </li></ul><ul><li>Patterns can exist at different levels of abstraction </li></ul><ul><ul><li>At the most concrete level, a class definition with code </li></ul></ul><ul><ul><li>At the most abstract level, an approach to a problem </li></ul></ul><ul><li>Patterns should contain five main elements </li></ul><ul><ul><li>Pattern name, problem, solution, example, benefits and consequences </li></ul></ul>
  5. 6. Pattern description for the controller pattern
  6. 7. Basic Design Patterns <ul><li>The authors of Elements of Reusable Object-Oriented Software (referred to as the Gang of Four) developed a basic classification scheme for patterns (Figure 9-7) </li></ul><ul><li>The 23 GoF patterns are some of the most fundamental and important patterns in use </li></ul><ul><li>Scores of other patterns have been defined </li></ul><ul><ul><li>For example, both Java and .NET have sets of enterprise patterns </li></ul></ul>
  7. 8. Classification of design patterns
  8. 9. Singleton Pattern <ul><li>For classes that must have only one instance, but need to be invoked from several classes and locations within the system </li></ul><ul><li>The class itself controls the creation of only one instance </li></ul><ul><ul><li>A static variable of the class refers to the object that is created </li></ul></ul><ul><ul><li>A class method instantiates the object on the first call, and returns a reference to the object on subsequent calls </li></ul></ul>
  9. 10. Singleton Pattern
  10. 11. Singleton pattern template
  11. 12. Adaptor Pattern <ul><li>Plugs an external class into a system </li></ul><ul><ul><li>Converts the method calls from within the system to match the method names in the external class </li></ul></ul><ul><li>A standard solution for protection from variations </li></ul><ul><ul><li>Insulates the system from frequently changing classes </li></ul></ul><ul><li>An interface is frequently used to specify and enforce the use of correct method names </li></ul>
  12. 13. Adapter Pattern
  13. 14. Adapter pattern template
  14. 15. Design Activities in the UP Life Cycle
  15. 16. Design the Support Services Architecture and Deployment Environment <ul><li>Three organizational dispositions to new systems </li></ul><ul><ul><li>Integrate new systems into existing systems </li></ul></ul><ul><ul><li>Install support services for the first time </li></ul></ul><ul><ul><li>Replace existing systems </li></ul></ul><ul><li>Design issues for all organizations </li></ul><ul><ul><li>Reliability </li></ul></ul><ul><ul><li>Security </li></ul></ul><ul><ul><li>Throughput </li></ul></ul><ul><ul><li>Synchronization </li></ul></ul>
  16. 17. Design the Software Architecture <ul><li>Software architecture refers to the “big picture” </li></ul><ul><li>Two important aspects </li></ul><ul><ul><li>Division of software into classes </li></ul></ul><ul><ul><li>Distribution of classes across processing locations </li></ul></ul><ul><li>Modify class diagrams into software classes </li></ul><ul><ul><li>Determine where classes and objects execute </li></ul></ul><ul><ul><li>Determine whether they will be distributed </li></ul></ul><ul><ul><li>Determine communication methods </li></ul></ul><ul><ul><li>Select programming language(s) to write classes </li></ul></ul>
  17. 18. Design Use Case Realizations <ul><li>Use case realizations offer a lower-level view </li></ul><ul><li>Two-tiered focus </li></ul><ul><ul><li>Class interactions supporting a particular use case </li></ul></ul><ul><ul><li>Interactions among software, users, and external systems </li></ul></ul><ul><li>Design typically spread over many iterations </li></ul><ul><li>UML design class diagrams and interaction diagrams document design </li></ul>
  18. 19. Design the Database <ul><li>Designing database as a key design activity </li></ul><ul><li>Physical model of database based on class diagram </li></ul><ul><li>Physical model describes relational or OO database </li></ul><ul><li>Some technical issues </li></ul><ul><ul><li>Performance, such as response time </li></ul></ul><ul><ul><li>Integration with existing databases </li></ul></ul><ul><ul><li>Legacy databases </li></ul></ul>
  19. 20. Design the System and User Interfaces <ul><li>System interface issues </li></ul><ul><ul><li>Different types of systems will interface </li></ul></ul><ul><ul><li>Systems interact with internal and external users </li></ul></ul><ul><li>User interface issues </li></ul><ul><ul><li>User capabilities and needs differ widely </li></ul></ul><ul><ul><li>User interacts with the system in different ways </li></ul></ul><ul><ul><li>Approaches to interface vary by system </li></ul></ul><ul><ul><li>Has nature of interface emerged from earlier models? </li></ul></ul>
  20. 21. Design the System Security and Controls <ul><li>User-interface controls limit access to authorized users </li></ul><ul><li>System interface controls protect system from other systems </li></ul><ul><li>Application controls record transactions and validate work </li></ul><ul><li>Database controls ensure data protected from unauthorized access and accidental loss </li></ul><ul><li>Network controls protect network communication </li></ul>
  21. 22. Design Activities and the UP <ul><li>Focus in early iterations of elaboration phase </li></ul><ul><ul><li>System architecture and databases </li></ul></ul><ul><li>Evenly distributed throughout project </li></ul><ul><ul><li>Detailed design activities </li></ul></ul><ul><li>Criteria analyst uses to schedule design activities </li></ul><ul><ul><li>Experience </li></ul></ul><ul><ul><li>Forecasting capabilities </li></ul></ul><ul><li>Every design impacts other parts of system </li></ul>
  22. 23. Single-Computer and Multitier Architecture <ul><li>Single-computer architecture </li></ul><ul><ul><li>Single system attached to peripheral devices </li></ul></ul><ul><ul><li>PC and mainframe applications qualify </li></ul></ul><ul><ul><li>Advantages: easy to design, build, operate, maintain </li></ul></ul><ul><ul><li>Disadvantages: capacity limits </li></ul></ul>
  23. 24. Single-computer, Clustered, and Multicomputer Architectures
  24. 25. Single-Computer and Multitier Architecture (continued) <ul><li>Multitier architecture (multiple computer systems) </li></ul><ul><ul><li>Clustered architecture </li></ul></ul><ul><ul><ul><li>Group of computers logically operate as one </li></ul></ul></ul><ul><ul><ul><li>Nodes from same manufacturer and model family </li></ul></ul></ul><ul><ul><li>Multicomputer architecture </li></ul></ul><ul><ul><ul><li>Cluster whose nodes are optimized or specialized </li></ul></ul></ul><ul><ul><ul><li>Hardware and operating systems may be dissimilar </li></ul></ul></ul>
  25. 26. Centralized and Distributed Architecture <ul><li>Centralized architecture </li></ul><ul><ul><li>Deploys computer systems in single location </li></ul></ul><ul><ul><li>Used for large-scale processing applications </li></ul></ul><ul><ul><li>Constraint: geography </li></ul></ul><ul><ul><li>Implements subsystems in larger information system </li></ul></ul><ul><li>Distributed architecture </li></ul><ul><ul><li>Software/data spread across systems and locations </li></ul></ul><ul><ul><li>Relies on communication networks to interconnect </li></ul></ul>
  26. 27. Client/Server Architecture <ul><li>Client/server architecture tiers </li></ul><ul><ul><li>Client: requests resources or services from a server </li></ul></ul><ul><ul><li>Server: manages information system resources </li></ul></ul><ul><li>Architectural issues for client/server software: </li></ul><ul><ul><li>Decomposing software into client and server programs (objects) </li></ul></ul><ul><ul><li>Determining where clients and servers will execute </li></ul></ul><ul><ul><li>Describing interconnection protocols and networks </li></ul></ul>
  27. 28. Client/Server Architecture with a Shared Database
  28. 29. Client/Server Architecture (continued) <ul><li>Client and server communicate via well-defined protocols over a physical network </li></ul><ul><li>Client/server architecture advantages </li></ul><ul><ul><li>Location flexibility, scalability, maintainability </li></ul></ul><ul><li>Client/server architecture disadvantages </li></ul><ul><ul><li>Additional complexity, potential poor performance, security issues, and reliability   </li></ul></ul>
  29. 30. Interaction Among Multiple Clients and a Single Server
  30. 31. Three-Layer Client/Server Architecture <ul><li>Variant of client/server architecture </li></ul><ul><ul><li>Divides application software into independent processes </li></ul></ul><ul><li>Three-layers </li></ul><ul><ul><li>The data layer </li></ul></ul><ul><ul><li>The business logic layer </li></ul></ul><ul><ul><li>The view (presentation) layer </li></ul></ul><ul><li>Three-tier architecture advantages </li></ul><ul><ul><li>Additional flexibility and reliability </li></ul></ul>
  31. 32. Three-Tier Logical Layers
  32. 33. Three-Tier Architecture
  33. 34. Four-Tier Architecture
  34. 35. Model-View-Controller (MVC) Design Pattern or Framework
  35. 36. Middleware <ul><li>Middleware </li></ul><ul><ul><li>Connects parts of an application </li></ul></ul><ul><ul><li>Enables requests and data to pass among them </li></ul></ul><ul><li>Common types of middleware </li></ul><ul><ul><li>Teleprocessing monitors </li></ul></ul><ul><ul><li>Transaction processing monitors </li></ul></ul><ul><ul><li>Object request brokers (ORBs) </li></ul></ul><ul><li>Each type of middleware has its own set of protocols </li></ul>
  36. 37. Differences between client/server and Internet systems
  37. 38. Web Client/Server Architecture
  38. 39. Internet and Web-Based Software Architecture <ul><li>Web is complex example of client/server architecture </li></ul><ul><ul><li>Web resources are managed by server processes </li></ul></ul><ul><ul><li>Clients are programs that send requests to servers </li></ul></ul><ul><ul><li>Web protocols define valid resource formats and communication standards </li></ul></ul><ul><ul><li>Web-like capabilities embedded in ordinary applications </li></ul></ul><ul><li>Web-oriented client/server architecture: service-oriented architecture (SOA)   </li></ul>
  39. 40. Internet and Web-Based Software Architecture (continued) <ul><li>Flexibility is the key to the Internet alternative </li></ul><ul><ul><li>Accessibility, low cost communication, widely used standards </li></ul></ul><ul><li>Disadvantages of Web technologies </li></ul><ul><ul><li>Security, reliability, throughput, and volatile standards </li></ul></ul><ul><li>The key architectural design issues </li></ul><ul><ul><li>Defining client and server processes or objects </li></ul></ul><ul><ul><li>Distributing processes across hardware platforms </li></ul></ul><ul><ul><li>Connecting processes </li></ul></ul>
  40. 41. Simple Internet Architecture <ul><li>Used for viewing static information </li></ul><ul><li>The browser component executes on the client computer </li></ul><ul><li>The Internet server component executes on the server computer </li></ul><ul><li>Pages reside on the server and are sent to the browser for display </li></ul><ul><li>Program logic is inserted through scripting languages (JavaScript, VBScript), applets, or other controls </li></ul>
  41. 42. Simple Internet architecture
  42. 43. Two-layer Architecture <ul><li>Primarily captures information from the user and updates the database </li></ul><ul><li>The domain layer and data access layer are usually combined </li></ul><ul><li>Input data is sent to a CGI or an application server </li></ul><ul><li>The user-interface classes often contain the business logic and data access </li></ul><ul><ul><li>Processing takes place with servlets (Java) or code behind classes (.NET) </li></ul></ul>
  43. 44. Two-layer Internet architecture
  44. 45. Three-layer Architecture <ul><li>Separates domain layer and data access layers </li></ul><ul><li>Necessary for systems with complex business logic or multiple user interfaces </li></ul><ul><li>Using CGI </li></ul><ul><ul><li>Provide a use case controller for each form that distributes messages to the individual objects of the system. </li></ul></ul><ul><li>Using an application server </li></ul><ul><ul><li>Java tools: Java Server Pages and servlets </li></ul></ul><ul><ul><li>.NET tools: Common Runtime Language and code behind classes </li></ul></ul>
  45. 46. Three-layer Internet architecture
  46. 47. Invoking a Web service
  47. 48. Designing Enterprise-level Systems <ul><li>Enterprise-level systems share components among multiple people or groups in an organization </li></ul><ul><li>Enterprise-level systems almost always use multiple tiers of computers </li></ul><ul><li>Can be client/server network-based or Internet based </li></ul><ul><li>Designed with deployment diagrams </li></ul><ul><ul><li>A type of implementation diagram that shows physical components across different locations </li></ul></ul>

×