Design Patterns - A deep dive: Part 1

View: 651    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: Design Ideas   Fields: Computers - Technology

0 point/2 review File has been tested

A colleague of mine asked me a question a few days back: "If an application is created using the correct Design Patterns, does it ensure that the application would be bug/performance issues free?" The answer to the question gave me an idea to put in a series of articles to look at what Design Patterns are, what Design Patterns can/can't do, and hopefully get some interesting discussion started with you readers about your experiences and inputs. Let us start this journey with a small step in understanding a few definitions regarding Design Patterns, and look at what Design Patterns are all about at a very high level. The subsequent articles will focus on the details of each pattern, and a few scenarios where we can use these patterns.

Introduction

What is a Design Pattern?

"In software engineering, a Design Pattern is a general reusable solution to a commonly occurring problem in software design" - (Wikipedia, 2008)

In my opinion, a Design Pattern is a probable way to solve a design problem in software. I use the term "probable" because even though a Design Pattern might "seem" to solve the issue you are facing, you still need to analyze the problem and ensure that the solution/pattern offered is valid in the context of your development effort.

This judgment is acquired only by experience in either using the pattern successfully or having burnt your fingers in the process. Experienced architects, designers, and developer will tell you that even if you have had used a pattern many times in your previous projects, you will still need to evaluate using the pattern in your current project simply because the requirements/project environment/time-of-the-day is different from the last time you used it.

"Patterns are about the design and interaction of objects, as well as providing a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges." - (Data & Object Factory, 2008).

The keyword in the definition above is the idea of a "communication platform". A Design Pattern not only helps in communication between objects, but also provides a communication platform in discussing your ideas with your peers.

For example, it would be easier in telling someone that you are planning to use a Facade pattern instead of an MVC, and they would instantly know the "structure" of what you plan to do. So, you could directly get into a discussion about the merits/demerits of using a particular pattern and focus on what meets your business requirements rather than spend time explaining what you plan to do.

Note: The above statement is assuming that the "someone" also understands Design Patterns; else, you can always point them out to this series for more information :P

What is NOT a Design Pattern?

These are a few items that come to mind, and I will keep updating this list if you have some more items to add here. So, here goes:

  • Design Patterns are not architecture patterns - Design Patterns specifically deal with problems in the software design (object creation, communication, and behavior) level, while architecture patterns deal with the problems in the software engineering (communication, operation, maintenance, environment, physical/logical layers in the application) level.
  • Design Patterns are not solutions to your problem - Design Patterns are generic solutions to generic problems. Your application is not a generic application, so you need to "customize" a Design Pattern to solve the specific problem you are facing. This customization would be valid only within the confines of your application to address that specific problem. You will need to start this analysis all over again in a different problem/project.
  • Design Patterns are not algorithms - Design Patterns are not implementations, they are only a "framework" for a solution, while algorithms are implementations of a problem solutions to a problem (update: thanks to Neni-san for pointing this out in the comments section). So, while algorithms may be directly used in your application (for example, an algorithm for a bubble sort), Design Patterns need to be tailored for your application.
  • A Design Pattern is not a hammer looking for a nail.
  • Design Patterns are not answers looking for questions (this is a good quote from my friend and colleague Vasanth).

Why do I need Design Patterns?

Frankly, you could continue with the rest of your programming life without knowing a single Design Pattern, and you could do just fine. As long as a piece of software meets its business goals, who cares what it does under the hood, really?

Then again, do you see a productivity benefit in using a proven development paradigm instead of re-inventing the wheel (unless the wheel was square, of course)?

Would you prefer eliminating those hard to fix logical bugs in your application by using a standard template for avoiding such issues?

Do you like to appear cool (or a nerd, depending on the audience) by explaining the nuances of MVC/MVP patterns, or start a flame-war on if MVC is really a Design Pattern or an architecture pattern?

If your answers to the above questions is a resounding yes, then unfortunately, you do need to know what Design Patterns are.

On the bright side - you now have a new way to screw up your code, and people might actually understand where you screwed up and help out with solutions!

Great, when do we start?

If you still did not notice, we are already on our way!

This was the first of the series of articles, and I hope to bring out the next one as soon as possible. Till then, you could go through my previous articles, which really have no connection to this article whatsoever, but interesting enough, I hope.

The Answer

