Software Architecture “Good software architecture makes the rest of the project easy.” Steve...
-
Upload
augusta-lester -
Category
Documents
-
view
223 -
download
3
Transcript of Software Architecture “Good software architecture makes the rest of the project easy.” Steve...
![Page 1: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/1.jpg)
Software Architecture
“Good software architecture makes the rest of the project easy.”
Steve McConnell, Survival Guide
“There are two ways of constructing a software design:one way is to make it so simple that there are obviously no deficiencies;the other is to make it so complicated that there areno obvious deficiencies.”
C.A.R. Hoare (1985)
![Page 2: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/2.jpg)
The basic problem
Requirements Requirements
Code Code
?????
How do you bridge the gapbetween requirementsand code?
![Page 3: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/3.jpg)
One answer
Requirements Requirements
Code Code
A miracle happens!
![Page 4: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/4.jpg)
A better answer
Requirements Requirements
Code Code
Software Architecture
Provide a high level framework to build and evolve the system
![Page 5: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/5.jpg)
Box-and-arrow diagramsVery common, hugely valuable.But, what does a box represent? an arrow? a layer?
adjacent boxes?SW architecture gives these meaning
![Page 6: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/6.jpg)
An architecture is expressed bycomponents and connectors
• Components define the basic computations comprising the system, and their behaviors– abstract data types, filters, etc.
• Connectors define the interconnections between components– procedure call, event announcement, asynchronous
message sends, etc.• The line between them may be fuzzy at times
– Ex: A connector might (de)serialize data, but can it perform other, richer computations?An architecture bridges the gap
between requirements and code
![Page 7: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/7.jpg)
7
A good architecture
• Satisfies functional and performance requirements
• Manages complexity• Accommodates future change• Also: reliability, safety, understandability,
compatibility, robustness, …
![Page 8: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/8.jpg)
Divide and conquer
• Benefits of decomposition:– Decrease size of tasks– Support independent testing and analysis– Separate work assignments– Ease understanding
• Use of abstraction leads to modularity– Implementation techniques: information hiding, interfaces
• To achieve modularity, you need:– Strong cohesion within a component– Loose coupling between components– And these properties should be true at each level
![Page 9: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/9.jpg)
9
Qualities of modular software• decomposable
– can be broken down into pieces
• composable– pieces are useful and can be combined
• understandable– one piece can be examined in isolation
• has continuity– reqs. change affects few modules
• protected / safe– an error affects few other modules
![Page 10: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/10.jpg)
10
Interface and implementation
• public interface: data and behavior of the object that can be seen and executed externally by "client" code
• private implementation: internal data and methods in the object, used to help implement the public interface, but cannot be directly accessed
• client: code that uses your class/subsystem
– Example: radio• public interface is the speaker, volume buttons, station dial• private implementation is the guts of the radio; the transistors,
capacitors, voltage readings, frequencies, etc. that user should not see
![Page 11: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/11.jpg)
UML module diagrams
• Express– Subclassing– Use (dependence)
![Page 12: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/12.jpg)
Loose coupling
• coupling assesses the kind and quantity of interconnections among modules
• Modules that are loosely coupled (or uncoupled) are better than those that are tightly coupled
• The more tightly coupled are two modules, the harder it is to work with them separately, and thus the benefits become more limited
![Page 13: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/13.jpg)
Tightly or loosely coupled?
User Interface Graphics
Data StorageApplication Level Classes
Business Rules Enterprise Level Tools
-End1
*
-End2
*-End3
*
-End4*
-End5
*
-End6
*
-End7*
-End8*
-End9*
-End10
*
-End11*
-End12*
-End13
*
-End14*
-End15
*
-End16
*
-End17
*
-End18
*
-End19*
-End20*
-End21
*
-End22
*
-End23*-End24*
-End25*
-End26*
![Page 14: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/14.jpg)
Tightly or loosely coupled?User Interface Graphics
Data Storage Application Level Classes
Business Rules Enterprise Level Tools
-End1
*
-End2
*
-End3*
-End4
*
-End5*
-End6*
-End9
*
-End10
*
-End11
*
-End12
*
-End13*
-End14*
-End15*
-End16*
-End7*
-End8 *
![Page 15: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/15.jpg)
Strong cohesion
• cohesion refers to how closely the operations in a module are related
• Tight relationships improve clarity and understanding
• Classes with good abstraction usually have strong cohension
• No schizophrenic classes!
![Page 16: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/16.jpg)
Strong or weak cohesion?class Employee {
public: … FullName GetName() const; Address GetAddress() const; PhoneNumber GetWorkPhone() const; … bool IsJobClassificationValid(JobClassification jobClass); bool IsZipCodeValid (Address address); bool IsPhoneNumberValid (PhoneNumber phoneNumber); … SqlQuery GetQueryToCreateNewEmployee() const; SqlQuery GetQueryToModifyEmployee() const; SqlQuery GetQueryToRetrieveEmployee() const; …}
![Page 17: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/17.jpg)
An architecture helps with
• System understanding – describes the interactions between modules
• Reuse – by defining the high level components, we can see if there is opportunity for reuse
• Construction – breaks development down into work items; provides a path from requirements to code
• Evolution – see reuse
• Management – helps understand the work to do, and the work done; track progress
• Communication – gives you a vocabulary; pictures say 1000 words
![Page 18: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/18.jpg)
Architectural style
• Defines the vocabulary of components and connectors for a family (style)
• Constraints on the elements and their combination– Topological constraints (no cycles, register/announce
relationships, etc.)– Execution constraints (timing, etc.)
• By choosing a style, one gets all the known properties of that style (for any architecture in that style)– Ex: performance, lack of deadlock, ease of making
particular classes of changes, etc.
![Page 19: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/19.jpg)
Not just boxes and arrows
• Consider pipes & filters, for example (Garlan and Shaw)– Pipes must compute local transformations– Filters must not share state with other filters– There must be no cycles
• If these constraints are not satisfied, it’s not a pipe & filter system– One can’t tell this from a picture– One can formalize these constraints
scan parse optimize generate
![Page 20: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/20.jpg)
The design and the reality
• The code is often less clean than the design• The design is still useful
– Communication among team members– Selected deviations can be explained more concisely and
with clearer reasoning
![Page 21: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/21.jpg)
Architectural mismatch• Garlan, Allen, Ockerbloom tried to build a toolset to support software
architecture definition from existing components– OODB (OBST)– graphical user interface toolkit (Interviews)– RPC mechanism (MIG/Mach RPC)– Event-based tool integration mechanism (Softbench)
• It went to hell in a handbasket, not because the pieces didn’t work, but because they didn’t fit together
– Excessive code size– Poor performance– Needed to modify out-of-the-box components (e.g., memory allocation)– Error-prone construction process
• Architectural Mismatch: Why Reuse Is So Hard. IEEE Software 12, 6 (Nov. 1995)• Architecture should warn about such problems (& identify problems)
![Page 22: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/22.jpg)
Views
A view illuminates a set of top-level design decisions how the system is composed of interacting parts where are the main pathways of interaction key properties of the parts information to allow high-level analysis and appraisal
![Page 23: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/23.jpg)
Importance of viewsMultiple views are needed to understand the
different dimensions of systems
Functional Requirements
Performance (execution) Requirements
PackagingRequirements
Installation Requirements
Booch
![Page 24: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/24.jpg)
Web application (client-server)
Booch
![Page 25: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/25.jpg)
manipulates
Model-View-Controller
Separates the application object (model) from the way it is represented to the user (view) from the way in which the user controls it (controller).
UserUser
ModelModel
ControllerControllerViewView
Application
sees uses
updates
![Page 26: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/26.jpg)
Pipe and filter
Filter - computes on the data
Pipe – passes the data
,,,
Each stage of the pipeline acts independently of the others.Can you think of a system based on this architecture?
top | grep $USER | grep acrobat
![Page 27: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/27.jpg)
27
Blackboard architectures• The knowledge sources: separate,
independent units of application dependent knowledge. No direct interaction among knowledge sources
• The blackboard data structure: problem-solving state data. Knowledge sources make changes to the blackboard that lead incrementally to a solution to the problem.
• Control: driven entirely by state of blackboard. Knowledge sources respond opportunistically to changes in the blackboard.
Blackboard systems have traditionally been used for applications requiringcomplex interpretations of signal processing, such as speech and patternrecognition.
![Page 28: Software Architecture “Good software architecture makes the rest of the project easy.” Steve McConnell, Survival Guide “There are two ways of constructing.](https://reader036.fdocuments.in/reader036/viewer/2022062720/56649efd5503460f94c10a3e/html5/thumbnails/28.jpg)
Hearsay-II: blackboard
28