Design Principles

Design Principles Best Practices

Below are some of the most common and important design principles and practices that I’ve embraced.

  • General Design Patterns ( Gang Of Four )
  • Single Responsibility Principle
  • Open-Closed Principle
  • Interface based programming
  • MVC / MVP – Model View Controller / Presenter
  • ORM ( Object-Relational Mapping )
  • IoC / Dependency Injection
  • Declarative Progrogramming
  • Provider Model
  • Service Locator
  • AOP ( Aspect Oriented Programming )

 

Provider model

The provider model aims to simplify the use of a specific implementation of an interface via a static class. It provides a plug-in feature.
Check out a description of the Provider Model on David Hayden’s blog.

 

Single Responsibility

The single responsibility principle( also considered as “Cohesion”) simple means that there should be only 1 reason for a class to change.

You can read more about the Single Responsibility Principle.

 

Service Locator

The service locator provides an easy way to access a service object without having to know how to retrieve the object or how it’s created.

Check out the description and use of Service locator on Martin Fowlers website.

  

IoC and Dependency Injection

Dependency Injection involves the process of supplying an external dependency to a software component. For more information see Dependency Injection here at Martin Fowler’s site.

IoC containers, such as the spring framework, are essentially used to assembly and retrieve a fully innitialized software component. The container is essentially a factory, and responsible for creating the software component by properly “injecting” all the dependencies of that software component via either the constructor or property setters.

 

ORM ( Object – Relational – Mapping )

 Object-Relational Mapping involves the automatic mapping of database records to business objects. I’ve used NHibernate to greatly reduce the time and effort spent on writing code to persist and retrieve your business objects. In some cases, based on your application, the performance may be slow. See NHibernate here.

 

Declarative / Attribute based programming

Declarative or Attribute based programming involves applying metadata to your methods or classes to describe how that method or class should behave and or how to execute it. 

 

AOP ( Aspect Oriented Programming )

Aspect oriented programming is a fairly ingenious solution to dynamically augment your code without having to modify it. It is used in combination with Attributes ( see above ).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: