240 likes | 355 Views
Logical Architecture. http://flic.kr/p/7wicbp. What are you going to learn about today?. How to organize your code—that is, how to design a logical architecture How to diagram logical architectures How to apply analysis artifacts (Domain Model and SSDs) to software design.
E N D
Logical Architecture http://flic.kr/p/7wicbp
What are you goingto learn about today? • How to organize your code—that is, how to design a logical architecture • How to diagram logical architectures • How to apply analysis artifacts (Domain Model and SSDs) to software design http://flic.kr/p/8JpkTg
Recall: Iterative development process We are here http://en.wikipedia.org/wiki/File:Iterative_development_model_V2.jpg
Software architecture An architecture is the set of significant decisions about the organization of a software system, the selection of the structural elements and their interfaces by which the system is composed, together with their behavior as specified in the collaborations among those elements, the composition of these structural and behavioral elements into progressively larger subsystems, and the architectural style that guides this organization—these elements and their interfaces, their collaborations, and their composition. [Booch et al., 1999]
Logical Architecture • Defines packages within which software classes are defined • Large-scale organization • Logical because no decision about how to deploy across different OS process or physical computers
Example: Layered Architecture package package name nestedpackage dependency
UML package notation details: Namespaces • UML package provides namespace • Examples: • UI::Swing • UI::Web • More examples: • java::util::Date • java::lang::System Note: Java uses dots; e.g., java.lang.System
UML package notation details:Three ways to denote nesting :: :: ::
Layered Architecture • Common architectural style • Layer: • Coarse-grained grouping of classes, packages, subsystems • Has cohesive responsibility for a major aspect of system • Higher layers call upon lower layers • But not vice versa • Client/Supplier pattern • Lower layers more general, higher more app specific
CommonLayers User InterfaceLayer Application Logic Layer (aka Domain Layer) Technical Services Layer
Activity: Create a layered architecture for your team project • Create UML package diagram • Compare your current architecture to an ideal layered architecture • Pay attention to dependencies between packages! http://flic.kr/p/5dfuqL
Note: Larman focuses on the domain layerRationale: Other layers tend to depend heavily on a particular technology (e.g., .NET)
Benefits of Layered Architecture • Separates concerns • Complexity is contained • Some layers may be replaceable/reusable • Some layers may be distributed • Prevents changes from rippling through system • Changes bubble up? • Breaks up work for developers
More examples of common layers (cont’d next slide)
Mapping layers to Java code // UI LAYER com.mycompany.nextgen.ui.swing com.mycompany.nextgen.ui.web // DOMAIN LAYER com.mycompany.nextgen.domain.sales com.mycompany.nextgen.domain.payments // TECHNICAL SERVICES LAYER com.mycompany.service.persistence // Third-party packages org.apache.log4j org.apache.soap.rpc // FOUNDATION LAYER com.mycompany.util
What’s the relationship between theDomain Layer and the Domain Model?ORHow do we designapplication logic with objects? http://flic.kr/p/9ksxQa
Answer: Create software objects with names and info similar to the real-world domain DomainModel SoftwareClasses in theDomainLayer
Pitfall: Don’t mix architectural views! Worse! Better! No! Bad! Don’t show external resources as the bottom layer
Guideline: Model-View Separation Principle • Do not connect or couple non-UI objects directly to UI objects • Do not put application (domain) logic in UI methods Model View Separation http://flic.kr/p/7iRwYr http://flic.kr/p/4EW6q8
Why would it be bad to leta Sale software classhave a reference toa JFrame window object? http://flic.kr/p/9ksxQa
We’ve already discussed how theDomain Model influences designHow do think SSDs might influence design? http://flic.kr/p/9ksxQa
System operations in an SSD suggest operation calls on the Domain Layer from the UI Layer System operations …………….… inspire ………………… these operations
Summary • UML package diagrams • Layered architectures • Model-View Separation Principle • Domain Model suggests Domain Layer classes • System operations suggest Domain Layer operations http://flic.kr/p/YSY3X