CSC/ECE 517 Fall 2009/wiki2 11 sv: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
Other design patterns in Ruby!
== '''Design patterns''' ==


===Problem Statement===
The idea of design pattern was first introduced by the architect [http://en.wikipedia.org/wiki/Christopher_Alexander Christopher Alexander] in the field of architecture. Later it has been adapted for various other disciplines, including computer science.
What facilities does Ruby offer that makes it easier to realize other GoF (and other) patterns that we did not cover in class? The key idea here is to explore how Ruby can implement these patterns more efficiently or transparently than static (or other dynamic) o-o languages.
 
A design pattern is a formal way of documenting a solution to a design problem in a particular field of expertise. In software engineering, a design pattern is a solution to a general and commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. But it is a description or template for how to solve a problem that can be used in many different situations.
 
e.g.
 
<pre>We can find some common steps or building blocks in any process. Suppose we have to build a home. Then high level of disign
will be based on how many rooms do we wish to have on each floor. once we are done with this then its just the matter of
duplicating it for the other floors. This is very common and basic design for construction.
</pre>
 
----
 
===Design patterns in ruby===
Almost every design patterns of ruby are borrowed from the [http://en.wikipedia.org/wiki/Gang_of_Four_%28software%29 GOF] book. Following is the list of common pattern used in ruby.
 
#Template
#[http://en.wikipedia.org/wiki/Strategy_pattern Strategy]
#[http://en.wikipedia.org/wiki/Observer_pattern Observer]
#[http://en.wikipedia.org/wiki/Composite_pattern Composite]
#[http://en.wikipedia.org/wiki/Iterator_pattern Iterator]
#[http://en.wikipedia.org/wiki/Command_pattern Commands]
#[http://en.wikipedia.org/wiki/Adapter_pattern Adapter]
#Proxy
#[http://en.wikipedia.org/wiki/Decorator_pattern Decorator]
#Singleton
#Factory
#Builder
#[http://en.wikipedia.org/wiki/Interpreter_pattern Interpreter]

Revision as of 01:01, 9 October 2009

Design patterns

The idea of design pattern was first introduced by the architect Christopher Alexander in the field of architecture. Later it has been adapted for various other disciplines, including computer science.

A design pattern is a formal way of documenting a solution to a design problem in a particular field of expertise. In software engineering, a design pattern is a solution to a general and commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. But it is a description or template for how to solve a problem that can be used in many different situations.

e.g.

We can find some common steps or building blocks in any process. Suppose we have to build a home. Then high level of disign 
will be based on how many rooms do we wish to have on each floor. once we are done with this then its just the matter of 
duplicating it for the other floors. This is very common and basic design for construction.

Design patterns in ruby

Almost every design patterns of ruby are borrowed from the GOF book. Following is the list of common pattern used in ruby.

  1. Template
  2. Strategy
  3. Observer
  4. Composite
  5. Iterator
  6. Commands
  7. Adapter
  8. Proxy
  9. Decorator
  10. Singleton
  11. Factory
  12. Builder
  13. Interpreter