Singleton (Anti-) Pattern

I’ve implemented my first design patterns at college, while creating a web system during the software engineer course. My classmates and I needed a facade class with a single instance of it throughout the system. So, because we’re really smart, we’ve applied the Facade and Singleton pattern. Actually, we’ve implemented the patterns without knowledge of … Continue reading Singleton (Anti-) Pattern

Refactoring to Command Pattern

I've spent the last two weeks reading another refactoring famous reference. After Refactoring, I decided to read Refactoring to Patterns, which is also very good, and today I'll share one sample of book's refactoring catalog: Replace Conditional Dispatcher with Command. In this example, you will be able to see some of book's approach and how this practice … Continue reading Refactoring to Command Pattern

Refactoring: write code that humans can understand

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." This is a famous phrase from Martin Fowler and one of the most relevant motivations for refactoring. Martin defines refactoring as "a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior". … Continue reading Refactoring: write code that humans can understand