[Reading Notes] linux programming Art

Source: Internet
Author: User

I. Philosophy

1. Rule of Modularity: Write simple parts connected by clean interfaces.
1. Module principle: Try to use concise interface sets and simple components.
2. Rule of Clarity: Clarity is better than cleverness.
2. Clear principle: Clear is better than clever.
3. Rule of Composition: Design programs to be connected to other programs.
3. Combination Principle: Connection and combination should be considered during design.
4. Rule of Separation: Separate policy from mechanic; separate interfaces from engines.
4. separation principle: the policy and mechanism are separated, and the interface is separated from the engine.
5. Rule of Simplicity: Design for simplicity; add complexity only where you must.
5. Concise Principle: The design should be as concise as possible, and the complexity should be lower.

6. Rule of Parsimony: Write a big program only when it is clear by demonstration that
Nothing else will do.
6. stingy principle: Do not write large programs unless you have no other choice.
This point is similar to the 5th point. It is concise and beautiful. Do not deliberately write large and complex programs.

7. Rule of Transparency: Design for visibility to make inspection and debugging easier.
7. transparency principle: the design should be transparent and visible for review and debugging.
Fully consider transparency, visibility, and conciseness.

8. Rule of Robustness: Robustness is the child of transparency and simplicity.
8. Robust principle: robust programs are transparent and concise.
The more concise and transparent the program is, the more robust the program is.

9. Rule of Representation: Fold knowledge into data so program logic can be stupid and
Robust.
9. expression (method) Principle: Fold knowledge into data in order to make the logical structure simple and robust.
Modeling to make the logical structure clear.

10. Rule of Least Surprise: In interface design, always do the least surprising thing.
10. Popular principles: interface design to avoid unconventional design.
The quality of a program is determined by the user. The most simple and easy-to-use program is often the most popular program.

11. Rule of Silence: When a program has nothing surprising to say, it shoshould say nothing.
11. The principle of Silence: if a program is not so picky, keep silence.
The program should not have redundant parts, as concise as possible, do not have unnecessary features.

12. Rule of Repair: When you must fail, fail noisily and as soon as possible.
12. remedy principle: if an exception occurs, exit immediately and provide sufficient error information.
Try to terminate the program in a way that is easy to diagnose.

13. Rule of Economy: Programmer time is expensive; conserve it in preference to machine
Time.
13. Economic Principle: I would rather spend more time on machines than a programmer's second.
Keep in mind that the programmer's time is precious and do not waste 1 minute 1 second without reason.

14. Rule of Generation: Avoid hand-hacking; write programs to write programs when you can.
14. Generation Principle: Avoid manual hack, write programs as much as possible, and let programs generate programs.
The simpler the program specification, the easier it is for designers to do the right.

15. Rule of Optimization: Prototype before polishing. Get it working before you optimize it.
15. Optimization Principle: A model must be created before engraving, and a model should be learned before running.
Create a prototype first, and then refine your work. Before optimization, make sure that it can be used. Otherwise, all the wonderful optimizations are useless.
Or, as Kent Beck, the extreme programming master, said, "run first, then correct, and finally fast.

Do not blindly consider the so-called Efficiency Improvement of the pros, and try not to optimize it early. It is the root of all evil.

16. Rule of Diversity: Distrust all claims for "one true way ".
16. Principles of diversity: never believe in the so-called "no second law.
Even the best software is often limited by the imagination of designers.
Einstein once said that what the world lacks is not technology, but imagination.

No one is smart enough to arrange everything in advance.

17. Rule of Extensibility: Design for the future, because it will be here sooner than you
Think.
17. Expansion principle: design focuses on the future, because sometimes the future comes faster than imagined.

Ii. History-Dual-stream recording

In 1983, Richard M. Stallman created the GNU project.

In 1986, larry wall of patch began to develop the Perl language.

At first, unix systems were controlled by AT&T sun ibm, and a source code License costs $40 thousand.

On March 13, 1991, linus torvalds announced the linux project.

Released in December 1992

Among the unix developers of the old school, some bright people noticed that after years of low-price Unix dream, they quietly entered the city in an unexpected direction.

It is neither from AT&T nor SUN, nor from any traditional manufacturer, nor from an organized academic work. In this way, it jumped out of the stone seams of the Internet, and naturally formed itself, re-planning and assembling the traditional elements of Unix in an amazing way.

Hacker's origin and history: 1961-1995

From a social perspective, they are young, talented, almost all male, dedicated to programming, and never stick to the rules-they were called "geek )". They are also fluffy hippies and quasi-hippies. They have foresight to regard computers as tools to build communities. They read books from Robert Heinlein and J. RR. Tolkien and participated in the RegEx society. They have never been completely deprecated. Aside from these quirks, many of them are among the smartest programmers in the world.

In 1995, linux found its killer application-open-source web server Apache

Use free software because it runs better, instead of saying, "use free software because all software should be free"

"Open-source" obviously uses an ideology-neutral public tag to replace Stallman's favorite "free software"

In Unix History, the greatest rule is: The Closer open source is, the more prosperous it is.

Over-reliance on any technology or business model is wrong-on the contrary, maintaining the flexibility of the Software and Its Design traditions remains the way. Don't compete with low-price and flexible solutions.

Iii. Comparison between unix philosophy and other philosophy

The concept or symbol of unix uniformity is the most important: the "Everything is a file" model and the pipeline concept established on this basis.

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.