Tips for programmers

Hi, Habr! I present to you the translation of the article " Advice for programming students ".

There are many things that I would like to know when I began my journey as a student programmer. Almost 10 years have passed since then, and, unfortunately, I cannot share my experience and knowledge with my past self, only with my younger colleagues. This post consists of some useful tips that I would like to hear when I was 18 years old.

Decide what you need

Of course, you don’t need to be familiar with formal logic or categories if you just want to learn how to create something practical (say, an interface) and do just that. There are two main paths that differ in effort, duration and outcome.

  • You can quickly master one area — say, in one or two years. You will not be useless, you will do something and make a living. There are enough job opportunities (at least for the moment) that do not require much flexibility.
  • You can become a well-known specialist who has spent a lot of time and effort on fundamental things. Then you will be able to adapt, switching career paths becomes relatively easy. You can engage in machine learning, then formal verification, then some low-level programming for trading, or go to game dev. It takes time and dedication - I would rate this process at least 6-8 years.

I strongly advocate a second path, because it is more versatile, interesting, and brings more in the long run. Technology is constantly changing, so you will want to quickly switch to new technologies.


Learn math because math is useful. I can not emphasize this. When you begin, you might think that you do not need linear algebra, because you do not know about applications. However, for any non-trivial machine learning you need it. You need statistics and probability. You will need logic, combinatorics, set theory, all types of discrete mathematics, graph theory, computability theory, formal grammars, lambda calculus, formal semantics, topology, type theory, number theory, groups, rings, fields, categories.

New technologies are constantly emerging. Many of them are based on existing mathematical models. If you know basic math well, you get very nice benefits:

  • The choice among the new-fangled technology will be made much easier.
  • You will understand where to apply new methods and where not to.
  • You will understand why solutions are as they are. Then you can change them to fit the context better.

For example, I got the impression that few people understand why you should not always use the least squares method to evaluate how well your linear regression fits the data. This will be required when errors are normally distributed with a corresponding average value. If this is not the case, you will blindly apply an inadequate solution, without even thinking that part of the model needs adjustment.

Learn math to learn mathematical thinking. Writing evidence makes you strict with your actions. You will always think about all the possible execution paths that your program can perform so as not to introduce errors and security problems. The clarity of thinking gained from building evidence is precious. It will also help you write short, compressed code.

Learn at your best, use the best tools.

Choose your first language. It should be well designed, that is, have:

  • Consistency
  • Small core.
  • The absence of unnecessary complexity (for example, when learning a "complex" language, there are things that you should just know or constantly remember, they do not bring anything useful for learning).
  • Small chance to "shoot yourself in the foot."
  • High-level, because programming is the solution of problems and problems , and not mastery of any language. Knowing all the little features of your favorite language does not mean to be perfect in programming.

I advise you to choose one of the following languages:

  • Scheme (there is an excellent classic introductory course "Structure and Interpretation of Computer Programs").
  • Smalltalk
  • Eiffel
  • ML

Do not be afraid of being deceived by the seeming unpopularity of these languages; in the world of programming, popularity does not mean quality.

Do not start with Python, I beg you! It is poorly designed, inconsistent and does not teach you to think strictly. No need to get used to the “well, usually working” mentality. Python has its uses, but not as a first language.

If you get used to low-quality languages ​​and low-quality tools, low-quality software, and low-quality solutions, you will inevitably repeat them in your own work . Be critical, ask questions, criticize everything, look for inconsistencies and shortcomings.

For example, imagine you are learning a new language, Go. Googling “Go language sucks” and read why people criticize it. Some comments will be minor, but others will really make sense. You will probably get new knowledge from reading critical comments, evaluating them, to then determine whether they matter, or are they just empty words.

Think for yourself

I teach programming (C and assembler) from 2009 to students of ITMO University in St. Petersburg. Many people have problems with programming and they never manage to learn it because they do not create code. When they get a job, they try to imitate an existing solution, perhaps taking some fragments from Stack Overflow, customizing them to their liking. Well, got a solution, what else do you need?

