Bruce J. MacLennan’s Programming Language Design Principles
This page is a mirrored copy of an article originally posted on the (now sadly defunct) LShift blog; see the archive index here.
Sat, 24 June 2006
As far as I can tell, no-one on the web has yet summarised in a single page all of the design principles MacLennan develops in his excellent Principles of Programming Languages (2nd edition, 1986, ISBN 0-03-005163-0): so here they are. I hope they’re as useful to others as they have been to me.
- Abstraction: Avoid requiring something to be stated more than once; factor out the recurring pattern.
- Automation: Automate mechanical, tedious, or error-prone activities.
- Defense in Depth: Have a series of defences so that if an error isn’t caught by one, it will probably be caught by another.
- Information Hiding: The language should permit modules designed so that (1) the user has all of the information needed to use the module correctly, and nothing more; and (2) the implementor has all of the information needed to implement the module correctly, and nothing more.
- Labeling: Avoid arbitrary sequences more than a few items long. Do not require the user to know the absolute position of an item in a list. Instead, associate a meaningful label with each item and allow the items to occur in any order.
- Localised Cost: Users should only pay for what they use; avoid distributed costs.
- Manifest Interface: All interfaces should be apparent (manifest) in the syntax.
- Orthogonality: Independent functions should be controlled by independent mechanisms.
- Portability: Avoid features or facilities that are dependent on a particular machine or a small class of machines.
- Preservation of Information: The language should allow the representation of information that the user might know and that the compiler might need.
- Regularity: Regular rules, without exceptions, are easier to learn, use, describe, and implement.
- Security: No program that violates the definition of the language, or its own intended structure, should escape detection.
- Simplicity: A language should be as simple as possible. There should be a minimum number of concepts, with simple rules for their combination.
- Structure: The static structure of the program should correspond in a simple way to the dynamic structure of the corresponding computations.
- Syntactic Consistency: Similar things should look similar; different things different.
- Zero-One-Infinity: The only reasonable numbers are zero, one, and infinity.
Comments
On 20 October, 2006 at 5:40 pm,
wrote:On 29 October, 2006 at 9:36 am,
wrote:Thanks, it came so handy to me! I’m designing Programming Languages course Midterm exam, and I was missing a list of Mac-Lennan’s Principles!
Great work - i took a course in college that used this book and i’ve not been able to find this list on the web until now!!