08 Logical Architecture


Published on

Published in: Technology, Art & Photos
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

08 Logical Architecture

  1. 1. TK2023 Object-Oriented Software Engineering CHAPTER 8 LOGICAL ARCHITECTURE
  2. 2. INTRODUCTION <ul><li>We have transitioned from analysis-oriented work to software design. </li></ul><ul><li>Before going on to object design, we will first look at logical layered architecture and the related UML notation. </li></ul>
  3. 3. LOGICAL ARCHITECTURE AND LAYERS <ul><li>The logical architecture is the large-scale organization of the software classes into packages, subsystems, and layers. </li></ul><ul><li>A layer is a very coarse-grained grouping of classes, packages, or subsystems that has cohesive responsibility for a major aspect of the system. </li></ul>
  4. 4. EXAMPLE Domain UI Swing not the Java Swing libraries , but our GUI classes based on Swing Web Sales Payments Taxes Technical Services Persistence Logging RulesEngine HIGHER LAYERS LOWER LAYERS
  5. 5. <ul><li>Layers are organized such that &quot;higher&quot; layers call upon services of &quot;lower&quot; layers, but not normally vice versa. </li></ul><ul><li>Typical layers in an OO system include: </li></ul><ul><ul><li>User Interface (UI Layer) </li></ul></ul><ul><ul><li>Application Logic and Domain Objects </li></ul></ul><ul><ul><ul><li>contains software objects representing domain concepts that fulfill application requirements e.g. calculating a sale total </li></ul></ul></ul><ul><ul><li>Technical Services </li></ul></ul><ul><ul><ul><li>consists of general purpose objects and subsystems that provide supporting technical services e.g. interfacing with databases. </li></ul></ul></ul><ul><li>A logical architecture doesn't have to be layered but it's very common. </li></ul>
  6. 6. PACKAGE DIAGRAMS <ul><li>UML package diagrams are often used to illustrate the logical architecture of a system. </li></ul><ul><li>A layer can be modeled as a UML package. </li></ul><ul><li>In UML, a package can group anything: classes, other packages, use cases, etc. </li></ul>Technical Services Persistence Logging Sales
  7. 7. <ul><li>Dependency between packages can be shown using a dashed arrowed line. </li></ul>Domain UI Swing Web Sales Payments Taxes Technical Services Persistence Logging RulesEngine
  8. 8. GUIDELINE: DESIGN WITH LAYERS <ul><li>Organize the large-scale logical structure of a system into discrete layers of distinct, related responsibilities, with a clean, cohesive separation of concerns. &quot;Lower&quot; layers should be low-level and general services whereas the &quot;higher&quot; layers are more application specific. </li></ul><ul><li>Collaboration and coupling is from higher to lower layers; lower-to-higher layer coupling should be avoided. </li></ul>
  9. 9. <ul><li>Using layers helps address several problems: </li></ul><ul><ul><li>Source code changes ripple throughout the system </li></ul></ul><ul><ul><li>Application logic is tied to the user interface, making it difficult to be reused with a different interface. </li></ul></ul><ul><ul><li>Potentially general technical services or business logic is tied to application-specific logic, making it difficult to be reused or easily replaced with a different implementation. </li></ul></ul><ul><ul><li>There is high coupling across different areas of concern, making it difficult to divide the work along clear boundaries for different developers. </li></ul></ul>
  10. 10. GUIDELINE: COHESIVE RESPONSIBILITIES <ul><li>The responsibilities of the objects in a layer should be strongly related to each other and should not be mixed with responsibilities of other layers. </li></ul><ul><ul><li>For example, </li></ul></ul><ul><ul><li>UI objects should not do application logic. </li></ul></ul><ul><ul><li>Application logic classes should not trap UI events. </li></ul></ul>
  11. 11. DOMAIN OBJECTS AND THE DOMAIN LAYER <ul><li>How do we design application logic with objects? </li></ul><ul><li>The recommended approach is to create software objects with names and information similar to the real-world domain, and assign application logic responsibilities to them. </li></ul><ul><li>Such software objects are referred to as domain objects . </li></ul><ul><li>The application logic layer is sometimes referred to as the domain layer of the architecture as it contains domain objects to handle application logic work. </li></ul>
  12. 12. DOMAIN LAYER AND DOMAIN MODEL <ul><li>It is important to understand that the domain layer is part of the software whereas the domain model is part of analysis . </li></ul><ul><li>We refer to the domain model for inspiration for the names of classes in the domain layer. Doing this creates a lower representational gap between the real-world domain and our software design. </li></ul>
  13. 14. GUIDELINE: THE MODEL-VIEW SEPARATION PRINCIPLE <ul><li>What kind of visibility should other packages have to the UI layer? </li></ul><ul><li>The Model-View Separation principle: </li></ul><ul><ul><li>Do not connect or couple non-UI objects directly to UI objects. </li></ul></ul><ul><ul><li>Do not put application logic in the UI object methods. UI objects should only initialize UI elements, receive UI events, and delegate requests for application logic to non-UI objects . </li></ul></ul><ul><ul><li>Information and behaviour related to application logic should be encapsulated within the domain classes. </li></ul></ul>
  14. 15. <ul><li>Motivation for Model-View Separation includes: </li></ul><ul><ul><li>To allow separate development of the model (domain layer) and the user interface layer. </li></ul></ul><ul><ul><li>To minimize the impact of requirements changes in the interface upon the domain layer. </li></ul></ul><ul><ul><li>To allow multiple simultaneous views on the same model object. </li></ul></ul><ul><ul><li>To allow execution of the model layer independent of the user interface layer, such as in a batch-mode system. </li></ul></ul>
  15. 16. SSDs, SYSTEM OPERATIONS AND LAYERS <ul><li>An SSD shows the events generated by the actor/s on the system. It shows the system operations but it does not show the specific UI objects involved. </li></ul><ul><li>System operations involve application logic so they should not be operations of the UI layer. Thus, system operation requests should be forwarded by the UI layer to the domain layer for handling . </li></ul>