Академический Документы
Профессиональный Документы
Культура Документы
1
Objectives
z Introduce a logical architecture using
layers
z illustrate the logical architecture using
UML package diagrams
2
Introduction
z The design of a typical OO system is
based on several architectural layers,
such as a UI layer, an application logic
layer, and so forth.
z This chapter briefly explores a logical
layered architecture and related UML
notation
3
Sample UP Artifact Relationships
Domain
Business Model
Modeling *
*
Design Model
package diagrams
UI
of the logical
architecture
(a static view) Domain
Tech
Services
: Register : ProductCatalog
Register
ProductCatalog
class diagrams ... 1 1 ...
(a static view)
makeNewSale()
getProductSpec(...)
enterItem(...)
...
...
4
Figure 13.1 Sample UP artifact influence
Example
Figure 13.2 shows a partial layered, logical architecture drawn with
UML package diagram notation
UI
Domain
Technical Services
5
Figure 13.2 Layers shown with UML package diagram notation
What is the logical architecture?
z The logical architecture is the large-scale
organization of the software classes into package,
subsystems, and layers
z Called because there’s no decision about how these
elements are deployed across different operating system
processes or across physical computers in a network
z A layer is a very coarse-grained grouping of classes,
packages, or subsystems that has cohesive responsibility
for a major aspect of the system
z User interface
z Application logic
z Software objects representing domain concepts that fulfill
application requirements
z Technical services
z General purpose objects and subsystems that provide supporting
technical services, such as database or error logging
6
What is the logical architecture?
z Software Architecture: Definition
z 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 pregressively larger subsystems,
and the architectural style that guides this
organization-these elements and their interfaces,
their collaborations, and their composition
7
Applying UML: Package Diagrams
z UML package diagrams are often used to
illustrate the logical architecture of a system-
the layers, subsystems, packages, etc.
z A layer can be modeled as a UML package
z Ex: the UI layer modeled as a package named UI
z It is common to want to show dependency
between packages so that developers can see
the larger-scale coupling in the system.
z The UML dependency line is used for this, a
dashed arrowed line with the arrow pointing
towards the depended-on package
z The UML package represents a namespace so
that a Date class may be defined in two
packages
8
UI Domain
UI
UI::Swing UI::Web
Swing Web
Domain::Sales
Domain
Sales
dependency
window/page transitions Mediation, App Controller)
ٛ consolidation/transformation of disparate
data for presentation
11
Figure 13.4 Common layers in an information system logical architecture
Benefits of using Layers
z Separation of concerns z Mapping Code organization to
z Reduce coupling and layers and UML packages
dependencies, improve cohesion,
increase reuse potential, and
increase clarity // --- UI layer
com.mycompany.nextgen.ui.swing
z Related complexity is
com.mycompany.nextgen.ui.web
encapsulated and decomposable // --- Domain layer
z Some layers can be replaced with // packages specific to the NextGen project
new implementation com.mycompany.nextgen.domain.sales
z Lower layers contain reusable com.mycompany.nextgen.domain.payments
functions // --- Technical services layer
com.mycompany.service.persistence
z Some layers can be distributed
// --- Foundation layer
z Development by teams is aided // foundation packages that our team creates
because of the logical com.mycompany.util
segmentation
z A great use for a UML CASE tool is
to reverse-engineer the source code
and generate a package diagram
automatically
12
Definition
Domain layer: the layer that contains domain objects to handle
application logic work
UP Domain Model
Stakeholder's view of the noteworthy concepts in the domain.
Sale
A Payment in the Domain Model Payment 1
1 Pays-for
is a concept, but a Payment in date
the Design Model is a software amount
time
class. They are not the same
thing, but the former inspired the
inspires
naming and definition of the
objects
latter.
and
names in
This reduces the representational
gap.
Sale
This is one of the big ideas in Payment
object technology. 1 1 date: Date
Pays-for
amount: Money startTime: Time
Vertical Layers
Technical Services
Horizontal Partitions
15
Guideline: Don’t show external resources as the bottom layer
Worse Better
mixes logical and deployment views a logical view
a logical representation
Domain(s)
of the need for data or
services related to these
Domain(s)
POS Inventory subdomains, abstracting
implementation
decisions such as a
Technical database.
Services
Technical Services
첽omponentٛ
Novell
MySQL LDAP Foundation
Inventory
UML notation: A UML component, or replaceable, modular part of the physical system
18
UI
Swing makeNewSale()
:System enterItem()
: Cashier ProcessSale endSale()
...
Frame
makeNewSale()
: Cashier
enterItem(id, quantity)
makeNewSale()
description, total enterItem()
endSale()
Domain
endSale()
... Register
makeNewSale()
enterItem()
...
19
UI
Swing Text
not the Java
Swing libraries, but used in quick
ProcessSale ProcessSale experiments
Frame our GUI classes Console
based on Swing
Domain
Sales Pricing
ServiceAccess Payments
쳃nterfaceٛ
Services
CreditPayment ICreditAuthorization
Factory
ServiceAdapter
쳃nterfaceٛ 쳃nterfaceٛ
POSRuleEngineFacade
IInventoryAdapter ITaxCalculatorAdapter
Technical Services
Persistence A general
purpose third-
Log4J Jess SOAP
DBFacade party rules
engine.