Wednesday, 2 December 2015

Design Pattern Overview

Design Pattern Overview

Many people teach design patterns as a fundamental step to Object Oriented Programming.
In this post we are going to discussing ideas design pattern more details step by step
with my fellow code junkies.

Now question what actually design patterns represent in software development?
Design patterns represent the best practices used by experienced object-oriented software developers.Design patterns are solutions to general problems that software developers faced during software development.

Design Patterns have two main usages in software development. This are the common platform for developers and best practices.



In this article post discussion will be covering...

1)What they are?
2)Where they came form?
3)Why they matter?

Software professionals may be familiar with the term "Design Patterns," but many have no idea of where they come from and what they truly are.Consequently, some do not see the value and benefits design patterns bring to the software development process.

What Design Patterns are?


  1. General and reusable solutions or template to common problems in software design
  2. Not a finished solution
  3. A template or recipe for solving certain problems
  4. With names to identify them


Patterns deal with:


  1. Application and system design
  2. Abstractions on top of code
  3. Relactionships between classes or other collaborators
  4. Problems that have already been solved


Patterns are not concerned with:


  • Algorithms
  • Specific implementations or classes...


Design Patterns History:
 Design Patterns: Elements of Reusable Object-Oriented Software in 1994 by Gang of Four: Eric Gamma,Richard Helm, Ralph Johnson, and John Vlissides.
This book is considered to be the "coming out" of design patterns to the software community.
In 1998, the Gang Of Four were awarded Dr Dobbs Journal 1998 Excellence in Programming Award.


Design Patterns Structure:

Term Descrition
Pattern Name     Describes the essence of the pattern in a short
Intent Describes what the pattern does
Also Known As    List any synonyms for the pattern
Motivation Provides an example of a problem and how the pattern solves that problem
Applicability                Lists the situations where the pattern is applicable
Structure                     Set of diagrams of the classes and objects that depict the pattern
Collaborations Describes how the participants collaborate to carry out their responsibilities


Design Patterns Benefits
Design patterns have two major benefits. First one, they provide you with a way to solve issues related to software development using a proven solution.
Second one, design patterns make communication between designers more efficient.

Difference between Co-related Sub-Query and Sub-query

Difference between Co-related Sub-Query and Sub-query

Below example is not Co-related Sub-Query. It is Derived Table / Inline-View since i.e, a Sub-query within FROM Clause.

A Corelated Sub-query should refer its parent(main Query) Table in it. For example See find the Nth max salary by Co-related Sub-query:


Technical difference between Normal Sub-query and Co-related sub-query are:

1. Looping: Co-related sub-query loop under main-query; whereas nested not; therefore co-related sub-query executes on each iteration of main query. Whereas in case of Nested-query; subquery executes first then outer query executes next. Hence, the maximum no. of executes are NXM for correlated subquery and N+M for subquery.

2. Dependency(Inner to Outer vs Outer to Inner): In the case of co-related subquery, inner query depends on outer query for processing whereas in normal sub-query, Outer query depends on inner query.

3.Performance: Using Co-related sub-query performance decreases, since, it performs NXM iterations instead of N+M iterations. ¨ Co-related Sub-query Execution.

What is a CLR?


What Is CLR?

Full form of CLR is Common Language Runtime and it forms the heart of the .NET framework.
All Languages have runtime and it is the responsibility of the runtime to take care of the code
execution of the program. For example, VC++ has MSCRT40.DLL, VB6 has MSVBVM60.DLL,
and Java has Java Virtual Machine etc. Similarly, .NET has CLR. Following are the
responsibilities of CLR
• Garbage Collection: - CLR automatically manages memory thus eliminating
memory leaks. When objects are not referred, GC automatically releases those
memories thus providing efficient memory management.
• Code Access Security: - CAS grants rights to program depending on the security
configuration of the machine. Example the program has rights to edit or create a
new file but the security configuration of machine does not allow the program to
delete a file. CAS will take care that the code runs under the environment of
machines security configuration.
• Code Verification: - This ensures proper code execution and type safety while the
code runs. It prevents the source code to perform illegal operation such as accessing
invalid memory locations etc.
• IL (Intermediate language)-to-native translators and optimizer’s:- CLR uses
JIT, compiles the IL code to machine code, and then executes. CLR also determines
depending on platform what is optimized way of running the IL code.