Design Principles Design Principles and Guidelines Overview � Design Principles ���������� � �������� Software Design Principles and Guidelines ���������� � ����� � ������������� � ������������� � ������������ � ���� � ���������� ����� � ���������� � ��� � ���������� � ������� � �������� � ����������� � ����������� ������� � �������� � �������� � ������� – Important design concepts ������� ���� – Useful design principles ����������� Douglas C. Schmidt ������ ��������� ���� �������� � Development Methodologies ����� d.schmidt@vanderbilt.edu ��������� – Traditional approaches ����� ���������� Vanderbilt University, St. Louis ��������� ��������� – Agile programming ������ �������� www.cs.wustl.edu/ � schmidt/ � Design Guidelines ��������������� ���������� May 25, 2003 ���������� ���������� – Motivation ������� ������� ��������� ��������� – Common Design Mistakes ������� ������� ��������� ��������� – Design Rules ������� 1 Design Principles Design Principles Motivation: Goals of the Design Phase (1/2) Motivation: Goals of the Design Phase (2/2) � Decompose system into � Specify component interfaces ����� ����� ����� ����� ����� ����� ������ components ���������� ���� �������� – Interfaces should be well-defined – i.e. , identify the software � Facilitates component testing ��� ��������������� architecture and team communication ������ ������ � Determine relationships ������������� � Describe component functionality �������� ������ ��������� between components ������� ��� ��������������� – e.g. , informally or formally ������� ������ – e.g. , identify component � Identify opportunities for systematic ��� ��������������� dependencies ������ ��� � ���� reuse � Determine intercomponent ������ ������� ���� – Both top-down and bottom-up �������� ����� communication mechanisms ������ – e.g. , globals, function calls, shared memory, IPC/RPC 2 3
specification and apply above process to each – Make decisions that apply to whole program Design Principles 1. List the hard decisions and decisions likely to – contain easily comprehensible components – provide individual, independent, low-level Macro Steps in the Design Process Micro Steps in the Design Process – Design the uses hierarchy as you do this decisions and decisions likely to change 4. Continue refining until all design decisions 2. Design a component specification to hide iterative decision process with the following 3. Treat each higher-level component as a � Given a requirements spec, design is an – Modularize most likely changes first – Then modularize remaining difficult � In the design process the orientation moves from – Customer to developer implementation assignments – What to how (include reuse decisions) � Macro steps include: – hidden in a component 1. Preliminary Design each such decision – External design describes the real-world model – Architectural design decomposes the requirement specification into software subsystems family first general steps: 2. Detailed Design – Specify each subsystem change Design Principles – Further decomposed subsystems, if necessary are: 4 5 Design Principles Design Principles Example: Designing a Web Server Key Design Concepts and Principles � Web server design ��������������� ��������������� �������� �������� ��� ��� ��� Key design concepts and design Main goal of these decisions ������ ������ ������ ������ ������������� ������������� principles include: concepts and principles is – Portability issues to: �������� �������� 1. Decomposition – I/O demuxing and ���� ���� ������ ������ � Manage software concurrency ��� ��� 2. Abstraction and information hiding ���������� – HTTP protocol system complexity ��������� ��������� 3. Component modularity processing � Improve software quality – File access 4. Extensibility ����������������������� ����������������������� factors �������� �������� � � � � � � � � �� �� ����� ����� � � ������� ������� � Web server 5. Virtual machine architectures � Facilitate systematic components ���������� ���������� reuse 6. Hierarchical relationships ����� � ������������ ����� � ������������ – Event dispatcher � Resolve common design ����������������� ����������������� 7. Program families and subsets – Protocol handler ������� challenges www.cs.wustl.edu/˜jxh/ – Cached virtual research/ filesystem 6 7
Design Principles Design Principles Challenge 1: Determining the Web Server Architecture Solution: Decomposition � Context: A large and complex production web server � Decomposition handles complexity by splitting large problems into smaller problems � Problems: � This “divide and conquer” concept is common to all life-cycle – Designing the web server as a large monolithic entity is tedious processes and design techniques and error-prone � Basic methodology: – Web server developers must work concurrently to improve productivity 1. Select a piece of the problem (initially, the whole problem) – Portability and resuability are important quality factors 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 Design Principles Design Principles Decomposition Example: Web Server Framework Object-Oriented Decomposition Principles Reactor/Proactor Strategy Singleton � Features I/O strategy Cached virtual Memento State 1. Don’t design components to correspond to execution steps framework filesystem – High-performance � Since design decisions usually transcend execution time – Flexible concurrency, ~ Asynchronous completion token Tilde expander Component configurator /home/... demuxing, and caching Protocol 2. Decompose so as to limit the effect of any one design decision on Event dispatcher handler Acceptor mechanisms the rest of the system Protocol – Uses frameworks based filter � Anything that permeates the system will be expensive to change Pipes and filters on ACE Adapter 3. Components should be specified by all information needed to use Concurrency State Protocol pipeline strategy framework framework the component Component configurator Active object Strategy � and nothing more ! www.cs.wustl.edu/ � schmidt/PDF/JAWS.pdf 10 11
Recommend
More recommend