Interpreter design pattern

You can see a sample implementation of the interpreter design’s possible smilliar to each other definitions for interpreter in internet literature.

  •  interpreter pattern is a design pattern that specifies how to evaluate sentences in a language
  • Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language.
  • Map a domain to a language, the language to a grammar, and the grammar to a hierarchical object-oriented design

Sample scenarios for this pattern

  • read barcode
  • roman numbers converting numbers   –   (X == 10)
  • Total ASCII values ​​of the characters  – (A == 65)
  • reading result operations with mathematical and logical operators (10*5-3==47)
  • analysis of the encrypted text

Now let’s take a look our sample codes and diagram


Main classes

example of use:

see you blog post

also get clone using VisualStudio 2012 with git source control in the bitbucket repository.You can see repository address and git address in the below

Repository :

Git : to get clone repository

Visio Drawing : Service Designing

Everything is diagram.You see enterprise system with a wide perspective and know can also easily manage these enterprise projects. I came across a interesting article in association with diagrams.You can available this article via 100 Diagrams That Changed the World

Now Let’s take a look my visio drawings about services :D

Diagram : 0

Each web or windows service application (service provider application) can consist of multiple service.


Diagram : 1


Diagram : 2.1

Enterprise Applications have multiple application server an this is mostly three.Each application server come true  also spesific tasks of application services an tools. For instance; Web Services in a app server,Windows services in other app server, pdf builder directory in other app server or Report Services in another app server and so on.


Diagram : 2.2

App Servers’ specific task is significant and whole system may be affected from these tasks’ errors


Diagram : 2.3

Therefore you should install all tool and services related enterprise application for each app server.You just switch on/off mode.


have a good codeday :D

Chain of Responsibility design pattern

Let’s explain the pattern step by step ;

  • The chain-of-responsibility pattern is a design pattern consisting of a source of command objects and a series of processing objects.This design pattern is situated insi behavioral patterns.
  • Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it.
  • Launch-and-leave requests with a single processing pipeline that contains many possible handlers.
  • An object-oriented linked list with recursive traversal.

Minimal Example 

UML Diagram :


Code Snippet:

Loan Example with generic

Class diagram


Code Snippet:

have a good codeday :D

Observer Design Pattern in C#

The observer pattern is a Gang of Four design pattern and one of the most interesting patterns in design pattern. this pattern listed under Behavioral Patterns.


Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.This pattern suitable push-based notifications.

you can watch youtube video related observer design pattern’s logic.I recommend this.

and you can find a great technical post via codeproject.In this post you’ll see example blog subscriber with observer pattern.I made three example for this.

1- Classic sample via gist (ObserverDesignPattern.cs)

2 – Sample with event and delegete via gist (ObserverPatternWithEventAndDelegate.cs)

3 – Sample with generic via gist (ObserverPatternWithNetFramework.cs)

you can examine implementation observer pattern with generic structure

have a good codeday :D

Strategy Design Pattern (example for payment types)

Hi everyone,

We continue to studies about design patterns.I want to illustrate strategy design patern in this post.I implemented a sample scenario related accounting and tranfer operations of payment types for this and coded.Also ı coded  classcic sample scenario(SalaryCalc for different Staffs,PermitDayCalc for different Staff and department) of strategy can see this sample via my gist

Our scenario’s class diagram


You can see th following code snippet

implementation to strategy design pattern

using pattern


have a good day

EF Codefirst with Design Patterns

I frequently use codefirst approach of  Entity Framework in my mvc projects. Thefore I want to do much more flexible,independency using design patterns and that project is output.


Factory Pattern : ContextFactory

Singleton Pattern : ContextFactory and UnitOfWork

UnitOfWork Pattern 

Repository Pattern :  Generic Repository

Decorator Pattern : RepositoryDecoratorBase – CachableRepositoryLoggableRepositoryAuditableRepository

Dependency Injection : Ninject Container as IoC

Used Structure : Object Caching,Logging with Log4net, Advanced Object Orinted Principles

you can download via my github repo

Review Of Structural Design Pattern

Structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.

Adapter Design Pattern : Match interfaces of different classes – via here

Bridge Design Pattern :  Separates an object’s interface from its implementation – via here

Composition Design Pattern : A tree structure of simple and composite objects – via here

Decorator Design Pattern : Add responsibilities to objects dynamicall – via here turkish post

Facade Design Pattern : A single class that represents an entire subsystem – via here – also via here turskish post

Flyweight Design Pattern : A fine-grained instance used for efficient sharing – via here turkish post

Proxy Design Pattern : An object representing another object – via here

Source :


Command Design pattern

Hi everyone,

in one of previous my posts, I illustrated the using of command design pattern (command query reponsibility separation with command processor) via this post I will exemine this pattern as simpler.


– encapsulate a request in an object
– allows the parameterization of clients with different requests
– allows saving the requests in a queue

Composition design pattern’s uml diagram


implementation to command design pattern

Class Diagram


see you next post

Composition Design Pattern


The intent of this pattern is to compose objects into tree structures to represent part-whole hierarchies.Composite lets clients treat individual objects and compositions of objects uniformly.

Composition design pattern’s uml diagram


our hierarchies


implementation to composition design pattern

Class Diagram


See you next post