Advice to Junior Developers
Being a junior developer is tough. There is a ton of learning that you have to do. Especially when it comes to technology and being an effective software developer. Not only from a technical standpoint, but also on the soft skills and learning how to navigate a team environment or a companies culture.
However, focusing on the technical aspects of things and working specifically with code. It helps if you can pay attention to how you feel while working on your project - especially, when you’re getting irritated. In particular:
When you feel you’re just mindlessly repeating the same thing over and over, with minor changes - there’s probably a structure to your code that you’re manually unrolling.
As you spend time figuring out what a piece of code does, try to make note of what made gaining understanding hard, and what could be done to make it easier. Similarly, when modifying/extending code, or writing tests, make note of what took most effort.
When you fix a bug, spend some time thinking what caused it, and how could the code be rewritten to make similar bugs impossible to happen (or at least very hard to introduce accidentally).
Not everything that annoys you is a problem with the code (especially when you’re unfamiliar with the codebase or the tooling, the annoyance tends to come from lack of understanding). Not everything should be fixed, even if it’s obviously a code smell.
But I found that, when I paid attention to those negative feelings, I eventually learned ways to avoid them up front - various heuristics that yield code which is easier to understand and has less bugs.
As for following advice from books, I think the best way is to test the advice given by just applying it (whether in a real or purpose-built toy project) and, again, observing whether sticking to it makes you more or less angry over time (and why). Code is an incredibly flexible medium of expression - but it’s not infinitely flexible. It will push back on you when you’re doing things the wrong way.