What are the design patterns that I should be completely familiar with? And what is one easy example that each can be used for?
I am a web developer (I use Django, and is familiar with separation of logic), but I work at a Desktop-app company. They are always talking about singletons, and I forget…but it leaves me no clue!
Forget Singleton. It’s confusing and rarely necessary.
Learn State, Strategy and Command. They’re used all the time.
State is for anything that has logic that depends on the state of the object. In short, every if-statement might possibly be better done via State. Seriously. Too many if-statements are a code smell and indicate that there’s stateful processing that’s sprawled all over the place.
Strategy is for any “plug-in” or “expansion” or “option” processing.
Command is for any extensible (and composable) set of actions. Backup, Restore. Table Drop, Create, Index, Populate. Validate, Load, Summarize, Report. Any of those command-like things that can be put together in different ways, different orders, etc., should probably be done with a formal Command design.