📜 ⬆️ ⬇️

Any student of programmer knows this.

Brief introduction


The article will discuss the things that are described hundreds of times in CS talmudas: about generally accepted coding styles, about documenting code, about unit tests, etc. This is a tiny collection of tips for undergraduate IT students. The confused text and repetitions are necessary for better material chewing.

The article is intended for beginner programmers.


1 If the program gives the correct result, our work is finished.


Depending on the qualifications and interest of the teacher in the quality of student learning, such a rule may mean that:
  1. all code will be written in the main function;
  2. variable names are chosen based on the rule “the fewer the letters, the better” (especially advanced programmers use transliteration);
  3. all data that can be tightly sealed in the code will be tightly sealed;
  4. checks for incorrect values, null, etc ... what is it?
Why is such an attitude to your code found so often among students who have just started programming? In fact, this result can be explained very simply: for the main part of technical disciplines taught at the university, the curricula have been developed for a long time, and tested on generations of students, while in the field of IT disciplines, especially those related to programming, the teaching culture we didn’t have time to really form (if you are studying at the ISC, congratulations). Therefore, the student is used to the fact that the assignment accepted by the teacher usually means that the student has learned the topic.
')
If a student has completed a coursework on TMM or tasks on iron-and-steel materials, he most likely knows something. In programming, this is not the case: if you wrote a function that evaluates the nth term of the Fibonacci sequence, using recursion in C ++ like this , you do not know anything. You are lucky if the teacher did not accept this nonsense from you, but in fact there are few such teachers. Moreover, you can be given the task “to implement the function of calculating the nth term of the Fibonacci sequence using recursion”.

Findings:
  1. the student of the initial courses of IT areas needs to be disciplined: what the teacher gives and asks is only a small part of the knowledge necessary for real work as even a Junior programmer;
  2. Be sure to read books and articles on topics that you pass and related;
  3. understand the essence of what is happening - you need to understand how your program works from start to completion;
  4. nurture a small nasal perfectionist refactoring (do not forget to tame it after graduation from the university);
  5. if you already understand something in programming, join open-source projects (for a start, you can simply get acquainted with the code from real projects, then you will program your own).
It should be noted that many of the best practices from real projects and the advice of experienced programmers are harmful for a student — you do not need to use the ready-made sort function from the standard library, because you need to understand how it works.

2 Why write a function / class / method here? This can be made easier!


The main disadvantage of tasks for a future programmer at the laboratory / coursework in universities is their synthetic nature. This situation straightens out to senior courses, but, from the experience of observing one’s teammates, the real tasks are given too late — the student is already used to writing code “just to turn in”, which is usually a bad code.

Why write a separate function to print the result and a separate one to get it as a value? Typically, such functions are obtained by 2-3 lines - why complicate, waste time? The answer is simple: to learn how to write code. Now you call the function once for all the work of the program, in the real project it will be justified by the ease of support, debugging, code reuse, etc.

Why does a situation arise in which a student may pass a foul-smelling code? The answer is not as simple as it may seem. The teacher teaches the whole group at once, and accepts work, often based on the average level of students' knowledge. To motivate the whole group for additional unjustified work is the task of the teacher, which many do not cope with. In addition to this, we can recall that “preliminary optimization is evil,” and nobody needs all this additional refactoring - they will not use the code. Therefore, in the eyes of a programmer, a practitioner, who is often a teacher, such work is also not very justified.

Findings:
  1. "Watch for yourself, be careful." Treat any tasks as a challenge; Try to perform the task so that you yourself like it, so that the result can be shown to a friend or put into open access. If you are performing a seemingly foolish coursework, make a small project for yourself on the subject of coursework, put it in open access, and give links to friends; I am sure this experience will be beneficial.
  2. Do not save on time and letters. Of course, you can do all the laboratories at the last moment of the night, but you will not gain any benefit from such short-distance runs.
  3. Create auxiliary libraries that you will use in the future - there may be simple functions, but this experience will be useful, because You “in your own way” will understand what code reuse and its support are.

3 Nobody needs the C language, everyone writes in Java / C # / PHP / etc


