The Philosophical Programmer by Daniel Kohanski

The Philosophical Programmer by Daniel Kohanski

Author:Daniel Kohanski
Language: eng
Format: epub
ISBN: 9781466878792
Publisher: St. Martin’s Press


14

A SHORT COMMENTARY

Ultimately, binary is the only language the computer understands. All other computer languages—even assembly language—are poised at the boundary between human and machine and are in some form an attempt to improve communications between them. But the languages through which we instruct the computer are, in all cases, highly circumscribed. We do not use the same language or the same forms of language in programming that we use when speaking to another person. Computer languages are compact, they have rigid formulations and precise syntax, and the very structures which make them comprehensible to a computer also make them obscure to a human being.

From a programmer’s perspective, then, the single most important type of statement in a computer language is the comment. A comment is text embedded in the source code which is marked in such a way that it will be ignored by the compiler. In FORTRAN, a “C” in the leftmost position (a holdover from the days of punched cards) means this is a comment line; in COBOL, an asterisk in this same column does the job. In C and JAVA, anything between /* and */ is a comment, and this may be any text from a few words on the same line as the code to a whole paragraph or page. Assembly languages sometimes use a semicolon; from that character up to the end of the line is all text that the assembler will ignore.

But while it is of no concern to the compiler or assembler, the comment is crucial to the programmer. The comment is the part of the program that communicates not to the machine but to human beings, both the ones who wrote the code and the ones who will follow after. It must at all times be borne in mind that the source code that makes up a program is written as much for living people as it is for the machine. We are the ones who give the machine its instructions, and we are the ones who must take responsibility for our commands; therefore, we must be absolutely clear about what it is we are saying.

One might think that professional programmers, being fluent in the languages and techniques, need less explanation than an amateur or beginner, but this is not the case. Every programmer has certain idiosyncratic ways of doing things, and assumptions and methods that seem “obvious” at the time the code was written are very often unclear to another programmer on the same team, or even to the original programmer a few months later, when the code must be revisited for correction or modification. Every programming task also has hidden quirks and requirements; again, these may be obvious at the time, but who will remember all the details once the initial work is done and it is time to move on to another phase?

In the early days of programming, comments were often few and far between. There was simply too much work to be done too fast, the code



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.