Regading the answer I gave my colleague to his question posed at the start of this article, I realized that my colleague had two positives going in his favour:

  1. He realized that all software projects inherently had bugs/performance issues in them - to a detected or un-detected extent.
  2. He was curious if his new-found knowledge could help him solve these issues.

Since two positives still make a positive, I replied: "Yeah, right!"

Design Patterns - A deep dive: Part 1

Design Patterns - A deep dive: Part 1 Posted on 04-04-2014  A colleague of mine asked me a question a few days back: "If an application is created using the correct Design Patterns, does it ensure that the application would be bug/performance issues free?" The answer to the question gave me an idea to put in a series of articles to look at what Design Patterns are, what Design Patterns can/can't do, and hopefully get some interesting discussion started with you readers about your experiences and inputs. Let us start this journey with a small step in understanding a few definitions regarding Design Patterns, and look at what Design Patterns are all about at a very high level. The subsequent articles will focus on the details of each pattern, and a few scenarios where we can use these patterns. 5/10 651

Comment:

To comment you must be logged in members.

Files with category

  • MasterPages reinvented - a Component Based Template Engine for ASP.NET

    View: 1836    Download: 2   Comment: 0   Author: none  

    MasterPages reinvented - a Component Based Template Engine for ASP.NET

    Category: Design Ideas
    Fields: Other

    2.25/2 review
    A template engine allows you to render the contents of your ASP.NET web forms as parts of a Master Page (template). This template engine provides a new approach regarding the separation of ASP.NET templates and web forms. The features at a...

  • A Quick Look at API Design

    View: 1384    Download: 0   Comment: 0   Author: none  

    A Quick Look at API Design

    Category: Design Ideas
    Fields: Other

    0/0 review
    Whether you know it or not, you are an API (Application Programmer Interface) designer. Every time you create a new class or enhance an existing one, the non-private methods and properties create, or add to, an API. So it makes sense, I think, to...

  • User-driven applications

    View: 2417    Download: 0   Comment: 0   Author: none  

    User-driven applications

    Category: Design Ideas
    Fields: Other

    0/4 review
    This is the second article in a series of two. The first article – on the theory of moveable objects – was about the basic algorithm and its use in designing different moveable / resizable objects. Such objects are in high demand in many programming...

  • A Reflective and Translucent Glass Panel

    View: 2960    Download: 3   Comment: 0   Author: none  

    A Reflective and Translucent Glass Panel

    Category: Design Ideas
    Fields: Other

    0/7 review
    This component is the logical suite of the AlphaGradientPanel published here on CodeProject. It replaces the original System.Windows.Form.Panel by a nifty glassy one.

  • Distributed Command Pattern - an extension of command pattern for connected systems

    View: 4014    Download: 5   Comment: 0   Author: none  

    Distributed Command Pattern - an extension of command pattern for connected systems

    Category: Design Ideas
    Fields: Accounting

    0/7 review
    Distributed Command Pattern is a proposed pattern for solving the extra architectural design issues which need to be considered for connected systems than designing regular applications. The goal of this pattern is to “Have the same design for both...

  • Validators for Windows Forms - ValidationProvider Control

    View: 6315    Download: 2   Comment: 0   Author: none  

    Validators for Windows Forms - ValidationProvider Control

    Category: Design Ideas
    Fields: Accounting

    0/9 review
    Do you spend most of your time writing custom validations on Windows Forms? Have you ever wanted an equivalent WinForm validator like in WebForm? Noogen ValidationProvider can help you speed up your WinForms design time by providing powerful, easy...

  • Integrating Help In Your Iron Speed Designer Application

    View: 1817    Download: 0   Comment: 0   Author: none  

    Integrating Help In Your Iron Speed Designer Application

    Category: Design Ideas
    Fields: Computers - Technology

    0/3 review
    This article is in the Product Showcase section for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

  • Dependency Inversion Principle and the Dependency Injection Pattern

    View: 1006    Download: 0   Comment: 0   Author: none  

    Dependency Inversion Principle and the Dependency Injection Pattern

    Category: Design Ideas
    Fields: Computers - Technology

    0/2 review
    Everyday we write lots of code which are tightly coupled and when complexity grows code will eventually deteriorate into Spaghetti Code. Which violates the Dependency inversion principle. In software design, tight coupling is often considered to be a...

 

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd