3 ms·
Newbie can also be yourself looking at your own code a year later. You will have forgotten a lot and will have made it harder for yourself to re-understand what
by j_wtf_all_taken 5y ago
Newbie can also be yourself looking at your own code a year later. You will have forgotten a lot and will have made it harder for yourself to re-understand what you were doing.
There's a difference between learning stuff and applying stuff.
Its about not making the code more complicated and obscure than necessary. Using generic language constructs like switch/case - sure. I don't think that falls in the category of "clever".
- GuB-42 5y ago> Newbie can also be yourself looking at your own code a year later. You will have forgotten a lot and will have made it harder for yourself to re-understand what you were doing. I hear this argument a lot but maybe that's just me but I don't forget much. I don't have perfect memory, far from it, but remembering my thought process when faced with my old code, even decades old is not really a problem for me, especially if a lot of though was put into it, as it tends to be the case with "clever" code. And it can also an important part of the learning process, reading old code is a good way to take a step back and seeing what really are the good ideas and the ones that are terrible. Also, I don't think there is too much of a difference between learning and applying, especially not in programming. That's one thing I love with this job, there is always more to learn, and while theory is also important, it happens by actually doing things. Boring, repetitive tasks are for the computer, not the developer. And I totally agree that one should not make the code more complicated than necessary, but what it necessary is maybe the hardest skill to master. As for Duff's Device is definitely "clever", few people realize that switch/case in C are that closely related to goto, it is not how they are usually taught and I certainly didn't before seeing Duff's Device. And there are more straightforwards ways of manually unrolling loops that don't have you pause and think.
- j_wtf_all_taken 5y ago> I hear this argument a lot but maybe that's just me but I don't forget much. I don't have perfect memory, far from it, but remembering my thought process when faced with my old code, even decades old is not really a problem for me That might be true for you. But I have met too many people that say this about themselves, but then I see them "understanding" their old code (i.e. looking around and not having a clue). In their cases, its just self-deception. Its the same people that say they don't need comments, but then they look around their own files with confused faces. But yeah there are definitely also people with good memory. Those are also the people that happen to, for example, put more thought in structuring their code. > Boring, repetitive tasks are for the computer, not the developer. Unfortunately we have to do a lot of boring, repetitive tasks when developing that could be done by the computer ;-(