Vragen? • Noem een aantal niet functionele requirements Software Design Software Design • Noem een aantal elicitatie technieken Chapter 12 • Wat is het risico van taak analyse? • Geef een aantal eigenschappen waaraan requirements moeten voldoen Mark van den Brand • Wat voor technieken zijn er voor het valideren van Wat voor technieken zijn er voor het valideren van requirements? / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 0 V model for software development Software design • Programmer’s approach: g • Skip requirements engineering and design phases • Start writing code • Why? • • Design is a waste of time Design is a waste of time • We need to show something to the customer real quick • We are judged by the amount of LOC/month • We expect or know that the schedule is too tight / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 2 / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 3
Software design Process of design • Design is a trial-and-error process • Design is a problem-solving process whose g g g objective is to find and describe a way: • There is an interaction between requirements • To implement the system’s functional requirements ... engineering, architecting, and design • While respecting the constraints imposed by the While respecting the constraints imposed by the quality, platform and process requirements... • Design traps: − including the budget • • There is no definite formulation There is no definite formulation • And while adhering to general principles of good • There is no stopping rule quality • Solutions are not simply true or false • There may be a whole range of possible (good) solutions / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 4 9-3-2010 PAGE 5 Design Principle 2: Increase cohesion Design Principle 1: Divide and conquer where possible where possible • Trying to deal with something big all at once is • A subsystem or module has high cohesion if it keeps y g g g y g normally much harder than dealing with a series of together things that are related to each other, and smaller things keeps out other things • Separate people can work on each part • Separate people can work on each part. • This makes the system as a whole easier to understand • This makes the system as a whole easier to understand and change • An individual software engineer can specialize. • Type of cohesion: • Each individual component is smaller, and therefore − Functional, Layer, Communicational, Sequential, easier to understand. • Parts can be replaced or changed without having to Procedural, Temporal, Utility replace or extensively change other parts. replace or extensively change other parts. / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 6 / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 7
Design Principle 3: Reduce coupling Design Principle 4: Keep the level of where possible where possible abstraction as high as possible abstraction as high as possible • Coupling occurs when there are interdependencies • Ensure that your designs allow you to hide or defer g y g y between one module and another consideration of details, thus reducing complexity • When interdependencies exist, changes in one place • A good abstraction is said to provide information will require changes somewhere else. will require changes somewhere else hiding hiding • A network of interdependencies makes it hard to see at • Abstractions allow you to understand the essence of a a glance how some component works. subsystem without having to know unnecessary details • Types of coupling: − Content, Common, Control, Stamp, Data, Routine Call, Type use, Inclusion/Import, External , yp , p , / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 8 9-3-2010 PAGE 9 Design Principle 5: Increase reusability Design Principle 6: Reuse existing where possible where possible designs and code where possible designs and code where possible • Design the various aspects of your system so that • Design with reuse is complementary to design for g y y g y g they can be used again in other contexts reusability • Generalize your design as much as possible • Actively reusing designs or code allows you to take advantage of the investment you or others have made advantage of the investment you or others have made • Follow the preceding three design principles Follow the preceding three design principles in reusable components • Design your system to contain hooks − Cloning should not be seen as a form of reuse • Simplify your design as much as possible p y y g p • Use frameworks/libraries as much as possible / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 10 / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 11
Design Principle 8: Anticipate Design Principle 7: Design for flexibility obsolescence obsolescence • Plan for changes in the technology or environment • Actively anticipate changes that a design may have y g g y so the software will continue to run or can be easily to undergo in the future, and prepare for them changed • Reduce coupling and increase cohesion • Avoid using early releases of technology g y gy • Create abstractions Create abstractions • Avoid using software libraries that are specific to • Do not hard-code anything particular environments • Leave all options open p p • Avoid using undocumented features or little-used Avoid using undocumented features or little used − Do not restrict the options of people who have to features of software libraries • Avoid using software or special hardware from modify the system later companies that are less likely to provide long term companies that are less likely to provide long-term • Use reusable code and make code reusable • Use reusable code and make code reusable support • Use standard languages and technologies that are supported by multiple vendors supported by multiple vendors / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 12 9-3-2010 PAGE 13 Design Principle 10: Design for Design Principle 9: Design for Portability Testability Testability • Have the software run on as many platforms as • Take steps to make testing easier y g possible • Design a program to automatically test the software • Avoid the use of facilities that are specific to one − Discussed more in Chapter 13 particular environment particular environment − Ensure that all the functionality of the code can by E th t ll th f ti lit f th d b • E.g. a library only available in Microsoft Windows driven by an external program, bypassing a graphical user interface • In Java, you can create a main() method in each class in order to exercise the other methods / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 14 / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 15
Design Principle 11: Design defensively Design principles • Never trust how others will try to use a component • Abstraction y you are designing • Modularity, coupling and cohesion • Handle all cases where other code might attempt to use • Information hiding your component inappropriately your component inappropriately • Limit complexity • Check that all of the inputs to your component are • Hierarchical structure valid: the preconditions − Unfortunately, over-zealous defensive design can result in unnecessarily repetitive checking − Example: 75% of the code is used to parameter p p checking / Faculteit Wiskunde en Informatica / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 16 9-3-2010 PAGE 17 Abstraction Modularity • Procedural abstraction • Structural criteria which tell us something about g individual modules and their interconnections • natural consequence of stepwise refinement − name of procedure denotes sequence of actions • Modern programming languages support modularity M d i l t d l it • Data abstraction • • • Cohesion and coupling • Cohesion and coupling aimed at finding a hierarchy in the data aimed at finding a hierarchy in the data • cohesion: the glue that keeps a module together • coupling: the strength of the connection between modules • keep track of this via measuring! / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 18 / Faculteit Wiskunde en Informatica 9-3-2010 PAGE 19
Recommend
More recommend