Software Design Principles and Guidelines



Similar documents
Software Design Principles and Guidelines

Software Quality Factors OOA, OOD, and OOP Object-oriented techniques enhance key external and internal software quality factors, e.g., 1. External (v

Introduction to Patterns and Frameworks

Fourth generation techniques (4GT)

Introduction to Embedded Systems. Software Update Problem

Software Engineering

Chapter 8 Approaches to System Development

Decomposition into Parts. Software Engineering, Lecture 4. Data and Function Cohesion. Allocation of Functions and Data. Component Interfaces

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Patterns in Software Engineering

Chap 1. Introduction to Software Architecture

Questions? Assignment. Techniques for Gathering Requirements. Gathering and Analysing Requirements

Engineering Process Software Qualities Software Architectural Design

Managing Variability in Software Architectures 1 Felix Bachmann*

Karunya University Dept. of Information Technology

Object Oriented Design

Aspect-Oriented Programming

Contents. Introduction and System Engineering 1. Introduction 2. Software Process and Methodology 16. System Engineering 53

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

JOURNAL OF OBJECT TECHNOLOGY

Software Life Cycle Processes

Software Development Life Cycle (SDLC)

Overview of CORBA 11.1 I NTRODUCTION TO CORBA Object services 11.5 New features in CORBA Summary

COSC 3351 Software Design. Recap for the first quiz. Edgar Gabriel. Spring For the 1 st Quiz

2. Analysis, Design and Implementation

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Basic Trends of Modern Software Development

Architectural Patterns. Layers: Pattern. Architectural Pattern Examples. Layer 3. Component 3.1. Layer 2. Component 2.1 Component 2.2.

Effective Java Programming. efficient software development

How To Develop Software

In the IEEE Standard Glossary of Software Engineering Terminology the Software Life Cycle is:

PART IV Performance oriented design, Performance testing, Performance tuning & Performance solutions. Outline. Performance oriented design

Peter Mileff PhD SOFTWARE ENGINEERING. The Basics of Software Engineering. University of Miskolc Department of Information Technology

Client/Server Computing Distributed Processing, Client/Server, and Clusters

Architecture. Reda Bendraou

Applying 4+1 View Architecture with UML 2. White Paper

Chapter 6. CORBA-based Architecture. 6.1 Introduction to CORBA 6.2 CORBA-IDL 6.3 Designing CORBA Systems 6.4 Implementing CORBA Applications

Information Systems Analysis and Design CSC John Mylopoulos. Software Architectures Information Systems Analysis and Design CSC340

Test Driven Development of Embedded Systems Using Existing Software Test Infrastructure

Aerospace Software Engineering

SOFTWARE PROCESS MODELS

High-level Design. What is software architecture?

Chapter 11: Integrationand System Testing

Design principles in Test Suite Architecture

Distributed Objects and Components

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

Software development life cycle. Software Engineering - II ITNP92 - Object Oriented Software Design. Requirements. Requirements. Dr Andrea Bracciali

OO Design Quality Metrics

Quotes from Object-Oriented Software Construction

A Capability Maturity Model (CMM)

Chapter 13: Program Development and Programming Languages

Glossary of Object Oriented Terms

2 (18) - SOFTWARE ARCHITECTURE Service Oriented Architecture - Sven Arne Andreasson - Computer Science and Engineering.

A Software Engineering Process for Operational Space Weather Systems. S. Dave Bouwer, W. Kent Tobiska Space Environment Technologies

Web Application Architectures

Chapter 13: Program Development and Programming Languages

CS 389 Software Engineering. Lecture 2 Chapter 2 Software Processes. Adapted from: Chap 1. Sommerville 9 th ed. Chap 1. Pressman 6 th ed.

Introduction to CORBA. 1. Introduction 2. Distributed Systems: Notions 3. Middleware 4. CORBA Architecture

Real Time Programming: Concepts

Introduction to Automated Testing

Agile Software Development

Software Design. Design (I) Software Design Data Design. Relationships between the Analysis Model and the Design Model

Chapter 3 Operating-System Structures

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

Software maintenance. Software Maintenance. Fundamental problems. Maintenance activities. Lehman/Belady model of evolution. Topics

CSE 435 Software Engineering. Sept 16, 2015

Developing Flexible and High-performance Web Servers with Frameworks and Patterns

Challenges and Opportunities for formal specifications in Service Oriented Architectures

Software design (Cont.)

SOFT 437. Software Performance Analysis. Ch 5:Web Applications and Other Distributed Systems

Life-Cycle Model. Software Life-Cycle Models. Software Development in Theory. Software Development in Practice

In: Proceedings of RECPAD th Portuguese Conference on Pattern Recognition June 27th- 28th, 2002 Aveiro, Portugal

Middleware Lou Somers

Announcements. SE 1: Software Requirements Specification and Analysis. Review: Use Case Descriptions

Software Life-Cycle Management

System types. Distributed systems

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

2. Analysis, Design and Implementation

Chapter 13 Embedded Operating Systems

CS 451 Software Engineering Winter 2009

1 Organization of Operating Systems

Service Oriented Architecture

KWIC Exercise. 6/18/ , Spencer Rugaber 1

To introduce software process models To describe three generic process models and when they may be used

SEEM4570 System Design and Implementation Lecture 10 Software Development Process

Functional Decomposition Top-Down Development

Chapter 2: Remote Procedure Call (RPC)

RUP Design. Purpose of Analysis & Design. Analysis & Design Workflow. Define Candidate Architecture. Create Initial Architecture Sketch

Construction Principles and Design Patterns. Flyweight, Bridge, Builder

Software Engineering. Software Processes. Based on Software Engineering, 7 th Edition by Ian Sommerville

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

A standards-based approach to application integration

Software Engineering

Establishing Great Software Development Process(es) for Your Organization. By Dale Mayes

The Service Revolution software engineering without programming languages

Algorithms, Flowcharts & Program Design. ComPro

COMP5426 Parallel and Distributed Computing. Distributed Systems: Client/Server and Clusters

Module 17. Client-Server Software Development. Version 2 CSE IIT, Kharagpur

Improved Software Testing Using McCabe IQ Coverage Analysis

CSCI E 98: Managed Environments for the Execution of Programs

Transcription:

Software and Guidelines Douglas C. Schmidt d.schmidt@vanderbilt.edu Vanderbilt University, St. Louis www.cs.wustl.edu/schmidt/ May 25, 2003 and Guidelines Overview Important design concepts Useful design principles Development Methodologies Traditional approaches Agile programming Design Guidelines Motivation Common Design Mistakes Design Rules 1 Motivation: Goals of the Design Phase (1/2) Decompose system into components i.e., identify the software architecture Determine relationships between components e.g., identify component dependencies Determine intercomponent communication mechanisms e.g., globals, function calls, shared memory, IPC/RPC Motivation: Goals of the Design Phase (2/2) Specify component interfaces Interfaces should be well-defined Facilitates component testing and team communication Describe component functionality e.g., informally or formally Identify opportunities for systematic reuse Both top-down and bottom-up 2 3

Macro Steps in the Design Process 4 In the design process the orientation moves from Customer to developer What to how Macro steps include: 1. Preliminary Design External design describes the real-world model Architectural design decomposes the requirement specification into software subsystems 2. Detailed Design Specify each subsystem Further decomposed subsystems, if necessary Micro Steps in the Design Process Given a requirements spec, design is an iterative decision process with the following general steps: 1. List the hard decisions and decisions likely to change 2. Design a component specification to hide each such decision Make decisions that apply to whole program family first Modularize most likely changes first Then modularize remaining difficult decisions and decisions likely to change Design the uses hierarchy as you do this (include reuse decisions) 3. Treat each higher-level component as a specification and apply above process to each 4. Continue refining until all design decisions are: hidden in a component contain easily comprehensible components provide individual, independent, low-level implementation assignments 5 6 Example: Designing a Web Server www.cs.wustl.edu/ jxh/ research/ Web server design decisions Portability issues I/O demuxing and concurrency HTTP protocol processing File access Web server components Event dispatcher Protocol handler Cached virtual filesystem Key Design Concepts and Principles 7 Key design concepts and design principles include: 1. Decomposition 2. Abstraction and information hiding 3. Component modularity 4. Extensibility 5. Virtual machine architectures 6. Hierarchical relationships 7. Program families and subsets Main goal of these concepts and principles is to: Manage software system complexity Improve software quality factors Facilitate systematic reuse Resolve common design challenges

Challenge 1: Determining the Web Server Architecture Solution: Decomposition Context: A large and complex production web server Problems: Designing the web server as a large monolithic entity is tedious and error-prone Web server developers must work concurrently to improve productivity Portability and resuability are important quality factors Decomposition handles complexity by splitting large problems into smaller problems This divide and conquer concept is common to all life-cycle processes and design techniques Basic methodology: 1. Select a piece of the problem (initially, the whole problem) 2. Determine the components in this piece using a design paradigm, e.g., functional, structured, object-oriented, generic, etc. 3. Describe the components interactions 4. Repeat steps 1 through 3 until some termination criteria is met e.g., customer is satisfied, run out of time/money, etc. ;-) 8 9 Decomposition Example: Web Server Framework Protocol handler Protocol filter Memento Adapter Reactor/Proactor Strategy Singleton I/O strategy framework Asynchronous completion token Pipes and filters Protocol pipeline framework Component configurator Cached virtual filesystem Acceptor Tilde expander Concurrency strategy framework ~ Event dispatcher Active object /home/... Strategy www.cs.wustl.edu/schmidt/pdf/jaws.pdf State Component configurator State Features High-performance Flexible concurrency, demuxing, and caching mechanisms Uses frameworks based on ACE Object-Oriented Decomposition Principles 1. Don t design components to correspond to execution steps Since design decisions usually transcend execution time 2. Decompose so as to limit the effect of any one design decision on the rest of the system Anything that permeates the system will be expensive to change 3. Components should be specified by all information needed to use the component and nothing more! 10 11

