Writing about design patterns made me think about patterns in my own life. Have you ever thought about the repeated things you do? Some of them may be good, you work out everyday after work. Some of them may be bad you wake up late and then run around trying to get things together before you go to work or you may watch TV for four hours straight wasting the day. I believe that by examining our patterns and our behavior we can find patterns that are good, and patterns that are bad.

Anti-patterns in software development are patterns that seem obvious yet are ineffective or sub-optimal. Some people argue that a singleton is an anti-pattern because it doesn't allow the client to determine how many instances are needed, they carry state with them through the life of the program, they destroy the concept of single responsibility, and they effectively become a global variable.

Either way learning the singleton is by far the easiest way to start learning design patterns and is something every developer should know. Thinking about context of classes is crucial to deciding if this pattern is the right for your application.

0 comments: