Contents
3
4.1 Choice of Programming Language
4
4.2 Programming Conventions
5
4.3 Your Location on the Technology Wave
6
4.4 Selection of Major Construction Practices
7
Related Topics
8
Upstream prerequisites: Chapter 3
9
Determine the kind of software you’re working on: Section 3.1
10
Formality needed with programs of different sizes: Chapter 27
11
Managing construction: Chapter 28
12
Software design: Chapter 5, and Chapters 6 through 9
13
Once you’re sure an appropriate groundwork has been laid for construction,
14
preparation turns toward more construction-specific decisions. Chapter 3
15
discussed the software equivalent of blueprints and construction permits. You
16
might not have had much control over those preparations, and so the focus of
17
that chapter was on assessing what you’ve got to work with at the time
18
construction begins. This chapter focuses on preparations that individual
19
programmers and technical leads are responsible for, directly or indirectly. It
20
discusses the software equivalent of how to select specific tools for your tool belt
21
and how to load your truck before you head out to the jobsite.
22
If you feel you’ve read enough about construction preparations already, you
23
might skip ahead to Chapter 5.
24
4.1 Choice of Programming Language
25
By relieving the brain of all unnecessary work, a good 26
notation sets it free to concentrate on more advanced 27
problems, and in effect increases the mental power of the race. 28
Before the introduction of the Arabic notation, multiplication 29
was difficult, and the division even of integers called into play 30
the highest mathematical faculties. Probably nothing in the 31
modern world would have more astonished a Greek 32
mathematician than to learn that ... a huge proportion of the 33
population of Western Europe could perform the operation of 34
division for the largest numbers. This fact would have seemed 35
to him a sheer impossibility.... Our modern power of easy 36
reckoning with decimal fractions is the almost miraculous 37
result of the gradual discovery of a perfect notation. 38
—Alfred North Whitehead 39
The programming language in which the system will be implemented should be
40
of great interest to you since you will be immersed in it from the beginning of
41
construction to the end.
42
Studies have shown that the programming-language choice affects productivity
43
and code quality in several ways.
44
Programmers are more productive using a familiar language than an unfamiliar
45
one. Data from the Cocomo II estimation model shows that programmers
46
working in a language they’ve used for three years or more are about 30 percent
47
more productive than programmers with equivalent experience who are new to a
48
language (Boehm, et al 2000). An earlier study at IBM found that programmers
49
who had extensive experience with a programming language were more than
50
three times as productive as those with minimal experience (Walston and Felix
51
1977).
52
Programmers working with high-level languages achieve better productivity and
53
quality than those working with lower-level languages. Languages such as C++,
54
Java, Smalltalk, and Visual Basic have been credited with improving
55
productivity, reliability, simplicity, and comprehensibility by factors of 5 to 15
56
over low-level languages such as assembly and C (Brooks 1987, Jones 1998,
57
Boehm 2000). You save time when you don’t need to have an awards ceremony
58
every time a C statement does what it’s supposed to. Moreover, higher-level
59
languages are more expressive than lower-level languages. Each line of code
60
says more. Table 4-1 shows typical ratios of source statements in several high-
61
level languages to the equivalent code in C. A higher ratio means that each line
62
of code in the language listed accomplishes more than does each line of code in
63
C.
64
Table 4-1. Ratio of High-Level-Language Statements to Equivalent C
65
Code
66
Language Level relative to C
C 1 to 1 C++ 1 to 2.5 Fortran 95 1 to 2 Java 1 to 2.5 Perl 1 to 6 Smalltalk 1 to 6 SQL 1 to 10 Visual Basic 1 to 4.5
Source: Adapted from Estimating Software Costs (Jones 1998) and Software Cost 67
Estimation with Cocomo II (Boehm 2000). 68
Data from IBM points to another language characteristic that influences
69
productivity: Developers working in interpreted languages tend to be more
70
productive than those working in compiled languages (Jones 1986a). In
71
languages that are available in both interpreted and compiled forms (such as
72
Visual Basic), you can productively develop programs in the interpreted form
73
and then release them in the better-performing compiled form.
74
Some languages are better at expressing programming concepts than others. You
75
can draw a parallel between natural languages such as English and programming
76
languages such as Java and C++. In the case of natural languages, the linguists
77
Sapir and Whorf hypothesize a relationship between the expressive power of a
78
language and the ability to think certain thoughts. The Sapir-Whorf hypothesis
79
says that your ability to think a thought depends on knowing words capable of
80
expressing the thought. If you don’t know the words, you can’t express the
81
thought, and you might not even be able to formulate it (Whorf 1956).
82
Programmers may be similarly influenced by their languages. The words
83
available in a programming language for expressing your programming thoughts
84
certainly determine how you express your thoughts and might even determine
85
what thoughts you can express.
86
Evidence of the effect of programming languages on programmers’ thinking is
87
common. A typical story goes like this: “We were writing a new system in C++,
88
but most of our programmers didn’t have much experience in C++. They came
89
from Fortran backgrounds. They wrote code that compiled in C++, but they were
90
really writing disguised Fortran. They stretched C++ to emulate Fortran’s bad
91
features (such as gotos and global data) and ignored C++’s rich set of object-
oriented capabilities.” This phenomenon has been reported throughout the
93
industry for many years (Hanson 1984, Yourdon 1986a).
94