e.g., loops, iterators, frameworks, and multitasking Challenge 2: Implementing a Flexible Web Server Solution: Abstraction Context: The requirements that a production web server must meet will change over time, e.g.: New platforms New compilers New functionality New performance goals Problems: If the web server is hard coded using low-level system calls it will be hard to port If web server developers write software that s tightly coupled with internal implementation details the software will be hard to evolve Abstraction manages complexity by emphasizing essential characteristics and suppressing implementation details Allows postponement of certain design decisions that occur at various levels of analysis, e.g., Representational and algorithmic considerations Architectural and structural considerations External environment and platform considerations 12 13 Common Types of Abstraction 1. Procedural abstraction e.g., closed subroutines 2. Data abstraction e.g., ADT classes and component models 3. Control abstraction 14 Information Hiding Information hiding is an important means of achieving abstraction i.e., design decisions that are subject to change should be hidden behind abstract interfaces Application software should communicate only through well-defined interfaces Each interface should be specified by as little information as possible If internal details change, clients should be minimally affected May not even require recompilation and relinking... 15

Typical Information to be Hidden Data representations i.e., using abstract data types Lower-level interfaces e.g., ordering of low-level operations, i.e., process sequence Algorithms e.g., sorting or searching techniques Input and Output Formats Machine dependencies, e.g., byte-ordering, character codes Separating policy and mechanism Multiple policies can be implemented by same mechanisms e.g., OS scheduling and virtual memory paging Same policy can be implemented by multiple mechanisms e.g., reliable communication service can be provided by multiple protocols 16 Information Hiding Example: Message Queueing A Message_Queue is a list of ACE_Message_Blocks Efficiently handles arbitrarily-large message payloads Design encapsulates and parameterizes various aspects e.g., synchronization, memory allocators, and reference counting can be added transparently 17 The ACE_Message_Block Class ACE_Message_Block # rd_ptr_ : size_t # wr_ptr_ : size_t # cont_ : ACE_Message_Block * # next_ : ACE_Message_Block * # prev_ : ACE_Message_Block * # data_block_ : ACE_Data_Block * + init (size : size_t) : int + msg_type (type : ACE_Message_Type) + msg_type () : ACE_Message_Type + msg_priority (prio : u_long) + msg_priority () : u_long + clone () : ACE_Message_Block * + duplicate () : ACE_Message_Block * + release () : ACE_Message_Block * + set_flags (flags : u_long) : u_long + clr_flags (flags : u_long) : u_long + copy (buf : const char *,n : size_t) : int + rd_ptr (n : size_t) + rd_ptr () : char * + wr_ptr (n : size_t) + wr_ptr () : char * + length () : size_t + total_length () : size_t + size () : size_t Class characteristics * 1 ACE_Data_Block # base_ : char * # refcnt_ : int Hide messaging implementations from clients 18 The ACE_Message_Queue Class # head_ : ACE_Message_Block * # tail_ : ACE_Message_Block * # high_water_mark_ : size_t # low_water_mark_ : size_t ACE_Message_Queue SYNCH_STRATEGY + ACE_Message_Queue (high_water_mark : size_t = DEFAULT_HWM, low_water_mark : size_t = DEFAULT_LWM, notify : ACE_Notification_Strategy * = 0) + open (high_water_mark : size_t = DEFAULT_HWM, low_water_mark : size_t = DEFAULT_LWM, notify : ACE_Notification_Strategy * = 0) : int + flush () : int + notification_strategy (s : ACE_Notification_Strategy *) : void + is_empty () : int + is_full () : int + enqueue_tail (item : ACE_Message_Block *, timeout : ACE_Time_Value * = 0) : int + enqueue_head (item : ACE_Message_Block *, timeout : ACE_Time_Value * = 0) : int + enqueue_prio (item : ACE_Message_Block *, timeout : ACE_Time_Value * = 0) : int + dequeue_head (item : ACE_Message_Block *&, timeout : ACE_Time_Value * = 0) : int + dequeue_tail (item : ACE_Message_Block *&, timeout : ACE_Time_Value * = 0) : int + high_water_mark (new_hwm : size_t) : void + high_water_mark (void) : size_t + low_water_mark (new_lwm : size_t) : void + low_water_mark (void) : size_t + close () : int + deactivate () : int + activate () : int + pulse () : int + state () : int Class characteristics Note how the synchronization aspect can be strategized! 19

