The newest fad in dev articles is out! Waaah! Object oriented programming is hard! Waaah! Design patterns are hard! Therefore nobody should use either!
First, see my other article “Should programming be easy?”
Here’s how I see a normal progression for pretty much any software developer (if they’re not a whiny lazy new-hotness idiot).
- Learn a programming language
- Learn some design patterns
- Use design patterns badly
- Gain wisdom from ^
- Use design patterns in the proper place
I’m not saying you have to use design patterns in everything (although maybe you are without realizing it *gasp!*), but knowing a few of the big ones can get you a long way and keep you from having to do more work later. One of the biggest examples (IMO) is using an adapter, especially if you use 3rd party libraries for things like connecting to another service or database. What happens when that library is no longer maintained or has a limitation that will not get fixed? What if the new hotness is so much better? (because obviously the new thing will be better, right?) If you used an adapter, you just have to refactor the adapter. If you didn’t….well, time to start from scratch.
If you’re starting out, don’t be afraid of patterns. Use them. Ask more seasoned developers about your code. The best way to learn is by using something (IMO). Yes, you may not use things well the first (or even the 100th) time, but you will eventually learn what works best in certain situations. Even more seasoned developers sometimes use certain patterns in the wrong place some times. Don’t generalize because one thing was hard.
Deal with it. Life is hard. Programming is hard.