第一章 软件架构是什么
软件架构应该...
asoftware architect that the system should be friendly and responsiveto the user, maintainable, free of critical errors,easy to install,reliable, that it should communicate in standard ways with othersystems, and that it, too, should be beautiful.
好的软件架构会...
Agood system architecture exhibits conceptual integrity; that is, itcomes equipped with a set
ofdesign rules that aid in reducing complexity and that can be used asguidance in detailed
designand in system verification.
理想的软件架构应该具备:
• Ithas the functionality required by the customer.
• Itis safely buildable on the required schedule.
• Itperforms adequately.
• Itis reliable.
• Itis usable and safe to use.
• Itis secure.
• Itis affordable.
• Itconforms to legal standards.
• Itwill outlast its predecessors and its competitors.
然而,
Architectureis a game of trade-offs—a decision that improves one of thesecharacteristics often
diminishesanother.
所以,
Thearchitect must determine what is sufficient to satisfy, bydiscovering the important concerns for a particular system and theconditions for satisfying them sufficiently.
Commonamong the notions of architecture is the idea of structures, eachdefined by
componentsof various sorts and their relations: how they fit together, invokeeach other,
communicate,synchronize, and otherwise interact.
Anarchitect prepares initial sketches of the building, showing bothexternal appearance and internal layout, and discusses these sketcheswith clients until all concerned have agreed that what is shown iswhat they want.
Weemploy an architect to assure that the design (1) meets the needs ofthe client, including
thecharacteristics previously noted; (2) has conceptual integrity byusing the same design rules
throughout;and (3) meets legal and safety requirements.
Ifarchitecture is concerned with the relationships among components andthe externally
visibleproperties of system components, then design will additionally beconcerned with the
internalstructure of those components.
Thefirst concern of a software architect is not the functionality of thesystem.
Qualityconcerns specify the way in which the functionality must be deliveredin order to be
acceptableto the system’s stakeholders, the people with a vested interest inthe outcome of the system.
Everysystem has its own set of quality concerns. Some, such asperformance, security, and
scalability,may be well-specified, but other, often equally important concerns,such as
changeability,maintainability, and usability, may not be defined with enough detailto be
useful.
FredBrooks said that conceptual integrity is the most important attributeof an architecture:
“Itis better to have a system...reflect one set of design ideas, than tohave one that contains
manygood but independent and uncoordinated ideas” (1995).
好的软件构架师会关注...
Functionality
Whatfunctionality does the product offer to its users?
Changeability
Whatchanges may be needed in the software in the future, and what changesare unlikely
andneed not be especially easy to make in the future?
Performance
Whatwill the performance of the product be?
Capacity
Howmany users will use the system simultaneously? How much data will thesystem need
tostore for its users?
Ecosystem
Whatinteractions will the system have with other systems in the ecosystemin which it
willbe deployed?
Modularity
Howis the task of writing the software organized into work assignments(modules),
particularlymodules that can be developed independently and that suit eachother’s needs
preciselyand easily?
Buildability
Howcan the software be built as a set of components that can beindependently
implementedand verified? What components should be reused from other productsand
whichshould be acquired from external suppliers?
Producibility
Ifthe product will exist in several variations, how can it be developedas a product line,
takingadvantage of the commonality among the versions, and what are thesteps by which
theproducts in the product line can be developed (Weiss and Lai 1999)?What investment
shouldbe made in creating a software product line? What is the expectedreturn from
creatingthe options to develop different members of the product line?
Inparticular, is it possible to develop the smallest minimally usefulproduct first and then
developadditional members of the product line by adding (and subtracting)components
withouthaving to change the code that was written previously?
Security
Ifthe product requires authorization for its use or must restrictaccess to data, how can
securityof data be ensured? How can “denial of service” and other attacksbe withstood?
架构的几种结构
TheInformation Hiding Structures
COMPONENTSAND RELATIONS : The primary components are Information HidingModules,
whereeach module is a work assignment for a group of developers, and eachmodule embodies
adesign decision.
Therelation between the modules is "part of".
Programsare "contained in" the modules.
InformationHiding Structures are the foundation of the object-oriented designparadigm.
CONCERNSSATISFIED : The Information Hiding Structures should be designedso that they satisfy changeability, modularity, and buildability.
TheUses Structures
TheUses Relation is sometimes known as “requires the presence of acorrect
versionof.”
Awell-defined Uses Structure will create proper subsets of the systemand can be used to drive
iterativeor incremental development cycles.
CONCERNSSATISFIED : Producibility andecosystem.
TheProcess Structures
COMPONENTSAND RELATION : The Information Hiding Module Structures and the Uses
Structuresare static structures that exist at design and code time. Processesare runtime sequences of events that are controlled by programs(Dijkstra 1968).
CONCERNSSATISFIED : Changeability.
AccessStructures
conditionthat if two segments are accessed by the same set of programs, thosetwo segments
shouldbe combined. The data access structure has two kinds of components,programs and
segments.This relation is entitled “has access to,” and is a relationbetween programs and
segments.A system is thought to be more secure if this structure minimizes theaccess rights
ofprograms and is tightly enforced.
CONCERNSSATISFIED : Security.
好的架构
Thereare two common approaches to architecture evaluation (Clements,Kazman, and Klein
2002).The first class of evaluation methods determines properties of thearchitecture, often by
modelingor simulation of one or more aspects of the system.The second, andbroadest, class of evaluation methods is based on questioning thearchitects to assess the architecture.
漂亮的架构
好的架构只是satisfythe functional and quality concerns of the system’s stakeholders.
Buildabilityof the architecture, Persistence
ConceptualIntegrity is a feature that cuts across all domains and thatalways delights.