1University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1Lecture 4:Showing the architecture Coupling and Cohesion UML Package Diagrams Software Architectural Styles: Layered Architectures Pipe-and-filter Object Oriented Architecture Implicit Invocation RepositoriesUniversity of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2Coupling and CohesionArchitectural Building blocks:A good architecture:Minimizes coupling between modules:Goal: modules donʼt need to know much about one another to interactLow coupling makes future change easierMaximizes the cohesion of each moduleGoal: the contents of each module are strongly inter-relatedHigh cohesion means the subcomponents really do belong togethermodule moduleconnectorX23University of TorontoDepartment of Computer Science© 2008 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. Conwayʼs Law“The structure of a software systemreflects the structure of the organisationthat built it”University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4PeopleSocio-Technical CongruenceCGBEFDALJHIKModules372564112108911See: Valetto, et al., 2007.3University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5PeopleSocio-Technical CongruenceCGBEFDALJHIKModules372564112108911See: Valetto, et al., 2007.University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6Software ArchitectureA software architecture defines:The components of the software systemHow the components use each otherʼs functionality and dataHow control is managed between the componentsAn example: client-serverServers provide some kind of service; clients request and use servicesReduced coupling: servers donʼt need to know what clients are out thereclientclientclientmethodinvocationmethodinvocationmethodinvocationServer4University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7Application LogicStorage LayerPresentation LayerExample: 3-layer architectureJavaAWT ApplicationViews ControlObjects BusinessLogic QueryEngine DBMSFileManagemt University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8UML PackagesWe need to represent our architecturesUML elements can be grouped together in packagesElements of a package may be: other packages (representing subsystems or modules); classes; models (e.g. use case models, interaction diagrams, statechart diagrams, etc)Each element of a UML model is owned by a single packageCriteria for decomposing a system into packages:Different ownerswho is responsible for working on which diagrams?Different applicationseach problem has its own obvious partitions;Clusters of classes with strong cohesione.g., course, course description, instructor, student,…Or: use an architectural pattern to help find a suitable decomposition…5University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9 javaPackage notationutil util DateDate util java::util Date util Datejava::util::Datenamed packagepackage with listof contained classespackage containinga class diagrampackage with qualified namenested packagespackage with fully qualified nameUniversity of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 10Towards component-based design control Button Check box <<interface>> OnOffturnOn()turnOff()isOn()isOff() Furnace::Heater Lighting::Light6University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 11Or use Component Diagrams… Till Sales Server messagequeue transactionprocessor accountingdriver accountingsystem salesmessageUniversity of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 12Dependency cycles (to be avoided)7University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13Application Logic Layer PackageStorage Layer PackagePresentation Layer PackageArchitectural PatternsE.g. 3 layerarchitecture:PresentationLayerApplicationLogic LayerStorageLayerJava AWTApplicationWindowsControlObjectsBusinessObjectsObject toRelationalJDBCJava SQLUniversity of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14Or to show the interfaces…Application Logic Layer PackageStorage Layer PackagePresentation Layer PackageJava AWTApplicationWindowsControlObjectsBusinessObjectsObject toRelationalJDBCJava SQL E.g. 3 layerarchitecture:PresentationLayerApplicationLogic LayerStorageLayer8University of TorontoDepartment of Computer Science© 2012 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 15kernalLayered SystemsExamplesOperating Systemscommunication protocolsInteresting propertiesSupport increasing levels of abstraction during designSupport enhancement (add functionality) and re-usecan define standard layer interfacesDisadvantagesMay not be able to identify (clean) layerskernalutilitiesapplication layerusersSource: Adapted from Shaw &
View Full Document