当前位置: 首页 > 工具软件 > modern-unix > 使用案例 >

Linux and the Unix Philosophy

何和惬
2023-12-01

Linux and the Unix Philosophy

Tenets

  1. Small is beautiful. Small things have tremendous advantages over their larger counterparts. Among these is the ability to combine with other small things in unique and useful ways, ways often unforeseen by the original designer.
  2. Make each program do one thing well. By focusing on a single task, a program can eliminate much extraneous code that often results in excess overhead, unnecessary complexity, and a lack of flexibility.
  3. Build a prototype as soon as possible. Most people would agree that prototyping is a valuable element of any project. But whereas prototyping is only a small part of the design phase under other methodologies, under Unix it is the principal vehicle for generating an effective design.
  4. Choose portability over efficiency. When Unix broke new ground as the first portable operating system of any significance, it was big news. Today portability is taken for granted as a necessity in any modern software design, an example of a tenet that has gained wide acceptance on other systems besides Unix.
  5. Store data in flat text files. The choice between portability and efficiency addresses the value of portable code. Portable data is at least as important as-if not more important than-portable code. Portable data is the often-neglected part of the portability formula.
  6. Use software leverage to your advantage. Many programmers have only a superficial understanding of the importance of reusable code modules. Code reuse helps one take advantage of software leverage, a powerful concept that some Unix developers use to create numerous applications in a comparatively short time.
  7. Use shell scripts to increase leverage and portability. Shell scripts are double-edged swords for enhancing both software leverage and portability in a design. Whenever possible, writing a script instead of a complete C program is the way to go.
  8. Avoid captive user interfaces. Some commands have user interfaces known to Unix developers as “captive” user interfaces. These prevent the user from running other commands while the command is in use, effectively making the user a captive to the system for the duration of the command. In a graphical user interface world, such interfaces would be called “modal.”
  9. Make every program a filter. The fundamental nature of all software programs is that they only modify data; they do not create it. Therefore, they should be written to perform as filters since they are filters.

Lesser tenets

  1. Allow the user to tailor the environment. Unix users like the ability to control their environment-all of it. Many Unix applications decidedly refrain from making decisions about styles of interaction and instead leave the choices to the user. The idea here is to implement mechanisms for doing things, not policies for how to do them. Let users discover their own paths to computer nirvana.
  2. 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 an operating system small. They don’t always succeed at this, but this is their goal.
  3. Use lowercase and keep it short. Using lowercase characters is a tradition in the Unix environment that has persisted long after the reason for doing so disappeared. Many Unix users today use lowercase commands and cryptic names because they want to, not because they’re forced to anymore.
  4. Save trees. Unix users generally frown on using paper listings. There are good reasons for keeping all text online and using powerful tools to manipulate it.
  5. Silence is golden. Unix commands are notoriously silent when it comes to producing detailed error messages. Although more experienced Unix users consider this a desirable trait, many users of other operating systems would beg to differ.
  6. Think parallel. Most tasks can be broken down into a series of smaller subtasks. These subtasks can then be run in parallel to accomplish more in the same amount of time as one large task. A significant amount of activity occurs around symmetric multiprocessing (SMP) designs today, an example of a general trend in the computer industry towards parallelization.
  7. The sum of the parts is greater than the whole. This tenet stems from the idea that 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.
  8. Look for the 90-percent solution. Doing 100 percent of anything is difficult. Doing 90 percent is far more efficient and cost effective. Unix developers often look for solutions that satisfy 90 percent of the target user base, leaving the other 10 percent to fend for itself.
  9. Worse is better. Unix aficionados believe that a “least common denominator” system is the one most likely to survive. That which is cheap, but effective, is far more likely to proliferate than that which is high quality and expensive. The PC-compatible world borrowed this idea from the Unix world and is making quite a go of it. The keyword here is inclusion. If something is accessible enough that it can include virtually anyone, it is better than something that presents itself as being “exclusive.”
  10. Think hierarchically. Unix users and developers prefer to organize things hierarchically. For example, the Unix directory structure was among the first tree-structured architectures applied to file systems. Unix has extended hierarchical thinking to other areas, such as network service naming, window management, and object-oriented development.
 类似资料:

相关阅读

相关文章

相关问答