Domain Architecture

Document Sample
Domain Architecture Powered By Docstoc
					Domain UI Architecture


     WSEP 06
     Elaborations 1  2  3  4…
              Discipline          Artifact      Elaboration 1          Elaboration 2
                                                 (3-4 Weeks)            (3-4 Weeks)
           Requirements    Use-Case Model      Near the end of       Near the end of
                                             this iteration host        this iteration
                                                         a 2-day         host a 2-day
                                                  requirements         requirements
                                                     workshop.            workshop.

Project                                          Obtain insight
                                                 and feedback
                                                       from the
                                                                      Obtain insight
                                                                      and feedback
                                                                             from the

Roadmap                                        implementation
                                                     work, then
                                             complete 30% of
                                                                    implementation
                                                                          work, then
                                                                      complete 50%
(p 96)                                             use cases in      of use cases in
                                                          detail.               detail.
                 Design      Design Model        Design for a                  repeat
                                             small set of high
                                                           risk
                                               architecturally
                                                   significant
                                               requirements.
          Implementation    Implementation   Implement these.         Repeat. 5% of
                                                                    the final system
                                                                              is built.
                Project              SW        Estimate starts         A little better
            Management       Development       to take shape.
                                    Plan
Logical Architecture

   Large scale organization of the software
    classes into packages, subsystems and
    Layers.
   Tiers, Layers, and Partitions:
       Tier  physical processing node (e.g. client
        computer)
       Layers  represent vertical slices
       Partitions  horizontal division (Packaging)
Package Organization
GuideLines

   Based on functional cohesion – types
    (classes and interfaces) are grouped
    together that are strongly related in terms of
    their participation in a common purpose,
    service, collaboration, policy and function.
   Strong internal coupling / weaker extra-
    cluster coupling: relational cohesion
       RC = Number of internal relations /
              Number of types
Layering
   A group of classes, packages, or
    subsystems that has cohesive responsibility
    for a major aspect of a system.
   “Higher” layers call upon services of “lower”
    layers.
   Typical layers in OO system:
       User Interface
       Application login and domain objects
       Technical services
The Model-View Separation
principle

   Do not couple non-UI objects directly
    to UI objects (e.g. TS  JFrame
    window object).
   Do not put application logic (e.g. Tax
    calculation) in the UI object methods.
    e.g.
    Mouse click event  UI  delegated to domain objects
The Model-View Separation
principle - Motivation
   Cohesive model definition the focus on domain
    processes
   Separate development of the domain and user
    interface layers
   Minimize impact of requirements changes in the
    interface upon the domain layer
   Allow new views to be easily connected to an
    existing domain layer
   To allow multiple simultaneous views on the same
    model object (tabular, chart etc.)
   Easy porting of the model layer to another user
    interface framework (swing  web etc.)
       N-tier architecture
           Interface
           Application Login
           Storage


     Interface                  Interface                   Interface
     Application Login          Application Login
     Storage                                                 Application Login
                                 Storage
    1 Tier (Standalone)                                       Storage
                                2 Tier (Client-Server)
                                                             3 Tier (Enterprise)
Patterns that support connecting
between the layers and packages


   Facade
   MVC
   Observer
Facade
provides a single, simplified interface to the more general facilities of a
    subsystem

   Facade
        knows which subsystem classes are responsible for a request.
        delegates client requests to appropriate subsystem objects.

   subsystem classes
        implement subsystem functionality.
        handle work assigned by the Facade object.
        have no knowledge of the facade; that is, they keep no
         references to it.
Facade

   The facade object doesn’t do the work.
    It is just a consolidator to the
    underlying subsystem objects.
   The facade should mot normally
    expose many low level operations.
Session Facade

   As system grows to handle many use-
    cases, an application layer is
    introduced.
   The application layer contains objects,
    namely session facades, that maintain
    session state for the operation of a use
    case.
Session Facade/Use Case
Handler
Technologies:                 AddTS
•Pojo
•Servlet
•Session Bean                SubscribeToTS

   Application Layer

        ProcessAddTS            ProcessSubscribeToTS
        SessionFacade              SessionFacade



    Domain Layer

                                             <<facade>>
                        TS                       Dito
          Signal
                               Portfolio
MVC (or ETP - Entity Task
Presenter)

   Split user interface interaction into
    three distinct roles:
       Model i.e. domain object (e.g. TS).
       View i.e. UI object (e.g. TSWindow)
       Controller i.e. session facade (e.g.
        servlet)                         <<View>>
                                        TSwindow

                          <<Controller>>
                         ProcessAddTS

                                             <<Model>>
                                           TradingSystem
MVC
     UI Layer


                     TSWindow


 Application Layer


                         getData
      ProcessAddTS                  ProcessSubscribeToTS
      SessionFacade                    SessionFacade



  Domain Layer

                                               <<facade>>
                       TS                          Dito
        Signal
                                   Portfolio
Scenario
  Actor                                        ProcessAddTS :
                       1: start task           SessionFacade


             AddTSWindow :
                 View
                                  2: display
      3: enter name

      4: enter owner
                                  5: create TS(name,owner)
                                                                  TS :
                                                             TradingSystem
                                                       6: create(name,owner)
                                                            7:
                           8: display confirmation
Observer

   Motivation:
       The GUI window should refresh its
        display of the TS total when the total
        changes
       Solution(?): The TS object will send a
        message to the window to refresh its
        display
Observer                                                  {
                                                          propertyListeners.add(lis);
                                                          }

                TradingSystem
                                                          {
addPropertyListener(lis : PropertyListener)               for each PropertyListener pl in propertylisteners
publishPropertyEvent(name, value)                                   pl.onPropertyEvent(this,name,value);
setTotal(Money)                                           }

                                                          {
                                                          total = Money;
  PropertyListeners                                       publishPropertyEvent("TS.total",total);
                            *                             }
                   <<Interface>>
                PropertyListener
                                                    javax.swing.JFrame
    onPropertyEvent(source, name, value)



                                                                  {
                                                                  if(name.equals("TS.total")
                                                                    totalField.setText(value);
                                   TSWindow                       ...
                                                                  }
                   onPropertyEvent(source, name, value)
                   initialize(TradingSystem)                      {
                                                                  TradingSystem.addPropertyListener(this);
                                                                  ...
                                                                  }
Observer
      UI Layer


                      TSWindow


  Application Layer


                          Publish (observer)
       ProcessAddTS                             ProcessSubscribeToTS
       SessionFacade                               SessionFacade



   Domain Layer

                                                           <<facade>>
                        TS                                     Dito
         Signal
                                               Portfolio
Conclusions

   Internal architecture  packages
   External architecture  3 layers: Domain,
    Application, UI
   Domain  UI – observer
   UI  Domain – ok
   Use case flow  controller (session facade)
   Access to modules / layers  facade
   Data layer ? …