You must learn to write code from scratch. The types of skills needed for this are so different from the skills gained by interfering with existing code!

Programming means making a conscious choice. You are in state A (you have access to a number of language functions / libraries, and you know how to combine them); you want to get state B (language constructs are combined to solve the problem). How do you build a route from A to B? Now this is real programming, problem solving .

When you start writing programs from scratch it becomes a bit hard, but it is absolutely necessary to learn how to build things from scratch. To improve problem solving skills, it is important to learn the algorithms and data structures. Take a good book and solve Olympiad problems online. I recommend Dasgupta's Algorithms for a start, then Cormen’s classic book. All this will open a whole new world for you, I promise.

An additional part of the software creation process is the development of a software architecture; It’s impossible to learn how to structure your programs properly without creating them from 0 to 100.

Broaden your horizons

Program every day, do third-party projects all the time. This is a very simple (and mostly accurate) way for me as a teacher to understand that my student is likely to succeed. One question: what do you program in your free time?

Your teachers simply don’t have enough time to tell everything. After all, after you leave the university, you must continue to study on your own until you retire. If you are passionate about what you are doing, you will learn different types of software for fun, and this will give you much more experience and skills than your less motivated peers.

Ideally, you should try everything: write your own compiler, perhaps a toy OS, http-server, database engine, games, reykasting, create some neural networks, write a simple mobile application, write a program for embedded ..., You can continue. Put all your projects on GitHub and be proud of them: you future employer can take a look at it. Use this portfolio for your own purposes.

It is well known that recruiting a good programmer is extremely difficult. Many programmers applying for work have problems with writing trivial things, such as FizzBuzz. If you have existing projects hosted on GitHub, the employer will be more confident that you are suitable for him.

Challenge yourself with different tools and languages.If someone tells you that all languages ​​are similar, this is either a simplification or a lack of experience. Let me explain a bit.

A computation model is a set consisting of basic operations and ways to glue them together in the order necessary to create complex algorithms. Some languages ​​have very similar models of computation, and some differ greatly.

Programming is much more than well-known C / Python / Java / C ++ / C # / Go / Javascript, built on the same principles: imperative, structural, a bit with OOP and syntactic sugar to simulate other programming styles. The programming world is HUGE. What about:

  • Industrial functional programming languages ​​with complex and well-considered typical systems (Haskell, Ocaml).
  • Functional languages ​​with dependent types that allow not only programming, but also writing evidence (Coq, Agda, LEAN).
  • Concatenative languages ​​(Forth).
  • Logical programming (Prolog, Refal).
  • State machines (regular expressions, Promela).
  • Highly extensible languages, allowing to implement almost any syntactic constructions, such as Lisp, Forth, Camlp4 / 5, Rebol.
  • Domain-specific languages ​​(JetBrains MPS, XText).

Each new model of computation is difficult to understand, because it is a new way of thinking. But the time and effort spent are worth it.

Be sociable

I was very lucky to meet some amazing people. My assistants helped me to improve my skills, to learn something new, to see the world from another point of view. Isolating yourself will not benefit you in the long run: you need other people to discuss to understand what they are doing, what they think.
If your friend read an interesting article and told you about it, you simply saved a lot of your time, because he gave you processed, crystallized knowledge.

Stick to passionate, intelligent people and try to learn from them.You will be surprised how much you can find out at lunch with your friends who want to share the details of their work or research. This diversity of ideas is one of the main reasons why corporations such as Google give you free food.

Ask people who understand code review better and read their code. Studying someone's work, you can learn a lot. Code reviews will help you learn how to write code even better. This is probably one of the most effective ways to become a better programmer very, very quickly.

Write tests

It is so important that this requires a separate article. Testing is an integral part of creating software, and even guys like me who work on formally proven software (which means that it should be mathematically strictly formalized) write tests, although you might think that the guarantees given by the evidence are much stronger.

I hope that this can help someone get a more complete picture, learn faster and become a better programmer; If you have any questions, I will be happy to help. Good luck!

Also popular now: