Having modules, the designer still has to decide how to find them and in what order to build them. The strategies give different answers.
Function-Oriented Design
In function-oriented design, the system is seen as a set of functions that transform data. The high-level function is divided into sub-functions in a top-down manner, until each is simple enough to code. The functions share a central system state, and the structured analysis and the structure chart are used. It is simple and suits systems in which the functions are clear, but functions are tied closely to the data structures, so changes can spread widely.
Object-Oriented Design
In object-oriented design, the system is a set of objects that hold data and the operations on it. The designer finds classes, and decides their attributes, operations and relations, and the way in which they collaborate. The ideas of encapsulation, inheritance and polymorphism give reuse and a good match with the real world. Changes tend to be localised in classes. The notation used is UML.
Top-Down and Bottom-Up Design
In top-down design the design starts from the whole system and is refined into smaller parts by stepwise refinement. It gives a clear overall structure and early detection of interface problems, but the lowest-level modules are known late. In bottom-up design the lowest-level modules are designed first and are combined into larger ones. It encourages reuse of existing modules and library routines, but the overall structure may not appear until late. In practice both are mixed.
User Interface Design
The user interface is the part through which people use the system. Its quality decides how easy the system is to learn and use. The rules of good design include consistency in the look and in the behaviour, minimising the memory load of the user by showing choices instead of requiring recall, giving feedback for each action, allowing easy reversal by undo, error prevention and clear error messages, shortcuts for expert users, simplicity with a clean layout, and accessibility for all users. The types of interface are the command line, menus, forms and the graphical user interface (GUI), in which windows, icons and pointers are used. An interface is tested by trying it with real users.
Definition: User interface. The part of a software system through which users give input to it and receive its output.
Table 3.4: Function-oriented and object-oriented design
| Aspect | Function-oriented | Object-oriented |
|---|---|---|
| View | Functions on data | Objects with data and operations |
| Decomposition | By function | By class |
| Data | Shared, central | Hidden inside objects |
| Reuse | Low | High |
| Notation | DFD, structure chart | UML |
Example 3.4: Choosing the design approach
Problem: A team is building a library system and wants to reuse the classes in later projects, and changes to the rules are expected. Which design approach is better and why?
Solution:
- Reuse and localised change are important.
- Object-oriented design encapsulates data and operations in classes that can be reused.
Result: Object-oriented design is better.
Common mistakes
- Choosing function-oriented design for a system that must be reused and changed often.
- Changing the look and the behaviour of controls from screen to screen.
- Showing cryptic error messages in the interface.
Key takeaways
- Function-oriented design divides by functions, object-oriented design divides by classes.
- Top-down design refines from the whole to the parts, bottom-up builds from the parts.
- Good interfaces are consistent, give feedback and allow undo.
- A GUI uses windows, icons and pointers.
Practice questions
- Distinguish top-down and bottom-up design.
- Name three rules of good user interface design.
- What does object-oriented design divide the system into?
Answers to the practice questions
- Top-down refines the whole system into parts, bottom-up builds larger modules from the lowest-level ones.
- Consistency, feedback and easy reversal (also simplicity and error prevention).
- Classes and objects.
Sources
- Official BCA syllabus Advanced Software Engineering, course code 25BCA405DS01, Unit III
