17 principles 2 of UNIX design (Unix programming art note)

Source: Internet
Author: User

I recently studied Unix programming art. The first chapter is very good. It tells us a lot about the history and philosophical basis of Unix. The most important part is the 17 design principles mentioned. I know many principles, but I have never summarized them in such detail.

Most of the content below comes from the book "Unix programming art", which is a small part of my understanding. This is a habit of reading. I think it is important for me. I will give it out and understand it based on Deep Thinking During the typing process. Therefore, note is an auxiliary means for me to think and remember.

9. expression principle: Fold knowledge into data to make the logic simple and robust

Even though the simplest program logic makes it difficult for humans to verify, even complex data can be easily deduced and modeled for humans.

Data is easier to control than programming logic. In complex data and complex code, select the former. In the design, you should take the initiative to transfer the complexity of the Code to the data.

Rob pick's fifth principle:

Data is overwhelming. If you have selected an appropriate data structure and organized everything in a well-organized manner, the correct algorithm is self-evident. The core of programming is the data structure rather than algorithms.

10. Popular principles: interface design to avoid innovation

That is, the well-known "least surprising principle ".

The most easy-to-use program is the one that users learn the least new things.

On the other hand, it is dangerous to avoid having the same appearance but slightly different reality. It is best to make different things significantly different, rather than look almost identical.

11. Silence principle: if a program has nothing to say, it will remain silent.

"Conciseness is the core UNIX style. Important data should not be mixed in lengthy internal program behavior information ."

12. remedy principle: immediately exit when an exception occurs and provide the exception information

The software should handle all kinds of error input and running errors as easily as possible. However, if this is not done, the program can terminate the operation in a way that is easy to diagnose.

For the Protocol: it is necessary to increase the width and strictness.

13. Economic Principles: rather than spending a second on machines

A more advanced language should be used to free programmers from the burden of self-learning memory management.

14. Generation Principle: Avoid manual hack and write programs as much as possible to generate programs.

That is, to teach machines to do more low-level programming.

One Direction is DSL.

15. Optimization Principle: you must first have the original model, and learn to go before running

When optimization is too early, it will damage the design.

First, make an unoptimized, slow operation, memory consumption, but correct implementation for your design, and then make adjustments to the system, find the places where the performance can be greatly improved at the cost of minimum local conciseness.

16. Principles of diversity: never believe in the so-called "no two methods" assertions

Even the best software is often limited by the imagination of designers.

UNIX adopts a variety of languages, scalable development mechanisms, and user customization mechanisms.

17. Expansion principle: design focuses on the future, and the future is always faster than expected

A protocol or text format should be sufficiently self-descriptive for extension.

The design code is well organized to allow future developers to add new features without the need to demolish or recreate the entire architecture.

UNIX philosophy:

KISS Principle: Keep it simple, stupid!

Attitude:

If you are not sure what is right, do the least work to ensure that the task is completed until you understand what is right.

Software design is a skill.

We should constantly pursue excellence.

Do not duplicate wheels.

Make good use of tools to automate everything possible.

Next plan:

I used to roughly read this book. One of them is about UNIX operating systems. Now let's look at it in detail. It turns out to be about the Unix design philosophy, and it closely follows the above principles.

This book is very suitable for me, because I love it when I read it. So I decided to study the system recently. First, start with data-driven programming. I have some experience in this Part and can just sort it out in a systematic manner.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.