|
|
|
|
| Tutorial |
Very informative.You know that it has two entries, but not much more.You know the
person’s initials, but not the full name.You know the house number, but not the exact
street name.You know only part of the phone number.
Let’s look at another example:
Name Address Phone
ht5ft9in_age32_John 386 West Street, Los +1-555-304-3951
Doe_male_married Angeles, California,
USA, Earth
ht5ft6in_age27_Mary 204 East Road, Los +1-555-306-8382
Smith_female_single Angeles, California,
USA, Earth
In this example, the individual’s name includes height, age, gender, and marital status;
the address tells you not only street and city but also state, country, and even planet;
and the phone number appends country and area codes.
8 Chapter 1 Development Concepts
Is the second solution better than the first? Neither is optimal. People teach both
approaches in programming lectures, but neither is really satisfying. Defining a type
tpIntMyIntegerCounter and then declaring a variable instMyIntegerCounterInstance
for a simple for loop seems too much when you only need to traverse an array and
set all elements to zero (see Listing 1.1).
Listing 1.1 An overdose of exactness.
for ( $instMyIntegerCounterInstance = 0;
$instMyIntegerCounterInstance < MAXTPINTEGERCOUNTERRANGE;
$instMyIntegerCounterInstance++)
$instMyArrayInstance[$instMyCounterInstance] = 0;
On the other hand, working with indices called i, j, k (instead of long ones like
$instMyIntegerCounterInstance) is also unacceptable when doing complicated buffer
operations such as compression or the like.
|
|
|
|
|
|
| Link Partners: Asia florist, Flowers to India, Hong kong flowers, Site submit, Cheap web hosting, China florist, Japan florist |
|