The Unix Philosophy

xiaoxiao2021-03-06  53

The UNIX Philosophy: Main Principles Small is beautiful Small things could be combined with other small things to create unique and flexible systems Downside:.... People could have troubles interfacing with small things Make each program do one thing well Focusing on a single functionality can eliminate much of unnnecessary code and promote flexibility. Build a prototype as soon as possible. It allows generation of efficient design. Portability is more important than efficiency. Portable programs have larger customer base and longer lifecycle. Store data in flat ASCII files. It keeps the data portable, data which is not portable is dead. Use software leverage to your advantage. Good programmers write good code, great programmers borrow good code. Shell scripts have an advantage over compiled programs. They are portable and leverage compiled programs. Avoid Captive User Interfaces. Thase Interfaces Need Constant User Input, Thus Locking The User or Machine from doing anything else. make every program a filter that operates on data Side Principles:..... Allow the user to customize the interface Keep the system kernel small and lightweight Use lower case and keep it short Keep data in electronic format - save trees Silence is golden - do .... not produce unnecessary output Think parallel Sum of parts is greater than the whole Look and implement 90% of the solution Worse is better, least common denominator is most likely to survive Think hierarchically Source:.. M. Gancarz (1995) The UNIX Philosophy. Digital Press, Boston, Ma. ___________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

The Unix Philosophy in a nutshell

-----------------------------------

(The tenets are taken from Mike Gancarz, The Unix philosophy, Digital Press (1995). ISBN 1-55558-123-4. An excellent book which should be required reading for all software engineers! The commentaries are mine, paraphrasing Mike's in most Case.) The Major Tenets

Small is beautiful. Small Things Have Tremendous Advantages over their laconterparts. Among these is the ability to combine with other small things in unique and useful ways.

Make Each Program Do One Well. By Focusing On A Single Task, a Program CAN Eliminate Much Extraneous Code That Offen Results In Excess Overhead, Unnecessary Complexity, And a lack of flexibility.

Build a prototype as soon as possible. Most users looking for a new piece of software will not know what they really want until they see it, so requirements documents are often misleading about the users' real needs. The Unix design philosophy makes prototyping a Central Part of The Methodology: Give The user something, annhes, up-front to criticise, and work from there

Choose portability over efficiency. If today's hardware just about runs a program with just about adequate efficiency, tomorrow's will run it with power to spare. So the developer's task is to make sure his program will run on that new hardware with minimal effort.

Store data in flat ASCII files. Valuable data will generally out-live any one program, machine, programming language or use. Data is only useful as long as it's being used, and flat files help ensure that data is usable for the longest possible time .................... ..

Use software leverage to your advantage. Many programmers have only a superficial understanding of the importance of re-usable code modules. Code re-use helps one take advantage of software leverage, a powerful concept that some Unix developers use to create numerous applications in a Comparatively short time.

Use shell scripts to increase leverage and portability Scripts generate huge leverage -. Every line of script can invoke several "proper" programs each with several thousand lines of code A programmer who can not re-use other programs is condemned to re-write. Them.

Avoid captive user interfaces. A program which prevents to user using any other commands for the duration "captures" the user and prevents him from taking advantage of other commands. A program should be usable in many modalities to maximise its usefulness.

Make every program a filter. The fundamental nature of all software programs is that they can only modify data, never create it. Therefore they should be written to function as filters since they are filters. The minor tenets

Allow the user to tailor the environment No single decision will suit all users -.. So do not force one upon them The more tailorable an environment is, the more users can match it to their needs and the more they'll like it.

Make operating system kernels small and lightweight. Despite the never-ending push for new features, Unix developers prefer to keep the most central part of the operating system small. They do not always succeed at this, but this is their goal.

Use lower case and keep it short. Using the lower case is a tradition in the Unix environment that has persisted long after the reason for doing so (that it's easier to read text with descenders on a teletype) disappeared.Save trees. Data committed to Paper is Essentially Dead. There Are Good Reasons for Keeping All Text On-line and use powerful tools to manipulate it.

Silence Is Golden. A Silent Command Is Offen More Use, Providing The Function Asked for And Nothing More. You Can Always Provide Wrappers for People Who Prefer A More Conversational Tone.

Think Parallel. MOST TASKS Are Composed of Sub-Tasks Which May Be attacked in Parallel. This Also Applies To User Interacts. Parallelism CAN Save A Great Deal of Time and Frustration.

The sum of the parts is greater than the whole. A large application built from a collection of smaller programs is more flexible and hence more useful than a single large program. The same functional capability may exist in both solutions, but the collection-of- Small-programs approach is the more forward-looking of the two.

Look for the 90% solution Doing 100% of anything is difficult Doing only 90% is far more efficient and cost-effective Handle the 90% and let the 10% fend for themselves -... Often they'll handle their own special requirements Far Better Than You.

Worse is better. That Which is CHEAP But Effective Is Far More Likely to Proliferate That Which IS High Quality and Expensive. The PC-Compatible World Borrowed this IDEA and Made Quite a Go of It ....

Think Hierarchically. Hierarchies Allow Tasks and Attributes To Be Applied Uniformly Across Nested Elements. This is a Powerful Idea That Encourages Decomposition and Modularity.

转载请注明原文地址:https://www.9cbs.com/read-117583.html

New Post(0)