Click here to load reader

SOEN 6011 Software Engineering Processes

  • View
    42

  • Download
    0

Embed Size (px)

DESCRIPTION

SOEN 6011 Software Engineering Processes. Section SS Fall 2007 Dr Greg Butler http://www.cs.concordia.ca/~gregb/home/soen6011-f2007.html. Week 7. Responsibility-Driven Design Layer Architecture Model-View-Control Fowler’s EAA Patterns Anatomy of a web site Controller, Command patterns - PowerPoint PPT Presentation

Text of SOEN 6011 Software Engineering Processes

  • SOEN 6011Software Engineering ProcessesSection SS Fall 2007Dr Greg Butlerhttp://www.cs.concordia.ca/~gregb/home/soen6011-f2007.html

  • Week 7Responsibility-Driven DesignLayer ArchitectureModel-View-ControlFowlers EAA PatternsAnatomy of a web siteController, Command patternsFront ControllerData Management patternsDomain and DataMapper

  • What is Design?Developing a blueprint (plan) for a mechanism that performs the required task,

    taking into account all the constraints, &

    making trade-offs between constraints when they are in conflict.

  • What is OO Analysis and DesignObject-Oriented Analysis

    Important domain concepts or objects?

    Vocabulary?

    Visualized in the UP Domain Model

    Object-Oriented Design

    Design of software objects

    ResponsibilitiesCollaborations

    Design patterns

    Visualized in the UP Design Model

  • Evolutionary DesignWhat is the probability that a S/W design will need to be updated?Change is inevitable, evolutionary design recognizes this.As software is changed, generally it becomes more complex unless effort is made to keep it simple.

  • Prerequisites to Successful Evolutionary Design?Testing lots of automated testing.Refactoring keeping the design simple.Continuous integration

    Actually, testing is a prerequisite to refactoring.

  • Responsibility-Driven Design (RDD)Detailed object design is usually done from the point of view of the metaphor of:Objects have responsibilitiesObjects collaborateResponsibilities are an abstraction.The responsibility for persistence.Large-grained responsibility.The responsibility for the sales tax calculation.More fine-grained responsibility.

  • Object ResponsibilitiesA responsibility is an obligation of an object in terms of its behavior.

  • General Classification of Kinds of Responsibility To know.To do.To decide.

  • Responsibilities A Boat MetaphorWhat kind of responsibilities do each of the following objects have: To know.To do.To decide.

  • Responsibilities A Boat MetaphorKind of responsibility for:CaptainTo know?To do?To decide?

  • Responsibilities A Boat MetaphorKind of responsibility for:Navigator.To know?To do?To decide?

  • Responsibilities A Boat MetaphorKind of responsibility for:Compass.To know?To do?To decide?

  • Important ConceptsModelAbstraction hiding (unimportant) detailsEg, cover of Larmans book

    GRASP Principlefor assigning responsibility

    Design patternSolution to design problem in contextEg, Command pattern

  • The 9 GRASP PrinciplesCreatorExpertControllerLow CouplingHigh CohesionPolymorphismPure FabricationIndirectionProtected Variations

  • Can you pick out a good design?What is a good design?Satisfies user needs.Is a simple as possible. Kent Beck:Runs all testsReveals intention.No duplication.Fewest number of classes or methods can you smell bad design choices?

  • Overview of Patterns

  • Layered Architectural StyleOur focus today:Architectural style: Layered.ReferencesLarman, Chapter 13.Fowler, EA.

    Briefly, lets review Client-Server

  • Layered Style CharacteristicsEach layer offers services to layers above.Hence, layers build upon each other to provide increased functionality.

  • Layering Pure StylePure style: components are permitted to use services of other components insame layer.layer immediately below.

  • Client-Server (Two-tiered System) most people see tier as implying a physical separation. Client-server systems are often described as two-tier systems [Fowler,p19]

  • Enterprise Application Layers

    id:Class

    Authorize payments

    Database

    Calculate taxes

  • Enterprise Application LayersPresentationDomain LogicData Source

  • Layering General SchemeLayersPresentation / Application.UI.Generally thin.(Term application can be misleading. It does not mean )Domain / Business Logic.Core system functionality.Technical Services.

  • General Layering Scheme RefinedPresentation

    Domain

    Technical servicesPresentationApplication

    Domain (logic)Low-level domain logic

    Technical servicesFoundation.

  • Typical Software Architecture Layers

    ClassName

    attributes

    operations

    xxx

    id:Class

    1: msg()

    1: msg()

    Cashier

    Note

    Note

    Note

    Class

    Text

    Records

    GUI windowsreportsspeech interfaceHTML, XML, XSLT, JSP, Javascript, ...

    handles presentation layer requestsworkflowsession statewindow/page transitionsconsolidation/transformation of disparate data for presentation

    handles application layer requestsimplementation of domain rulesdomain services (POS, Inventory)- services may be used by just one application, but there is also the possibility of multi-application services

    Technical Services(AKA Technical Infrastructure, High-level Technical Services)

    Foundation(AKA Core Services, Base Services,Low-level Technical Services/Infrastructure)

    (relatively) high-level technical services and frameworks Persistence, Security

    low-level technical services, utilities, and frameworksdata structures, threads, math, file, DB, and network I/O

    moreapp specific

    width implies range of applicability

    Business Infrastructure(AKA Low-level Business Services)

    dependency

    very general low-level business services used in many business domainsCurrencyConverter

    UI(AKA Presentation, View)

    Application(AKA Workflow, Process,Mediation, App Controller)

    Domain(AKA Business, Application Logic, Model)

  • Typical Software Architecture Layers (Simplified)

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Text

    Class

    newClass

    Class

    Note

    Records

    Technical Services

    Persistence

    Logging

    Swing

    Web

    RulesEngine

    Domain

    Sales

    Payments

    UI

    not the Java Swing libraries, but our GUI classes based on Swing

    Taxes

  • Layer Dependencies Example

    Technical Services

    Text

    Swing

    Log4J

    SOAP

    Domain

    Jess

    Presentation

    Persistence

    POSRuleEngine

    Inventory

    Payments

    ServiceAccess

    Pricing

    Sales

  • Domain Logic (Layer) also referred to as business logic. It involves calculations based on inputs and stored data, validation of any data that comes in from the presentation, and figuring out exactly what data source logic to dispatch [Fowler, p.20]

  • Logical Architecture Layers & Partitions

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Text

    Class

    Technical Services

    POS

    Inventory

    Logging

    Tax

    Vertical Layers

    Horizontal Partitions

    Persistence

    Domain

    Security

  • Fowlers EA PatternsDomainData SourceTransaction ScriptDomain ModelData MapperRow Data GatewayFront ControllerTemplate ViewTransform ViewPage ControllerPresentationActive RecordTable ModuleTable Data Gateway

  • Enterprise Applications PatternsAssignments (and some lectures) are about building web-based systems for enterprise applicationsInvolvePresentation on the webBusiness Logic and Business ObjectsData storage and access

    use book of Martin Fowler, Patterns of Enterprise Application Architecture

  • Design Model

    Class

    Cashier

    Class

    Records

    1..*

    (1)msg()

    output

    x: Class

    *

    1..40

    *

    1..40

    Records

    (1)msg()

    Cashier

    Buying Items

    DD file

    DD file

    Cashier

    Buying Items

    *

    ClassName

    attributes

    operations

    1

    Require-ments

    Business Modeling

    Design

    Design Model

    : Register

    enterItem(itemID, quantity)

    : ProductCatalog

    spec = getProductSpec( itemID )

    Register

    ...

    Sample UP Artifact Relationships

    Vision

    SupplementarySpecification

    Glossary

    The logical architecture is influenced by the constraints and non-functional requirements captured in the Supp. Spec.

    makeNewSale()enterItem(...)...

    Domain Model

    Use-Case Model

    ProductCatalog

    ...

    getProductSpec(...)...

    class diagrams(a static view)

    interaction diagrams(a dynamic view)

    UI

    package diagramsof the logical architecture(a static view)

    Domain

    Tech Services

  • Model-View Separation Principle (MVC)

    UI layer has viewsDomain layer has model

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Package

    Text

    Class

    newClass

    Class

    Note

    Records

    Technical Services

    Persistence

    Logging

    Swing

    Web

    RulesEngine

    Domain

    Sales

    Payments

    UI

    not the Java Swing libraries, but our GUI classes based on Swing

    Taxes

  • Model-View-Control Architecture (MVC)MVC is an acronym for Model View ControllerIt represents a software design pattern developed at Xerox PARC in 1978 (!)It explains a method of separating the visual, interaction and data components.Very popular, used extensively in Java and other languages

  • Model-View-Control Architecture (MVC)Modelmaintains the state and data of the application - the XML documentViewA rendering of the XML documentContr

Search related