Design Pattern's,

Code Smells

 

Design Pattern's

Few Books

 
2

What is Design Pattern

Design patterns are optimized, reusable solutions to the programming problems that we encounter every day.

Design Patterns are Recipies

 

You have a problem statement - and you have a solution

 

What if your problem is not a perfect match?

Do not force design pattern

 

How to solve the problem?

Understand how design patterns are defined in first place, and help yourself to come up with a variant of a solution.

 

How is Design Pattern or any Pattern defined?

Here comes some philosophical rant? 

Pattern - is a solution to a problem, based on principle(s) and a valid context.

 

What is Principle?

A fundamental truth or proposition that serves as the foundation for a system of belief or behavior or chain of a reasoning

 

Which Principles?

Software Design Principle or Object Oriented Principles or any other principles

 

Why to study Design Patterns and Not Principles?

1
  • If Principle is Science, Design Patterns is applied Science - easy to relate to and understand
  • Principles like Science is very vast in nature, Applied Science is very narrow in scope and easy to study
  • Study Design Pattern and try to understand underlying principle behind it
  • Mostly for design - OOP's Principles are good to understand design patterns
  • Study of Craig Larman's work will also help
  • Universal principles like - YAGNI, DRY, Rule of 3 also helps in understanding mindset of author of pattern
 

What is Code Smells?

Patterns to understand where is problem in coding

 
Code Smell Refactoring Pattern
Alternative Classes with Different Interfaces Unify Interfaces with Adapter
Rename Method
Move Method
Combinatorial Explosion Replace Implicit Language with Interpreter
Comments (a.k.a. Deodorant) Rename Method
Extract Method
Introduce Assertion
Conditional Complexity Introduce Null Object
Move Establishment to Decorator
Replace Condition Logic to Strategy
Replace State Altering Condition with State
Data Class Move Method
Encapsulate Field
Encapsulate Collection
Data Clumps Extract Class
Preserve Whole Object
Introduce Parameter Object
Divergent Change Extract Class
Feature Envy Extract Method
Move Method
Move Field
Code Smell Refactoring Pattern
Duplicate Code Chain Constructors 
Extract Composite 
Extract Method
Extract Class
Form Template Method
Introduce Null Object 
Introduce Polymorphic Creation with Factory Method 
Pull Up Method 
Pull Up Field 
Replace One/Many Distinctions with Composite 
Substitue Algorithm 
Unify Interfaces with Adapter 
FreeLoader (Lazy Class) Collapse Hierarchy
Inline Class
Inline Singleton
Inappropriate Intimacy Move Method  
Move Field  
Change Bidirectional Association to Unidirectional Association
Extract Class 
Hide Delegate
Replace Inheritance with Delegation

For more 

Click Me 

 

 

Thank You

 
Made with Slides.com