One language to rule them all

Hidden under a layer of code, a language languishes, eager to be learned.

One language to rule them all

At the time of this writing, the query “programming which language to learn first” returns 517 million search results. Each of these sites will praise one particular language, and 90% of them will end up recommending either Python or JavaScript.

Without much prelude, I would like to officially declare that all these 517 million sites are wrong and declare that the language that needs to be learned 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 has practically 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 in the labor market of the author and in your country may be different (as well as other nuances), which, however, in itself does not make the original article worse - approx. transl.

My first computer science lesson

My first exposure to computer science was an elective that I took in the 10th grade. On the very first day, when I entered the auditorium, I was delighted to see a large number of buckets of ice cream and various toppings in front of me. After everyone was seated, the teacher announced:

“Today we will taste self-made ice creams. But with one condition: you must make a list of specific instructions on how to prepare dessert, and I will follow them.

No problem, I thought, this lesson won't be long. About a minute later, I sketched out a great recipe for my dream ice cream:

  1. Scoop and put three scoops of raspberry ice cream into a bowl
  2. Open the chocolate sauce and add two tablespoons to the same bowl
  3. Add whipped cream to a bowl
  4. Sprinkle all this with sugar sticks and put a cherry on top

My teacher—the "computer" in that sweet metaphor—played out a performance that was more sarcastically literal than I've ever seen before. She began zealously poking the ice cream bucket with a scoop spoon without even touching the lid.

“Okay, okay, but first you need to open it!” I exclaimed, trying to get a treat as soon as possible.

“You didn’t write it in the instructions, and I couldn’t make you ice cream. NEXT!"

Fast forward to attempt #2

  1. Open raspberry ice cream by removing the lid
  2. Scoop and put three scoops of raspberry ice cream into a bowl
  3. Open the chocolate sauce and add two tablespoons to the same bowl
  4. Add whipped cream to a bowl
  5. Sprinkle it all with sugar sticks and put a cherry on top

Well, it shouldn't be a problem right now. Just in case, I even made sure that all the ingredients for making my culinary masterpiece were open.

The teacher removed the lid, scooped up and put three scoops of ice cream into the bowl. “Finally, my beautiful ice cream began to come true!” She then opened the chocolate sauce and added two tablespoons to the bowl. Not "added two tablespoons of chocolate sauce" - don't think - she, of course, put the spoons themselves in the bowl. No sauce in them. Again, I didn't bother to describe everything exactly. After the rest was done in the same vein, I got my hands on a bowl of ice cream and two tablespoons, barely visible under a sea of ​​whipped cream. On top was a pair of sugar sticks.

It seems that at that moment it finally dawned on me: a computer is logic in a vacuum. He is unaware of surrounding circumstances and makes no assumptions. He carries out only clearly formulated instructions and follows them word for word.

My end result was the result of a long but necessary trial and error:

  1. Open, if not already done, each of the following packages: raspberry ice cream, chocolate sauce, whipped cream, sugar sticks.
  2. Take out the bowl and put it in front of you
  3. Take an ice cream scoop and put three scoops of raspberry ice cream into the bowl one by one. Put the ice cream scoop back.
  4. Take a jar of chocolate sauce, scoop up the sauce and pour the contents of a tablespoon into a bowl. Repeat the action of scooping and pouring the sauce one more time. Put the spoon and jar back.
  5. Take and turn the package of whipped cream upside down and, holding it over a bowl, pour it over the ice cream for 3 seconds, then return the package to its place.
  6. Take a jar of sugar sticks, pour about forty sticks into a bowl and put the jar back.
  7. Take one cherry from the bowl of cherries and place it on top of the ice cream.
  8. Give the student a bowl with ready-made ice cream and a spoon.

The last item was especially important because without it, the penultimate time the teacher just started eating my ice cream.

But that's what programming is. The painstaking task of creating a meticulous set of instructions for a computer. In essence, this is what every programming language comes down to - writing instructions.

Career in programming

Programming has reached the point where it is difficult to discuss it as a single industry, just as it is difficult to use the single word "programmer" as a job description. Two developers can be equally in demand by the market, knowing completely different languages, which means that the ability to develop is more important than knowing a particular language. A universal attribute common to all successful developers is fundamental logic.

The best programmer is the one who 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 fragments of bad code. They constantly need to be brought together, filling gaps as necessary. People who are not able to connect disparate points with a single line will have to forever be on the sidelines.

Which brings me to yet another declaration, this time in bold: fundamental knowledge has always been and will be paramount for a 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 called fundamental because it underlies everything!

How to improve fundamental knowledge

One language to rule them allPhoto by Christopher Jeschke on Unsplash

If you are looking for a starting point for improving fundamental logical thinking, try starting here:

Know the complexity of your program

Also called 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 heart of any modern program. Knowing which structure to use in which case is a discipline in its own right. Data structures are directly related to runtime complexity, and choosing the wrong structure can lead to fundamental performance problems. Finding an element in an array is He), which indicates the high cost of using arrays as input. Hash table lookup − 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 interviews who claimed that it was faster to look up an array than a hash table. This was the surest sign that you should not hire them - know your data structures.

Read / watch / listen

Sites like UdemyPluralsight и Codeacademy is a great choice for learning new programming languages. But for the basics, look to books on general principles, practices, and coding styles. The most recommended books are Design Patterns, Refactoring. Improvement of Existing Code”, “Perfect Code”, “Clean Code” and “Pragmatic Programmer”. Finally, each developer should keep a copy of "Algorithms" at hand.

Practice!

You can't cook scrambled eggs without breaking eggs. Sites like hacker RankCode WarsCoderByte, TopCoder и LeetCode offer thousands of interesting puzzles to test knowledge about data structures and algorithms. Try your luck in solving the problem you like, post your version on Github, and then see how others approached it. Which brings us to the last point:

Read someone else's code

The biggest mistake you can make when going down the development path is to go it alone. Software development is largely a team effort. Together we create standards, together we make mistakes and, despite all the failures, together we become better. The time spent reading someone else's code will pay off handsomely. Just make sure it's good code.

Well, the best advice I can give is never 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 the big picture, even more to become a pro at something specific, and an order of magnitude more to hone your craft. I'll let you know when I get it myself.

Source: habr.com

Add a comment