I see this often with both new and old developers, they have one way of doing a thing and when presented with a new problem they will fall back to what they are used to even if it’s not the optimal solution. It will probably work if you bruteforce it into your usual patterns but sometimes, a different approach is much easier to implement and maintain as long as you are willing to learn it, and more importantly - know it exists in the first place.
On a less abstract level, I guess my question is - how would I go around learning about different design patterns and approaches to problem solving if I don’t know about their existence in the first place? Is it just a matter of proactive learning and I should know all of them in advance, as well as their uses?
Let’s for example say I need to create a system for inserting a large amount of data from files into the db, or you need to create some service with many scheduled tasks, or an user authentication system. Before you sit down and start developing those the way you usually do, what kind of steps could you take to learn a potentially better way of doing it?
Read, and try things. A lot. Read books, read articles, read forums, go to conferences or watch videos from conferences. And try things - do small projects at home, do large projects at home, work in multiple projects at work, if you can. In all these projects, try various things. See how good or bad they are.
There really isn’t any shortcut for this. This is why experience is so valuable and sought after. There is no replacement for it.
Read about how others have done it, and how it worked for them. Ask colleagues, if you have some which did this before. Remeber how you did it (if you ever did it before), and how it worked out for you. Try some prototypes, and see how they work. These are the strategies most people use.
Seems like on one hand, programmers (online at least) are really against being questioned during interviews about whether they “live the code” and spend their free time on contributing to other projects or developing their own, but if this is really the only way to learn stuff like that then maybe they have a point. I was hoping there’s a better way but I guess it’s the same as always - work enough and hope the stuff you learn ends up being useful one day…
I guess the most important advice about learning that I always try to pass on is: Do NOT go passive. Reading books, watching videos, etc. is all fine, as long as you question everything about what you have read or seen. This is something I see especially with juniors but also quite often with seniors. They get recommended a book, and because the author has a name in the industry or simply because its written in a book, it must be Gods holy truth and everything must be done exactly as decreed. In out industry, knowledge has little value without application, so unless you can put the things you consume into a context that makes sense for you foremost, for your team and for your project. If you struggle with this (not everything can be time boxed into a lazy Saturday afternoons) try to discuss with your peers and form some context that way. Do not just consume, you will not improve that way.