Download Growing Better Software
Transcript
46
Growing Better Software
3.2 Beware of N instead of many
All diagrams in the world won’t prevent us from solving problems
for a fixed number of entities, rather than for ’many’ of them.
This is a common mistake, which we should be aware of when
designing a system.
This mistake manifests itself in data structures that have several
fields or properties that represent essentially the same type of
information, for instance:
class person
{
date birthdate;
string name;
person child1;
person child2;
person child3; /* fixed maximum of 3
children */
}
We can’t iterate these properties with a loop4; this means we will
need to write several pieces of code, one to deal with each
property. Changes in one piece of code imply the others need to
be updated as well. In other words, solving a problem for a fixed
number of entities rather than 1 or many will increase
maintenance. It also creates an unnecessary logical limitation in
our system.
4 Some objectoriented languages provide a workaround by allowing access
to RunTime Type Information. This will however disallow us to find
certain problems as early as in compile time.
Related documents
Database driven user friendly web application using Ajax
Using the TV`s Features
Deliverable 5.2 - Evaluation of Core Framework
Administrator`s Guide
ThaiEasyElec - 2.8-inch TFT Touch Shield -EN
Java booking system - School of Computing
Digital Solutions
RCA F27350 Flat Panel Television User Manual
Model AC8000-8001-8001.1 Updated 2009 Manual
STP 55-88N14-SM-TG
HD24tools manual ()