Introduction to Software Design by A.Surasit Samaisut Copyrights : All Rights Reserved
Page 2 What is “Software” “ A generic term for those components of a computer system that are intangible rather than physical. It is most commonly used to refer to the programs executed by a computer system as distinct from the physical hardware of that computer system, and to encompass both symbolic and executable forms for such programs. A distinction can be drawn between systems software, which is an essential accompaniment to the hardware in order to provide an effective overall computer system (and is therefore normally supplied by the manufacturer), and applications software specific to the particular role performed by the computer within a given organization ”
Page 3 What is Software Design? Is a process of problem-solving and planning for a software solution. Design is a problem-solving process Different from most scientific problem-solving such as finding the distance between two points. It is a wicked problem: a problem with no definitive solution Many possible solutions. May not have a single preferred solution.
Page 4 What is Software Design? After the purpose and specifications of software are determined, software developers will design or employ designers to develop a plan for solution. It includes low-level component and algorithm implementation issues as well as the architectural view.
Page 5 7 Goals of Software Design Design faces many challenges to produce a good product, but what do we mean by good? Correctness – does what it should Robustness – tolerant of misuse, e.g. faulty data Flexibility – adaptable to shifting requirements Reusability – cut production costs for code Efficiency – good used of processor and memory Reliability – error free Usability – user friendly interface
Page 6 Goal of Software Design: Correctness A primary goal, incorrect software many look good, but will be poor or worse in term of correctness. Software is correct, if it satisfies its requirements Requirements are divided into functional (what it does) and non-functional (how it does it, etc.) Sufficiency and Completeness
Page 7 Goal of Software Design: Robustness A design or implementation is robust if it is able to handle various and unusual conditions without catastrophic failure such as bad data, user error, programmer error, and environmental conditions. Robustness achieved in many ways: Data abstraction/encapsulation; simple interfaces; data corruption protected Initialize variables Qualify all inputs; precondition checking (e.g. range check) Qualify all formal parameters to a method Qualify invariants (e.g. non-null pointer, not end of file) Qualify postconditions
Page 8 Goal of Software Design: Flexibility Requirements of an application may change in many ways during or after the project implementation Aspects of flexibility Obtaining more or less of what’s already present –e.g. handle more kinds of account Adding new functionality –e.g. add internet banking to teller functionality Change functionality –e.g. allow withdrawal to create an overdraft
Page 9 Goal of Software Design: Flexibility Separation of interface and implementation Flexibility achieved in many ways: Encapsulation (representation hiding) Different types of the same base category by means of abstract classes Extend functionality by new class methods or with an abstract class & several derived classes.
Page 10 Goal of Software Design: Reusability The trend in software is to reuse parts among applications JAVA API – a large, extensive body of widely reused classes Programming library Types of reusability Object code (or equivalent) –Ex: sharing dll’s between word processor and spreadsheet Classes – in source code form –Ex: Customer class used by several applications Assemblies of Related Classes –Ex: the java.awt package Design patterns
Page 11 Goal of Software Design: Reusability Aim: cut cost of code production over one or more projects. Types of reusability Object code (or equivalent) –Ex: sharing dll’s between word processor and spreadsheet Classes – in source code form –Ex: Customer class used by several applications Assemblies of Related Classes –Ex: the java.awt package, software frameworks Design patterns
Page 12 Goal of Software Design: Reusability The trend in software is to reuse parts among applications JAVA API – a large, extensive body of widely reused classes Programming library Promoting source code reuse Use modularity –Use classes and interfaces which are independent and as general or specific as necessary Use Classes –Describe class with good name & documentation –Minimize dependency between classes –Maximally abstract and general or precisely matched to real objects and their function
Page 13 Goal of Software Design: Reusability Write good methods Cleary explain the algorithm with comments where necessary Use good names for a global use and easy to understand Specify pre + post conditions+ invariants Don’t couple closely to class
Page 14 Goal of Software Design: Efficiency Aim: make greatest use of the processing power, memory size, network speed, etc. Efficiency refers to the use of available machine cycles and memory Create designs and implementations that are as fast as required, and which make use of no more than available memory Efficiency often against with other design goal
Page 15 Goal of Software Design: Reliability An application is reliable if it is relatively fault free Clean designs make it easier for developers to produce error-free applications On architectural level can use hardware support, backup servers, multiple processors, hot swap, etc. On code level achieved by software quality assurance methods, testing, walkthroughs, formal methods etc.
Page 16 Goal of Software Design: Usability An application has high usability if users find it easy to use Usability is attained through human-interface design
Page 17 Goals of Software Design Checklist How can we tell from the code that all required functionality has been handled? correctness If the user makes a mistake, does the system crash or perform unpredictably robustness Is the system hard to modify, add or remove parts? flexibility
Page 18 Goals of Software Design Checklist Does the system execute fast enough? speed efficiency Does the system satisfy memory requirements? space efficiency Are the class usable for other applications? reusability
Page 19 Basic Design Considerations for Software Design There are many aspects to consider in the design of a piece of software. The importance of each should reflect the goals the software is trying to achieve. Some of these aspects are; Compatibility - The software is able to operate with other products that are designed for interoperability with another product. For example, a piece of software may be backward-compatible with an older version of itself. Extensibility - New capabilities can be added to the software without major changes to the underlying architecture. Maintainability - The software can be restored to a specified condition within a specified period of time. For example, antivirus software may include the ability to periodically receive virus definition updates in order to maintain the software's effectiveness.
Page 20 Basic Design Considerations for Software Design Modularity - the resulting software comprises well defined, independent components. That leads to better maintainability. The components could be then implemented and tested in isolation before being integrated to form a desired software system. This allows division of work in a software development project. Reliability - The software is able to perform a required function under stated conditions for a specified period of time. Reusability - the modular components designed should capture the essence of the functionality expected out of them and no more or less. This single- minded purpose renders the components reusable wherever there are similar needs in other designs.
Page 21 Basic Design Considerations for Software Design Robustness - The software is able to operate under stress or tolerate unpredictable or invalid input. For example, it can be designed with a resilience to low memory conditions. Security - The software is able to withstand hostile acts and influences. Usability - The software user interface must be intuitive (and often aesthetically pleasing) to its target user/audience. Default values for the parameters must be chosen so that they are a good choice for the majority of the users. In many cases, online help should be included and also carefully designed.