One language to rule all
- Transfer
Hidden under a layer of code languishes a language eager to be learned.
At the time of this writing, the query “programming which language to learn first” produces 517 million search results. Each of these sites will praise one particular language, and 90% of them will eventually recommend Python or JavaScript.
Without long preludes, I would like to officially declare that all these 517 million sites are wrong and state that the language that must be studied first is fundamental logic .
Just knowing how to code is not enough. The market is so saturated with graduates of institutes and courses that the position of a junior almost ceased to exist *. To succeed in today's world, you must both code and have advanced fundamental logical thinking.
* hereinafter, please remember that this is a translation, and the situation on the labor market for the author and in your country may be different (like other nuances), which, however, does not in itself make the original article worse - approx. perev.
My first computer science lesson
My first acquaintance with computer science was an elective, which I took in 10th grade. On the very first day, going into the audience, I was delighted to see a large number of ice-cream buckets and various toppings in front of me. After everyone was seated, the teacher proclaimed:
“Today we will taste the self-prepared ice cream. But with one condition: you must make a list of specific instructions on how to prepare a dessert, and I will follow them. ”
No problem, I thought, this lesson will not be long. About a minute later, I sketched a great recipe for the ice cream of my dreams:
- Scoop up and put three balls of raspberry ice cream in a bowl
- Open chocolate sauce and add two tablespoons to the same bowl.
- Add whipped cream to a bowl
- Sprinkle it all with sugar sticks and put the cherry on top
My teacher, the “computer” in this nice metaphor, played a more sarcastic literal performance than I had ever seen before. She began to zealously poke a bucket of ice cream with a spoon for balls, without even touching the lid.
“Good, good, but first you need to open it!” - I exclaimed, trying to get a treat as soon as possible.
“You did not write this in the instructions, but I could not make you ice cream. FOLLOWING!"
We skip time before attempt No. 2
- Open raspberry ice cream by removing the lid.
- Scoop up and put three balls of raspberry ice cream in a bowl
- Open chocolate sauce and add two tablespoons to the same bowl.
- Add whipped cream to a bowl
- Sprinkle it all with sugar sticks and sprinkle the cherry on top
Well, now for sure there should be no problems. Just in case, I made sure that all the ingredients for making my culinary masterpiece are open.
The teacher removed the lid, scooped up and put three balls of ice cream in a bowl. "Finally, my beautiful ice cream began to be embodied in reality!" Then she opened the chocolate sauce and added two tablespoons to the bowl. You didn’t “add chocolate sauce from two tablespoons” - you don’t think - she, of course, put the spoons themselves in a bowl. No sauce in them. Again, I did not bother to paint everything for sure. After the rest was done in the same spirit, I got a bowl with ice cream and two tablespoons, barely noticeable under the sea of whipped cream. On top was a pair of sugar sticks.
It seems that at this moment I finally realized: the computer is logic in a vacuum. He does not know about the surrounding circumstances and does not make assumptions. He follows only clearly formulated instructions and follows them word for word.
My end result was the result of a long but necessary series of trial and error:
- Open, if not already done, each of the following packages: raspberry ice cream, chocolate sauce, whipped cream, sugar sticks.
- Take out the bowl and set it in front of you
- Take a spoon for ice cream and one by one put three balls of raspberry ice cream in a bowl. Put the ice cream spoon in place.
- Take a jar of chocolate sauce, scoop up the sauce and pour the contents of a tablespoon into a bowl. Repeat with scooping and pouring the sauce one more time. Put the spoon and the jar in place.
- Take and turn the package of whipped cream upside down and, holding it above the bowl, pour the ice cream on them for 3 seconds, then return the package to its place.
- Take a can of sugar sticks, sprinkle about forty sticks into a bowl and put the can in place.
- Take one cherry from a bowl of cherries and place it on top of the ice cream.
- Give the student a bowl with prepared ice cream and a spoon.
The last point was especially important, since without it, the penultimate time, the teacher simply started eating my ice cream.
But this is programming. Stressfully creating a thorough set of instructions for the computer. Essentially, this is what every programming language boils down to - writing instructions.
Career Programming
Programming has reached a point where it is difficult to discuss it as a single industry, just as it is difficult to use a single word “programmer” as a job description. Two developers can be equally demanded by the market, knowing completely different languages, which means that the ability to develop is more important than knowledge of a particular language. A universal attribute common to all successful developers is fundamental logic .
The best programmer is able to look at the code from a new angle. And this is fundamentally important, because most software products are a collection of undocumented pieces of bad code. They constantly need to be brought together, closing up the gaps as needed. People who are not able to connect scattered points in a single line will have to forever be on the sidelines.
All this leads me to another declaration, this time a bolde: fundamental knowledge has always been and will be paramount to the programmer .
Languages come and go. Frameworks become obsolete, and companies respond to demand by changing the stack of technologies used. Is there a thing that will never change? Yes - fundamental knowledge, which is why it is called fundamental, that underlies everything!
How to improve fundamental knowledge
Photo by Christopher Yeshke on Unsplash
If you are looking for a starting point to improve your fundamental logical thinking, try starting here:
Know the complexity of your program
Also referred to as Big O, “algorithm complexity” refers to the dependence of the time it takes to execute a program on the size of its input data (n) . Keeping abreast of the algorithms used is an important step.
Know your data structures
Data structures are at the core of any modern program. Knowing which structure to use in which case is an independent discipline. Data structures are directly related to runtime complexity and choosing the wrong structure can lead to fundamental performance problems. The search for an element in an array is O (n) , which indicates the high cost of using arrays as input. The search in the hash table is O (1) , which means that in this case the search time for the value does not depend on the number of elements.
People came to me for an interview who claimed that it was faster to search by array than by hash table. It was the surest sign that you should not hire them - know your data structures.
Read / Watch / Listen
Sites like Udemy , Pluralsight, and CodeAcademy are great choices for learning new programming languages. But for the basics, check out books on general principles, practices, and coding styles. The most recommended books are Design Patterns, Refactoring. Improving the Existing Code ”,“ Perfect Code ”,“ Clean Code ”and“ Programmer Pragmatist ”. Finally, each developer must keep a copy of the " Algorithms " on hand.
Practice!
Не получится приготовить яичницу, не разбив яиц. Такие сайты, как HackerRank, CodeWars, CoderByte, TopCoder и LeetCode предлагают тысячи интересных задачек для проверки знаний о структурах данных и алгоритмах. Попытайте счастья в решении приглянувшейся проблемы, выложите свой вариант на Github, а после посмотрите, как к ней подступились другие. Что подводит нас к последнему пункту:
Читай чужой код
The biggest mistake that can only be made by following the development path is to make this path alone. Software development is largely teamwork. Together we create standards, make mistakes together, and, in spite of all the failures, we become better together. The time spent reading someone else's code will pay off handsomely. Just make sure this is good code.
Well, the best advice I can give is never to be ashamed that you don’t know something yet. As already mentioned, our industry is huge, and the number of technologies is immense. It takes a lot of time and effort to build an overall picture, even more to become a professional in something specific, and an order of magnitude more to hone skill in your field. I will let you know when I will achieve this myself.