Challenge 3: Determining the Units of Web Server Decomposition Context: A production web server that uses abstraction and information hiding Problems: Need to determine the appropriate units of decomposition, which should Possess well-specified abstract interfaces and Have high cohesion and low coupling Solution: Component Modularity A modular system is one that s structured into identifiable abstractions called components A software entity that represents an abstraction A work assignment for developers A unit of code that has one or more names has identifiable boundaries can be (re-)used by other components encapsulates data hides unnecessary details can be separately compiled 20 21 Designing Component Interfaces A component interface consists of several types of ports: Exports Services provided to other components, e.g., facets and event sources Imports Services requested from other components, e.g., receptacles and event sinks Access Control Not all clients are equal, e.g., protected/private/public Define components that provide multiple interfaces and implementations Anticipate change Component Modularity Example: Stream Processing A Stream allows flexible configuration of layered processing modules A Stream component contains astackofmodule components Each Module contains two Task components i.e., read and write Tasks Each Task contains a Message Queue component and a Thread Manager component 22 23

Benefits of Component Modularity Criteria for Evaluating Modular Designs Modularity facilitates software quality factors, e.g.,: Extensibility! well-defined, abstract interfaces Reusability! low-coupling, high-cohesion Compatibility! design bridging interfaces Portability! hide machine dependencies Modularity is important for good designs since it: Enhances for separation of concerns Enables developers to reduce overall system complexity via decentralized software architectures Increases scalability by supporting independent and concurrent development by multiple personnel Component decomposability Are larger components decomposed into smaller components? Component composability Are larger components composed from existing smaller components? Component understandability Are components separately understandable? Component continuity Do small changes to the specification affect a localized and limited number of components? Component protection Are the effects of run-time abnormalities confined to a small number of related components? 24 25 Principles for Ensuring Modular Designs Language support for components Components should correspond to syntactic units in the language Few interfaces Every component should communicate with as few others as possible Small interfaces (weak coupling) If any two components communicate at all, they should exchange as little information as possible Explicit Interfaces Whenever two components A and B communicate, this must be obvious from the text of A or B or both Information Hiding All information about a component should be private unless it s specifically declared public Challenge 4: Future Proofing the Web Server Context: A production web server whose requirements will change over time Problems: Certain design aspects seem constant until they are examined in the overall structure of an application Developers must be able to easily refactor the web server to account for new sources of variation 26 27

