The art of programming

The saying that programming is an art has been around for a long time. Recently, I read an article on Zhu Yun's public account (Tick Tock), "Design is Logic, Then Aesthetics". In the article, the author traveled across the ocean to pursue art, but the teacher said: "Design is not art!". If design is not art, can programming be art?

Art

So what exactly is art? I was stunned and found that I had never thought about this problem, so I had to turn to Google. The definition on Wikipedia is: "Art is an animal with intelligent thinking ability (actually only human beings at present), expressing its emotions and ideology through various forms and tools, and the resulting form is generally called art.

The teacher's point of view in the above article is:

Design is the realization of the needs of others, and art is the need for self-expression.

Similar to what Wikipedia says, the core is all about expression. The currently recognized art classification includes eight art categories: literature, painting, music, dance, sculpture, architecture, drama, and film.

What they have in common is that these are the creations of human beings since ancient times, and the youngest art category is "movie", whose works carry the author's emotions and ideology. As for all recognized art categories, it is obvious that the artistic expression form presented by their final works is more likely to be directly felt by ordinary people, and directly affects people's visual, auditory and tactile senses.

When did the concept of programming as an art get into the minds of programmers? Maybe it comes from the way we are learning programming. Many books about programming are named in the name of art, such as: "The Art of UNIX Programming", which is a book about programming.

Unix experts are creating Unix

The concept and culture formed in the process, then is technical culture art? There's another programmer's bible, The Art of Computer Programming, that we all know about but barely read. This is a set of basic books that describe algorithms and deduce and demonstrate algorithms based on mathematics. So is algorithm art?

The direct product of programming is code, and code is for programmers, not the general public. The indirect product of programming is information products. In the current information age, the forms of information products are very diverse, which can be the ones on your mobile phone.

App, or the TV you turn on every night. It is quite possible that everything related to electronics is more or less related to programming at the moment, but we found that even among these indirect products, there is not a single one that would allow us to seriously classify it as art. Even in the days of Steve Jobs, the biggest compliment we can give is that every Apple product looks like a work of art. Just like, like can be approached infinitely, but not after all.

So relatively speaking, programming is also like design to achieve the needs of others, as I am writing here, it is more about the need for self-expression. Programming is limited by the expressive ability of programming language, it is impossible to achieve the expressive ability like natural language, so the art of programming, its audience can only be programmers. Although many people do not understand the art for the public, but at least they can feel it, and the art of programming can only be felt by the programmers themselves.

Technology

A programmer's daily programming job is to write code, complete functions, and achieve the needs of others. In this process, some bugs will be accidentally created, and the programmers do not know about these bugs.

How did it change? It's like you cook at home every day, but I don't know why there are so many little strong in the kitchen. Food is also not a recognized art category, but from time to time we hear the art of food, which is very similar to the art of programming. But if you are in the process of creating gourmet food, and there are some small strongmen emerging from time to time, there is no need to feel the mind of art. Most of the time, programmers are constantly solving an endless stream of endless

Bugs, this process has nothing to do with art, but only with technology. The better the technology, the fewer bugs. Bugs are few enough that we can free up our energy and mind to feel the art of programming.

The art of programming comes from technology. Without technology, art becomes water without a source and a tree without roots. So those programming books that are named "art" are actually about technology or technical principles and culture. Of course, the most basic technology about programming is to write good code, and on how to write good code, I have read a long article "The Wisdom of Programming" written by Wang Yin before. I agree with the views, including the following aspects:

Repeatedly mulling over the code

Write elegant code

write modular code

write readable code

write simple code

Write intuitive code

Write flawless code

handle errors correctly

Correct handling of null pointers

prevent over engineering

The article is very long, but if you take a moment to read it carefully, you will definitely gain something. Among them, the point about deliberating on the code is the deepest feeling for me.

Look at the level of a writer, not by how many words he publishes, but by how much he throws away in the wastebasket.

I feel the same theory applies to programming. Good programmers delete more code than they keep.

I once maintained a project myself that included some boilerplate code, gadgets that weighed my hand, etc. Every year I take my spare time to refactor this project, some of the code is outdated with the development of technology, and some is reimplemented to be more concise. The annual review, the review of the past self, and the scrutiny of the code all brought new growth, and this process lasted about seven years.

When the technology grows to a certain stage, some programmers will not be satisfied with just fulfilling the needs of others, and will also try to express themselves in the code. The most basic and obvious expression is to sign the code and put your own label. If Lei Jun hadn't signed that piece of assembly code twenty years ago, how would we know today that it would have been written by Lei Jun, and comment here. But there are still many programmers who will not sign their own code. Even machine-generated code will be signed to say that it is automatically generated, and an unsigned code lacks the most basic element of art, "self", and will always stay in beyond the threshold of art.

skill

The art of programming alone is incomplete, programming is from technology to art. The art of programming is the flowers that bloom on the branches, and the technology is the branches and roots that support the flowers.

However, there is actually a high threshold between technology and art. Art is a kind of self-expression, but self-expression is not necessarily art. About this, let's talk about a well-known person

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326290307&siteId=291194637