Geek Logbook

Tech sea log book

The element of programming style

When the book saw the lights, programming wasn’t as important as today. But, some of the ideas around the style of writing are a worth to notice and to know it. For that reason reading the book written by Brian Kernighan and P. J. Plauger are a constant invitation to revisit the way we code,

The elements of programming style: Epilogue

Epilogue There are many good books on languages, algorithms and numerical methods available to those who want to learn programming in greater depth. Our goal was not to teach languages or algorithms, but to teach you to program well.  Programmers have a strong tendency to underrate the importance of good style. Eternally optimistic, we all

The elements of programming style: Documentation

Chapter 8: Documentation The best documentation for a computer program is a clean structure. It also helps if the code is well formatted, with good mnemonic identifiers and labels (if any are needed), and a smattering of enlightening comments. Flowcharts and program descriptions are of secondary importance; the only reliable documentation of a computer program

The elements of programming style: Efficiency and instrumentation

Chapter 7: Efficiency and instrumentation Machines have become increasingly cheap compared to people; any discussion of computer efficiency that fails to take this into account is shortsighted. “Efficiency” involves the reduction of overall cost – not just machine time over the life of the program, but also time spent by the programmer and by the

The elements of programming style: Common Blunders

Chapter 6: Common Blunders A major concern of programming is making sure that a program can defend against bad data. But even with correct data, there is no guarantee that a program will work. In this chapter we will discuss other aspects of making software reliable. Let us summarize the main lessons of this chapter.

The elements of programming style: Input and output

Chapter 5: Input and output Input/output is the interface between a program and its environment. Two rules govern all I/O programming: NEVER TRUST ANY DATA, and REMEMBER THE USER. This requires that a program be as foolproof as is reasonably possible, so that it behaves intelligently even when used incorrectly, and that it be easy

The elements of programming style: Program Structure

Chapter 4: Program Structure Most programs are too big to be comprehended as a single chunk. They must be divided into smaller pieces that can be conquered separately. That is the only way to write them reliably; it is the only way to read and understand them.  Subroutines, functions, and procedures are the “modules,” or

The elements of programming style: Control Structure

Chapter 3: Control Structure A computer program is shaped by its data representation and the statements that determine its flow of control. These define the structure of a program. There is no sharp distinction between expression and organization.  The control structures of a language provide the framework of a program. These include decision-making with IF

The elements of programming style: Expressions

Chapter 2: Expressions Writing a computer program eventually boils down to wanting a sequence of statements in the language at hand. How each of those statements is expressed determines in large measure the intelligibility of the whole; no amount of commenting, formatting, or supplementary documentation can entirely replace well expressed statements. After all, they determine

The elements of programming style: Don’t Be Too clever

Preface to the Second Edition The practice of computer programming has changed since The Elements of Programming Style first appeared. Programming style has become a legitimate topic of discussion. After years of producing “write-only code,” students, teachers, and computing professionals now recognize the importance of readable programs. There has also been a widespread acceptance of