Solution: Extensibility Extensibility Example: Active Object Tasks Extensible software is important to support successions of quick updates and additions to address new requirements and take advantage of emerging opportunities/markets Extensible components must be both open and closed, i.e., the open/closed principle: Open component! still available for extension This is necessary since the requirements and specifications are rarely completely understood from the system s inception Closed! component available for use by other components This is necessary since code sharing becomes unmanageable when reopening a component triggers many changes Features Tasks can register with a Reactor They can be dynamically linked They can queue data They can run as active objects JAWS uses inheritance and dynamic binding to produce task components that are both open and closed 28 29 Challenge 5: Separating Concerns for Layered Systems Context: A production web server whose requirements will change over time Problems: To enhance reuse and flexibility, it is often necessary to decompose a web server into smaller, more manageable units that are layered in order to Enhance reuse, e.g., multiple higher-layer services can share lower-layer services Transparently and incrementally enhancement functionality Improve performance by allowing the selective omission of unnecessary service functionality Improve implementations, testing, and maintenance 30 Solution: Virtual Machine Architectures A virtual machine provides an extended software instruction set Extensions provide additional data types and associated software instructions Modeled after hardware instruction set primitives that work on a limited set of data types A virtual machine layer provides a set of operations that are useful in developing a family of similar systems 31

