1.Introduction
Lecture_1 软件设计思路与面向对象的好处
Qualities of a well designed software
-
Correctness 正确性
The degree with which software adheres to its specified requirements .
At the start of the software life cycle, the requirements for the software are determined and formalized in the requirements specification document.
Well designed software should meet all the stated requirements.
While it might seem obvious that software should be correct, the reality is that this characteristic is one of the hardest to assess. -
Maintainability 可维护性(Requirement change affects few modules)
Maintenance accounts for nearly 70% of the cost of the software life cycle
The ease with which changes can be made to satisfy new requirements or to correct deficiencies.
Well designed software should be flexible enough to accommodate future changes that will be needed as new requirements come to light. -
Reusability 可重用性
The ease with which software can be reused in developing other software. By reusing existing software, developers can create more complex software in a shorter amount of time. -
Reliability 可靠性
The frequency and criticality危机程度 of software failure, where failure is an unacceptable effect or behavior occurring under permissible operating conditions
Thefrequency of software failure
is measured by the average time between failures.
Thecriticality of software failure
is measured by the average time required for repair.
Ideally, software engineers want their products to fail as little as possible (i.e., demonstrate high correctness) and be as easy as possible to fix (i.e., demonstrate good maintainability). -
Portability 可移植性
The ease with which software can be used on computer configurations other than its current one
Good software products can have a life of many years more than hardware.
Porting software to a new computer configuration may be less expensive than developing analogous相似的 software from scratch白手起家. -
Efficiency 效率
The degree with which software fulfills its purpose without waste of resources
Efficiency is a multifaceted多层面的 quality characteristic and must be assessed with respect to a particular resource such as execution time or storage space.
A good design is Modular
- Decomposable 可分解的
can be broken down into pieces - Composable 可组合的
Pieces are useful and can be combined - Understandable 可理解性
One piece can be examined in isolation - Has continuity连续性 Requirement changes affects few modules
- Protected / safe 保护性
An error affects few other modules
Object Oriented
Object-oriented programming
is
a method of implementation in which
programs are organized as cooperative collections of objects,
each of which represents an instance of some class,
and whose classes are all members of a hierarchy of classes united via inheritance relationships.
Analogy
类比: object-oriented programming is a way of structuring software systems analogous to a biological system, with “cells” (we call “objects”) that hide their internals, and communicate with other objects via a kind of signalling mechanism (which we call “messaging”).
Objects – Software Objects
Fundamental building blocks are object, not use algorithms or procedures
Perform task – collect data
Objects “talk” to one another
Components of an overall system.
Typical program organization:
Classes
: each object is an instance of some class
Inheritance
: classes are related to one another via inheritance relationships
Hierarchies
层次结构
Code Reuse
Approach Benefits
Faster Development
Ease of Use
Extendibility
Reuse
Rapid Prototyping
Design Patterns – “Building Blocks”