Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If I have limited time to learn a few design patterns, which ones should I learn?

If I have limited time, but I want to start learning a few design patterns, which ones should I learn first?

like image 267
nonopolarity Avatar asked May 23 '09 03:05

nonopolarity


1 Answers

I'd suggest Inversion of Control/Dependency Injection. This comes in very handy when unit testing as it enables you to supply mock dependencies for the class under test. Proxy is also very useful when wrapping a sealed class to make it more usable in testing scenarios.

If I make another suggestion, I would focus on learning which patterns are useful in different situations rather than focusing on learning how to implement a particular pattern. You can almost always find a reference implementation to use when implementing a pattern, but being able to discern when and which pattern to use will make the patterns more useful. If you start going about it the other way, you end up making your problem fit the patterns you know rather than applying the correct pattern that fits the problem.

like image 143
tvanfosson Avatar answered Jan 01 '23 09:01

tvanfosson