Software Design
Software Design
1
5) Design is Non-Deterministic:
Design is never a deterministic process. They can change by themselves or they
can change according to the requirements. There’re many ways to design a
computer program. If you send three people away to design the same
program, they can easily return with three vastly different designs, each of
which could be perfectly acceptable.
7) Design Is Emergent:
Design being emergent means that they don’t spring fully from someone’s
brain. They evolve and improve through design reviews, informal discussions,
experience writing the code itself, and experience revising the code itself.
1) Managing Complexity:
Managing complexity is the most important technical topic in software
development. Projects fail most often because of poor requirements, poor
planning, or poor management. But when projects do fail for reasons that are
primarily technical, the reason is often uncontrolled complexity.
2
An inappropriate, complex solution to a complex problem
There are two ways to manage complexity:
Minimize the amount of essential complexity that anyone’s brain has to
deal with at any one time.
Keep accidental complexity from needlessly proliferating
Once we did both things, many design considerations are much more
straightforward.
3
vi) Low fan-out:
Low fan-out means having a given class use a low number of other classes. In
other words, Low fan-out means that we shouldn’t have too many unnecessary
classes in our code.
vii) Portability:
Portability means designing the system so that you can easily move it to
another environment.
viii) Stratification:
Stratification means design the system in a way so that you can view it at one
level without dipping into other levels of decomposition.
ix) Standard techniques:
Try to give the whole system a familiar feeling by using standardized, common
approaches.
3) Levels of Design:
Design is needed at several different levels of detail in a software system.
Some design techniques apply at all levels, and some apply at only one or two.
4
Level 1: Software System:
The first level is the entire system. Some programmers jump right from the
system level into designing classes, but it’s usually beneficial to first organize
system into subsystems or packages.
Level 2: Division into Subsystems or Packages:
The major design activity at this level is deciding how to partition the program
into major subsystems. The subsystems can be big—database, user interface,
business logic, command interpreter, report engine, and so on. Some kinds of
subsystems appear time and again in different systems are discussed following.
Business logic
Business logic is the real-world laws, regulations, policies, and
procedures that you encode into a computer system.
User interface:
Create a subsystem to isolate user-interface components so that the
user interface can evolve without damaging the rest of the program.
Database access:
By creating database sub-system we can hide implementation details of
accessing a database
5
Level 3: Division into Classes
Design at this level includes identifying all classes in the system. Level 3, shows
how one of Level 2’s subsystems might be divided into classes. For example, a
database-interface subsystem might be further partitioned into data access
classes.
Level 4: Division into Routines:
Design at this level includes dividing each class into routines. A routine is a
sequence of code that is intended to be called and used repeatedly during the
execution of a program. This makes the program shorter and easier to write.
Level 5: Internal Routine Design:
Design at the routine level consists of laying out the detailed functionality of
the individual routines.
7
Here are a few areas that are likely to change:
Business logic – Business rules tend to be the source of frequent software
changes.
Hardware Dependencies – You may need to make changes if you move to a
new hardware environment. Examples of hardware dependencies include
interfaces to screens, printers, keyboards, disk drives, sound facilities etc.
Input and output – At a slightly higher level of design than raw hardware
interfaces, input/output is a volatile area.
Difficult design and construction areas -– It’s a good idea to hide difficult
design and construction areas because they might be done poorly and you
might need to do them again.
Status variables – Status variables indicate the state of a program and tend to
be changed more frequently than most other data.
Kinds of coupling:
Simple-data-parameter coupling – Two modules are simple-data-parameter
coupled if all the data passed between them are of primitive data types and all
the data is passed through parameter lists.
8
Simple-object coupling – A module is simple-object coupled to an object if it
instantiates that object.
Object-parameter coupling – Two modules are object-parameter coupled to
each other if Object1 requires Object2 to pass it an Object3.
Semantic coupling – Semantic coupling occurs when one module makes use,
not of some syntactic element of another module, but of some semantic
knowledge of another module’s inner workings.