Such statements can often be heard in the university corridors. I cannot say that these are unfounded statements - in a real situation a programmer works for money in order to make projects that, generally speaking, are sold by ubiquitous managers. The task of the company is to make a profit, and in the market you can increase your profit by reducing costs (cost). Forgive me, economists, but in short it is. Therefore, the most popular are languages ​​and frameworks that allow you to write code faster and more clearly.

Do not be confused by the fact that I have put C and PHP on one level, and also etc. It's not about the scope, but about the student's doubts about the relevance of the knowledge that he gets on pairs.

Why is it worth learning C? I believe that you can find a lot of answers, ranging from "to understand what is happening at a low level" to "it is used a lot where, therefore, such knowledge will be useful even in the workplace." Any such answer will be correct, and, perhaps, will calm the revolutionary mood of the student, but in fact the answer lies not in the field of language, but in the specifics of university education. In other words, this is just a good language, like Pascal, in which much of the theoretical course in university disciplines can be illustrated. Let me remind you that the university provides (should) give fundamental knowledge, but studying a certain language in the learning process is necessary in order to demonstrate the theory in practice and consolidate this knowledge.

Findings:
  1. Be patient. I am sure that you are still not very clear about what exactly you will be doing in the next 10-15 years. The knowledge gained now may be needed later.
  2. If you like some kind of programming language or technology, complete the tasks both in the required language and in this one, even if it is written “on the table”. It is better, of course, to show the teacher, and discuss why this or that solution is more suitable for the task.
  3. Read blogs and articles on the subject of any of your languages, technologies, as well as on the topics required by the educational program. So you can learn a lot about the area and limits of application of these technologies in real projects.

4 Your project? What for? There are many ready-made ways to solve problems.


Strangely enough, such statements begin to sound not in the first year, but in the second and beyond. In my experience I was faced with the passivity of the teaching staff when I tried to create my own project in the work program of training. It is necessary, of course, to understand that a technical mindset is special, and it is formed in the process of training, practice, follow-up work, and any undertaking without an obvious end result (such as a learning project) is perceived, often as a heretic verbiage. Fortunately, in your own or a neighboring department, you can sometimes find an unconnected creative mind, it will save you.

As an example, I can present a case from life. In the first year of our group, a creative-minded graduate student was given the task “to create a group website,” the task was to be performed in groups of 2-3-4 people. I almost fell into sediment when I heard from the band members that they were going to write their own CMS for the task, and tried to explain that the idea was insane in nature. I convinced them then. Recently, these fellows went to work at the department, I found them installing software on a half dozen computers. When asked why not automate this tedious job, the answer was “how? And in general, we are not bad anyway, we are not in a hurry. ”

Findings:
  1. Most likely, in your department are engaged in programming, try to offer their candidacy. At first, this kind of work may not seem very interesting, but believe me, you will gain experience working in a team with more or less realistic tasks - this is better than sitting at home and chatting on programming forums.
  2. Establish a good relationship with the management of the department, meet graduate students. It will be useful to you when you want to promote something of your own in the curriculum, or organize a circle / elective.
  3. Program small trifles for yourself, lay out in free access, share with friends. You will feel the benefits at senior courses, and after and at work.

5 VCS? Unit testing? Documentation? I work alone on my tiny lab / course papers, I don’t need all this


This problem does not relate directly to students; rather, it is a broader problem. Therefore, I send you to the thematic forums, articles from the series “why this is necessary.”

In fact, the student simply needs to become familiar with all such technologies, since the ability to properly use the tool comes only with experience, often through trial and error. You must fill all your bumps before meeting with the employer, and not after starting work. At the same time, it is necessary to understand that knowledge of the tools used in the work increases your chances of getting this job.

Conclusion


I decided to delete everything that was written further (a few more tips) for the following reason: the article was conceived as an explanation of some phenomena that can be encountered in student life on technical specialties related to IT, so the repetition of truths available in any A good tutorial on programming, or an article for beginners, I think, does not fit into the format of this note.

Therefore: read, search, experiment, do not stop in front of difficulties, and finally make your little project under an open-source license!

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


All Articles