Answer the question
In order to leave comments, you need to log in
How to learn to implement algorithms?
I've been working as a programmer for quite some time, but I never learned how to implement algorithms. For example, I have some description of an algorithm in natural language and I need to implement it, say, in Java. Usually I implement a rather cumbersome construction, which is not simple and elegant, and I don’t have the ability to separate the main from the secondary and put it on the shelves. The result is a very complex vinaigrette.
Advise me how to straighten my brain. :)
Answer the question
In order to leave comments, you need to log in
Statement "I've been working as a programmer for a long time, but I never learned how to implement algorithms." contradictory. A programmer is someone who knows how to implement algorithms, he is paid money for this. Those. some part of this statement is wrong (maybe both)
But that's not your problem. By itself, the "implemented algorithm" is a purely theoretical, meaningless substance, approximately the same as "a spherical horse in a vacuum." This is what students do in computer science classes. In real life, the programmer is paid by the customer (employer) for solving his problems. Those. the programmer must study the problem and break down the problem into a sequence of algorithms. What happens as a result is called a program, and the process is called programming.
В вашем случае получается что вы не решаете проблему (не пишете программу), вы в нее даже не вникаете, а пытаетесь писать бесполезный, ни кому ненужный код.
0. Practice.
1. Read about OOP and design patterns.
2. Study other people's good architectural solutions.
3. Learn refactoring techniques and practice refactoring your own and other people's code.
For example, it is very clear and detailed about refactoring here:
https://refactoring.guru/en/refactoring/what-is-re...
Read books on algorithms, on code purity (Martin's Clean Code is like a bible), study someone else's code - senior colleagues and the openSorce community, practice - implement simple algorithms, read Martin's kata, go back to your code and think about how to improve it. Quite a long time - how long is that? Have you overcome 10 thousand hours of programming?
It is necessary to pour green tea from the southeast of India, collected in mid-March by 19-year-old Indian virgins on a clear night at 3/4 of the moon.
Drink this tea every day for 3 years. After that, you need to hammer a 50 mm nail into the board, turn it with the tip up and sit on this board. The board must be made of sandalwood. If the insight on how to program does not come by itself, then I suggest thinking about the following:
And if you are really interested in programming, then I recommend that you notice for yourself:
And what about the graphical representation?
For example, draw the input data and the expected result, and depict several options for solving the problem, and then explore: check how many steps need to be completed, which of them complement each other, how intuitive it is
I highly recommend https://www.ozon.ru/context/detail/id/128304/
Codewars.com is a great site, first you do it yourself, then you watch how others have done it
If vinaigrette comes out, then it is worth breaking it into smaller subtasks and solving them separately.
In theory, everything should be in its place if everything is done normally.
The main thing is not to get carried away because there will be one function to call one function and return its result ..
What you described is more likely to fit depression, and not problems with your code for the algorithm. Otherwise, try to take your code for the algorithm and describe specifically what is wrong with it. Is it slow (why)? Lack of knowledge of Java (did you give it to someone
for feedback)? Bad style (like a feature that is too complex and difficult to read on your own after a while).
Probably the main thing for good coding of algorithms is to love it (programming). Maybe you just pulled up a boring topic for you?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question