Nov. 4, 2013 cs561 Software Engineering Notes Software architecture and design Investigate general principles of design patterns to construct high-level architecture of the system In particular we will learn to Design as a series of decisions Look at different types of design top down - starting with architecture bottom up - starting with utilities Learn about Design principles Divide and conquer striving for high cohesion and low coupling Using good abstraction to hide details Evaluate trade offs cost-benefit analysis SW architectures for high level design Writing effective design documents What is design for SW? Problem solving process Objective - find and describe a way to implement functional requirements within constraints Constraints are imposed by quality, platform, and process requirements - Response time - Throughput - Resource use - Reliability - Availability - Maintenance Recall question What is a platform requirement? Process requirement? Platform - technology to use or computing platform Process requirement - development methods, cost, delivery date,... During design have many subproblems to deal with and many options to deal with them Need to choose best options for each design decision To do so consult the following: Current design Requirements Technology available Knowledge of design principles and best practices Your own past knowledge Definitions of system parts Subsystems, components, and modules Component - any piece of SW that has a clear role that can be isolated and replaced a with different component having similar functionality Ex. source code executable DLL DB Module - component defined at programming language level Methods, classes, and packages System - logical entity having set of definable responsibilities or objectives and consisting of HW, SW or both. Implemented by group of components Subsystem - system that is part of a larger system with a definite interface Ex. packages in java used to implement subsystems or individual classes Draw class diagram Design What is top down? Start with high level structure work down toward decisions about high level constructs If I want to build a First Person Shooter what is the top level design? Game --> Components --> Levels , Storyline, Characters ---> Character Design, ... What is bottom up design? Start with low level utilities then figure out how to put them together to get high level constructs UI, Character Class, Physics for character --> Character Design, … -> levels -> components -> game Lots of times we use both Why? Have ideas for some specifics and ideas for high level too Lots of kinds of design Architecture - division of SW into subsystems and components Deciding how these will be connected Class design - design of features and classes (associations, attributes, interactions, states) UI Design DB design Algorithm design Protocol design - comm networks Want good design resulting in Increased profit, decreased cost, increased revenue What is revenue? what is cost? what is profit? Conform to requirements to give customer what he/she wants Speed up development Increased quality How to get good design? Follow general design principles 1. Divide and conquer Work on smaller manageable parts of a SW system Do development in parallel Allows for experts to focus on content they are comfortable with Able to have replaceable or interchangeable parts Can make components reusable (add incentive for SW engineer) Many ways to divide up a project Distributed system divided into clients and servers System divided into subsystems Subsystem divided into packages Packages divided into classes Classes divided into methods and attributes 2. Increase cohesion where possible Cohesion - stick or stay together Want to keep things together that belong together especially w.r.t. divide and conquer Subsystems/modules have high cohesion if related classes/modules are kept together and unrelated ones are not included Many types of cohesion Functional - module performs a single computation and returns a value without side effects (leaves system in same state) File, DB, user updates are side effects Layer - related services are kept together, everything else is kept out -there is a strict hierarchy in which higher level services can access only lower level services -accessing a service may result in a side effect Communicational - facilities for operating on the same data are kept together and everything else is kept out. Good classes exhibit communicational cohesion Sequential - set of procedures that work in sequence to perform a computation are kept together. Output from one is input to the next. Everything else is kept out. Procedural - Set of procedures that are called one after another is kept together. Temporal - procedures used in the same general phase of computation (e.g. init or termination) are kept together Utility - related utilities are kept together when there is no way to group them using a stronger form of cohesion