Date Author Purpose
12/06/1999 Bob Wilson Edits and spelling check
11/18/1999 Bob Wilson Changed folder / directory names to be
Mac and unix identical.
11/17/1999 Bob Wilson Initial release.
Taking three evening, programming courses, PDP-8 assembler, Basic, and Cobol, in one semester revealed the six-step, structure to rapidly master any computer language. This course teaches "c" using that structure and A Book on C (Al Kelley, Ria Pohl, Addison-Wesley, Fourth Edition, Reading, 1998).
Key to rapid language mastery is a good language reference that includes both the language and the common library routines. The bold-text, reading assignments are there to identify where specific answers can be found for the programming assignments. Memorization of the reading assignments is not as important as understanding where to find the answers and practicing programming.
Six Fundamental Programming Concepts
All programming languages have six fundamental elements that are used to make a functioning program. Regardless of the book, web page, or instructional material, these six elements have to mastered and their details located in the reference book:
All programs start and will stop, if nothing else, when power is removed. Part of "Start-Stop" is making a source file, compiling, linking, and running under the operating system.
The primary reason for writing a program is to do something to some numbers or data. Using the debugger, we will examine the different types of data and modify their contents.
This is where programs begin to do something useful and programs begin to get interesting.
Programs need someway to get data in and out of the program and this is where we write programs that do not need the debugger.
Transfer of control
One of the most powerful features of a program is the ability to repeat operations over and over and over again.
Subroutine transfer of control
Subroutines are how we write routines that are able to be used as if they were extensions of the original language. More importantly, it is how to find "handy dandies" and not recode the world.
The Art of Programming
Prolific programmers, in addition to working hard, have coding styles that give them advantages. This course will emphasize these programming productivity techniques as we work on the following exercises:
- Smallest possible program
- The calculator
- CGI program shell
- The four function calculator
A program is properly written if just based upon the comments, an identically functioning program can be written by another programmer. Comments are written for people and do not simply restate what the language is doing but rather the intent of the statement. As such, these are not negotiable:
- All programs will start with a comment block containing the name, interfaces, and purpose of the program
- Unless a source control system is being used, all program headers will have a change control log
- Each comment is written in English sentences that begin with a capital letter and end with a period
- All blocks of code will fit on one or two printed pages
- Indentation will be done only with a "pretty printer" utility
- Absent a "pretty printer" utility, the beginning of a block of code will be preceded by a blank line
- Absent a "pretty printer" utility, the end of each block of code will be followed by a blank line
- Programmers review each other's work
- To pickup neat tricks
- To offer neat tricks
- So everyone can get done sooner and get a better job
- We will have a multi-day, program design session
- We will discuss documentation and user interfaces
Algorthms is the art of deciding which logic that should be used for different tasks. A college course on data structures can provide most of what is needed but we will hit some of these under
Subroutine transfer of control: