📜 ⬆️ ⬇️

Tips for student programmers

Hi, Habr! I present to your attention 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 helpful 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.


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.

Maths


Learn math because math is useful. I can not emphasize this. When you start, 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 grammar, 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:
')

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 is 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:


I advise you to choose one of the following languages:


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 criticisms, 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.

Expand 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:


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, learn something new, 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 to 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!

Source: https://habr.com/ru/post/425363/


All Articles