e.g., compiler! assembler! obj code! 32 Abstracts away from details of the underlying OS Virtual Machine Layers for the ACE Toolkit www.cs.wustl.edu/schmidt/ace.html Other Examples of Virtual Machines Computer architectures microcode! gates, transistors, signals, etc. Operating systems e.g., Linux Hardware Machine Software Virtual Machine instruction set set of system calls restartable instructions restartable system calls interrupts/traps signals interrupt/trap handlers signal handlers blocking interrupts masking signals interrupt stack signal stack Java Virtual Machine (JVM) 33 Challenge 6: Separating Concerns for Hierarchical Systems Context: A production web server whose requirements will change over time Problems: Developers need to program components at different levels of abstraction independently Changes to one set of components should be isolated as much as possible from other components Need to be able to visualize the structure of the web server design Solution: Hierarchical Relationships Hierarchies reduce component interactions by restricting the topology of relationships A relation defines a hierarchy if it partitions units into levels (note connection to virtual machine architectures) Level 0 is the set of all units that use no other units Level i is the set of all units that use at least one unit at level < i and no unit at level i. Hierarchies form the basis of architectures and designs Facilitates independent development Isolates ramifications of change Allows rapid prototyping 34 35

38 Hierarchy Example: JAWS Architecture A uses relation does not necessarily yield a hierarchy (avoid cycles...) Note, uses is not necessarily the same as invokes: Some invocations are not uses e.g., error logging Some uses don t involve invocations e.g., message passing, interrupts, shared memory access X Uses Y if the correct functioning of X depends on the availability of a correct implementation of Y The Uses Relation (1/3) 36 The Uses Relation (2/3) Allow X to use Y when: X is simpler because it uses Y e.g., Standard C++ library classes Y is not substantially more complex because it is not allowed to use X There is a useful subset containing Y and not X i.e., allows sharing and reuse of Y There is no conceivably useful subset containing X but not Y i.e., Y is necessary for X to function correctly Uses relationships can exist between classes, frameworks, subsystems, etc. Defining Hierarchies Relations that define hierarchies include: Uses Is-Composed-Of Is-A Has-A The first two are general to all design methods, the latter two are more particular to OO design and programming ACE_SOCK_IO ACE_IPC_SAP ACE_SOCK ACE_Addr Acceptor- Connector Reactor Proactor ACE_SOCK_Acceptor ACE_INET_Addr Service Configurator Streams Task ACE_SOCK_Stream ACE_SOCK_Connector 39 37

The Is-A Relation The Is-Composed-Of Relation This ancestor/descendant relationship is associated with object-oriented design and programming languages that possess inheritance and dynamic binding class X possesses Is-A relationship with class Y if instances of class X are specialization of class Y. e.g., anhttp_1_0_handler Is-A ACE_Event_Handler that is specialized for processing HTTP 1.0 requests The is-composed-of relationship shows how the system is broken down in components X is-composed-of fx i g if X is a group of x components that share some common purpose i The following diagram illustrates some of the is-composed-of relationships in JAWS 43 41 The Uses Relation (3/3) software systems A hierarchy in the uses relation is essential for designing reusable uses hierarchy However, certain software systems require controlled violation of a e.g., asynchronous communication protocols, OO callbacks in frameworks, signal handling, etc. Upcalls are one way to control these non-hierarchical dependencies Rule of thumb: Start with an invocation hierarchy and eliminate those invocations (i.e., calls ) that are not uses relationships 40 The Is-Composed-Of Relation Many programming languages support the is-composed-of relation via some higher-level component or record structuring technique However, the following are not equivalent: level (virtual machine) component (an entity that hides one or more secrets ) a subprogram (a code unit) Components and levels need not be identical, as a component may appear in several levels of a uses hierarchy 42

Challenge 7: Enabling Expansion and Contraction of Software over time Context: A production web server whose requirements will change Problems: It may be necessary to reduce the overall functionality of the server to run in resource-constrained environments To meet externally imposed schedules, it may be necessary to release the server without all the features enabled 45 State Service Configurator State The Has-A Relation This client relationship is associated with object-oriented design and programming languages that possess classes and objects class X possesses a Has-A relationship with class Y if instances of class X contain an instance(s) of class Y. e.g., the JAWS web server Has-A Reactor, HTTP_Acceptor, and CV_Filesytem 44 Example of Program Families: JAWS and TAO CLIENT IOP IDL STUBS OS KERNEL REAL-TIME I/O SUBSYSTEM PLUGGABLE ORB & XPORT PROTOCOLS HIGH-SPEED NETWORK INTERFACE OBJ REF in args operation () out args + return value ORB RUN-TIME SCHEDULER REAL-TIME ORB CORE ACE components NETWORK IDL SKELETON (1) THE ACE ORB (TAO) OBJECT (SERVANT) PLUGGABLE ORB & XPORT PROTOCOLS REAL-TIME OBJECT ADAPTER IOP OS KERNEL REAL-TIME I/O SUBSYSTEM HIGH-SPEED NETWORK INTERFACE Strategy Singleton Pipes and Filters Active Object (2) The JAWS Web Server Framework Strategy Solution: Program Families and Subsets This principle should be applied to facilitate extension and contraction of large-scale software systems, particularly reusable middleware infrastructure e.g., JAWS, ACE, etc. Program families are natural way to detect and implement subsets Minimize footprints for embedded systems Promotes system reusability Anticipates potential changes Heuristics for identifying subsets: Analyze requirements to identify minimally useful subsets Also identify minimal increments to subsets 46 Acceptor Service Configurator Event Dispatcher Concurrency Strategy Framework Adapter Protocol Handler Protocol Filter Reactor/Proactor I/O Strategy Framework Protocol Pipeline Framework Asynchronous Completon Token Cached Virtual Filesystem Tilde Expander TAO is a high-performance, real-time implementation of the CORBA specification ~ /home/... JAWS is a high-performance, adaptive Web server that implements the HTTP specification JAWS and TAO were developed using the wrapper facades and frameworks provided by the ACE toolkit Memento 47

Other Examples of Program Families and Subsets Different services for different markets e.g., different alphabets, different vertical applications, different I/O formats Different hardware or software platforms e.g., compilers or OSs Different resource trade-offs e.g., speed vs space Different internal resources e.g., shared data structures and library routines Different external events e.g., UNIX I/O device interface Backward compatibility e.g., sometimes it is important to retain bugs! 48 Conventional Development Processes Waterfall Model Specify, analyze, implement, test (in sequence) Assumes that requirements can be specified up front Spiral Model Supports iterative development Attempts to assess risks of changes Rapid Application Development Build a prototype Ship it :-) 49 Agile Processes Stresses customer satisfaction, and therefore, involvement Provide what the customer wants, as quickly as possible Provide only what the customer wants Encourages changes in requirements Relies on testing For example, extreme Programming practices Planning, designing, coding, testing User Story Requirements System Prototype Technology Spike Time extreme Programming: Planning Planning Game Risk Estimates Change in Requirements, Risk, or Developement Environment Commitment Schedule based on http://www.extremeprogramming.org/rules/planninggame.html Iteration Start with user stories Written by customers, to specify system requirements Minimal detail, typically just a few sentences on a card Expected development time: 1 to 3 weeks each, roughly Planning game creates commitment schedule for entire project Each iteration should take 2-3 weeks 50 51

extreme Programming: Designing Defer design decisions as long as possible Advantages: Simplifies current task (just build what is needed) You don t need to maintain what you haven t built Time is on your side: you re likely to learn something useful by the time you need to decide Tomorrow may never come: if a feature isn t needed now, it might never be needed Disadvantages: Future design decisions may require rework of existing implementation Ramp-up time will probably be longer later Therefore, always try to keep designs as simple as possible extreme Programming: Coding Pair programming Always code with a partner Always test as you code Pair programming pays off by supporting good implementation, reducing mistakes, and exposing more than one programmer to the design/implementation If any deficiencies in existing implementation are noticed, either fix them or note that they need to be fixed 52 53 extreme Programming: Testing Unit tests are written before code Code must pass both its unit test and all regression tests before committing In effect, the test suite defines the system requirements Significant difference from other development approaches If a bug is found, a test for it must be added If a feature isn t tested, it can be removed Agile Processes: Information Sources Kent Beck, Extreme Programming Explained: Embrace Change, Addison-Wesley, ISBN 0201616416, 1999 Kent Beck, Extreme Programming, C++ Report 11:5, May 1999, pp. 26 29+ John Vlissides, XP, interview with Kent Beck in the Pattern Hatching Column, C++ Report 11:6, June 1999, pp. 44-52+ Kent Beck, Embracing Change with Extreme Programming, IEEE Computer 32:10, October 1999, pp. 70-77 http://www.extremeprogramming.org/ http://www.xprogramming.com/ http://c2.com/cgi/wiki?extremeprogrammingroadmap 54 55

