How music and drawing taught me how to program
From the translator: Sijiang Yang, programmer from New York, tells r3r3280. about how art helps him practice coding.
Programming is akin to art. At the same time, other types of art, in particular, music and drawing, can teach a programmer a lot. I hope that they will help you just as they helped me in due time.
Skillbox recommends: Two-year practical course “I am a PRO web developer” .
We remind you: 3r3334. for all readers of "Habra" - a discount of 1?000 rubles when writing to any Skillbox course using the promo code "Habr". 3r3335.
Focus on the basics of r3r3258.
What do we learn?
If you like algorithms, I mean, really like, like the fact that early in the morning you immediately begin to engage in recursion and segment trees, congratulations. You are a pure programmer. But we, the rest, are ordinary people, sometimes we ask ourselves: why solve these puzzles? Only to successfully pass the interview?
In fact, when you practice something, you need to understand why you are doing it. Want to acquire certain skills? Or strengthen weaknesses?
I believe that all these puzzles for programmers not only provide specific knowledge, but also better understand the basic elements of the process of creating and writing code. Get or improve basic skills.
As for the puzzles, they are needed not to solve a problem, but to study the process of finding a solution. These are different things.
What do you do with a problem - break it into small parts? What helps you to improve your level? What is the difference between some database structures and others? Basic skills are akin to the basic harmonics on which the sonata is built.
What do experienced professionals know?
I would say that an experienced artist does not know how to paint Central Park in New York in the fall. But he knows the basics that are needed to create a picture. Using them, he paints a landscape, and as a result it turns out an amazingly beautiful picture.
An experienced artist does not know how to draw leaves on trees. No, he is fluent in colors and their combinations. He knows how colors behave on the canvas.
So an experienced programmer doesn’t have to know all the nuances of React, Vue, Ember or other frameworks. An experienced programmer knows how jаvascript works and how a browser works. An experienced programmer understands the benefits of functional programming, he knows why, in a particular case, it is necessary to put React at the forefront.
Learn the basics, and everything above will form a clear picture by itself.
Sketches from the life of
Copypast vs source
My familiar artists who are serious about their craft, always make sketches of life. What does it mean? They draw everything they see, everything that interests them.
They do not draw a photo or model, but draw what they themselves see.
When someone sketches a landscape from someone's picture, he does not invent, but copies. In programming, the equivalent of this behavior is copy-snippets with Stack Overflow.
Copy-paste code will never give you the opportunity to get fundamental knowledge. Copying someone's code has a similar meaning: you get a solution, but not experience. Win a battle, but lose the war.
Fundamental knowledge can be called universal. If you try to solve the problem yourself, you are mistaken, and in the end you find a solution, then you get just such knowledge. You learn the principles of work that can be used in future projects.
Rarely solutions are common when “one size fits all.” In order to get the keys to different locks, you have to work. Sometimes it is useful to do the work without the influence of someone else's decision, independently.
When a musician studies a work, he does not just try to play it from beginning to end, again and again, thousands of times. He searches for weaknesses in his work and liquidates them.
Otherwise, the performance will be far from ideal, contain the wrong notes (in the case of programming - bugs).
And although blind repetition is not the best way to learn something, purposeful repetition allows you to get the right experience. You work on your weak points and get better.
And for a beginner and blind repetition is useful. It develops muscular memory, which in the case of programming can be considered cognitive abilities. After that, you can move on to complex works.
If you are new to using any framework, practice it. Learn its basic elements, create something basic.
Select a port, create a route, send a request and respond. Then repeat this.
When the musician finishes studying the difficult part of the work, he does not shake hands and does not speak for himself: aha, well, this is finished. No, he repeats it to eliminate the possibility of an error.
It’s the same thing with a programmer: if you write a complex program, solve a problem, you can skip the simplest error in the syntax, after which the whole mechanism will refuse to work. We'll have to look for a problem. If, however, to work out the syntax to automatism, the likelihood of a problem decreases.
Then you do not have to worry. A musician who has brought his skills to automatism will not be worried about the reproduction of individual notes of the concert. It focuses on the melody as a whole, and not on its individual elements.
Learning and outline 3r3r5858.
An example of da Vinci
If you have ever studied the work of really great artists, for example, Leonardo da Vinci, then you probably know how many sketches, sketches, and training canvases they made. Leonardo was famous for his attention to detail - he made sketches of body parts, plants, animals, people and their groups.
Novice artists also practice a lot, for example, they constantly paint still lifes. But why, because they are not nerds? No, this is all targeted training. Beginners gain experience and knowledge in working with color, light and shade.
Some programmers work in a similar way, breaking one big problem into several small ones and then working on them all.
Book sketches programmers
How can you remember this function, in what context is it used? Do I need to call super () in every component of React or is it worth learning a bit about ES6 classes? How to integrate asynchronous HTTP requests?
You can understand all this by opening Repl or JSBin. Small studies can deepen the understanding of more common things, learn how to work with large projects.
When an artist draws an apple or a tree, this does not mean that a particular object is of interest to him. He simply works a little to use experience on the big.
Look at the hands of Gioconda - they are perfect in terms of technology.
Portraits and trees addiction
I think that the main task of many ends (including programmers) is composition. It is about how to combine the particular into a whole in such a way that it is a masterpiece.
There are several methods to achieve this. One of them is to start with a layer with a minimum of dependencies. And already from this base layer go up.
If you draw an analogy with the artist, he does not start with the eyelashes. It starts with a primer. The same eyelashes, their location depends on the shape and size of the eyelid. The eyelid is dependent on the size and position of the eyeball, which, in turn, is associated with the peculiarities of the structure of the skull. The whole portrait, if we are talking about a portrait, is a multitude of dependencies.
If one element is positioned incorrectly, the impression of harmony and integrity disappears. The same with the software project. Having made one mistake, you start to produce entities that spoil all the work.
Layer by layer
When you create a full-stack application, take care of the data layer. Do the tests. Check all items. Only in this case, you can be sure of the reliability of the entire project. But initially it is necessary to understand its essence and see the whole picture. If you have an understanding, you can work on the details.
Coders - coding 3r3r5858.
To each his own. Musicians - music, artists - paintings. Programmers - code. We started the article with the words that the work of a programmer is also an art. And indeed it is. It is worth remembering only that skill can and should be improved by practicing, studying and researching. With the help of practice, novice programmers will be able to focus on the basics, improve their creations and eventually create a cool project, as big as the creator’s ambitions.
Online course "Profession frontend developer"
Practical course PRO Mobile Developer .
Practical annual course "PHP developer from 0 to PRO" .