Design Guidelines: Motivation Common Design Mistakes (1/2) Design is the process of organizing structured solutions to tasks from a problem domain This process is carried out in many disciplines, in many ways There are many similarities and commonalities among design processes There are also many common design mistakes... The following pages provide a number of design rules. Remember, these rules are simply suggestions on how to better organize your design process, not a recipe for success! Depth-first design only partially satisfy the requirements experience is best cure for this problem... Directly refining requirements specification leads to overly constrained, inefficient designs Failure to consider potential changes always design for extension and contraction Making the design too detailed this overconstrains the implementation 56 57 Common Design Mistakes (2/2) Rules of Design (1/8) Ambiguously stated design misinterpreted at implementation Undocumented design decisions designers become essential to implementation Inconsistent design results in a non-integratable system, because separately developed modules don t fit together Make sure that the problem is well-defined All design criteria, requirements, and constraints, should be enumerated before a design is started This may require a spiral model approach What comes before how i.e., define the service to be performed at every level of abstraction before deciding which structures should be used to realize the services Separate orthogonal concerns Do not connect what is independent Important at many levels and phases... 58 59

Rules of Design (2/8) Design external functionality before internal functionality. First consider the solution as a black-box and decide how it should interact with its environment Then decide how the black-box can be internally organized. Likely it consists of smaller black-boxes that can be refined in a similar fashion Keep it simple. Fancy designs are buggier than simple ones; they are harder to implement, harder to verify, and often less efficient Problems that appear complex are often just simple problems huddled together Our job as designers is to identify the simpler problems, separate them, and then solve them individually Rules of Design (3/8) Work at multiple levels of abstraction Good designers must be able to move between various levels of abstraction quickly and easily Design for extensibility A good design is open-ended, i.e., easily extendible A good design solves a class of problems rather than a single instance Do not introduce what is immaterial Do not restrict what is irrelevant Use rapid prototyping when applicable Before implementing a design, build a high-level prototype and verify that the design criteria are met 60 61 Rules of Design (4/8) Details should depend upon abstractions Abstractions should not depend upon details Principle of Dependency Inversion The granule of reuse is the same as the granule of release Only components that are released through a tracking system can be effectively reused Classes within a released component should share common closure That is, if one needs to be changed, they all are likely to need to be changed i.e., what affects one, affects all Rules of Design (5/8) Classes within a released component should be reused together That is, it is impossible to separate the components from each other in order to reuse less than the total The dependency structure for released components must be a DAG There can be no cycles Dependencies between released components must run in the direction of stability The dependee must be more stable than the depender The more stable a released component is, the more it must consist of abstract classes A completely stable component should consist of nothing but abstract classes 62 63

Rules of Design (6/8) Rules of Design (7/8) Where possible, use proven patterns to solve design problems When crossing between two different paradigms, build an interface layer that separates the two Don t pollute one side with the paradigm of the other Software entities (classes, modules, etc) should be open for extension, but closed for modification The Open/Closed principle Bertrand Meyer Derived classes must usable through the base class interface without the need for the user to know the difference The Liskov Substitution Principle 64 65 Rules of Design (8/8) Concluding Remarks Make it work correctly, then make it work fast Implement the design, measure its performance, and if necessary, optimize it Maintain consistency between representations e.g., check that the final optimized implementation is equivalent to the high-level design that was verified Also important for documentation... Don t skip the preceding rules! Clearly, this is the most frequently violated rule!!! ;-) Good designs can generally be distilled into a few key principles: Separate interface from implementation Determine what is common and what is variable with an interface and an implementation Allow substitution of variable implementations via a common interface i.e., the open/closed principle Dividing commonality from variability should be goal-oriented rather than exhaustive Design is not simply the act of drawing a picture using a CASE tool or using graphical UML notation!!! Design is a fundamentally creative activity 66 67