SlideShare a Scribd company logo
Design Pattern
                                                                          -- from Java to Ruby



                                                                    Richard
                                                                      Ekohe




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                  For reuse




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                  For communication




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                                                                                            Define a Node interface, all of leaf nodes and
                                                                                                 internal nodes should implements the
                                                                                                interface, internal nodes has a list that
                  For communication                                                        includes other internal nodes and leaf nodes
                                                                                              and it can add and remove sub-nodes. But
                                                                                             leaf node can’t have add sub-node method.




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                                                                                            Define a Node interface, all of leaf nodes and
                                                                                                 internal nodes should implements the
                                                                                                interface, internal nodes has a list that
                  For communication                                                        includes other internal nodes and leaf nodes
                                                                                              and it can add and remove sub-nodes. But
                                                                                             leaf node can’t have add sub-node method.




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                                                                                            Define a Node interface, all of leaf nodes and
                                                                                                 internal nodes should implements the
                                                                                                interface, internal nodes has a list that
                  For communication                                                        includes other internal nodes and leaf nodes
                                                                                              and it can add and remove sub-nodes. But
                                                                                             leaf node can’t have add sub-node method.




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                  For communication




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                  For communication
                                                                                                 Composite
                                                                                                  Pattern




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Why use Design Pattern
                  For communication
                                                                                                 Composite
                                                                                                  Pattern




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Difference from java to ruby




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Difference from java to ruby


               Classes are Objects




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Difference from java to ruby


               Classes are Objects
               Messages, not function call




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Difference from java to ruby


               Classes are Objects
               Messages, not function call
               Duck Typing




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Difference from java to ruby


               Classes are Objects
               Messages, not function call
               Duck Typing
               Mixin




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern

                  ensures a class has only one instance, and
                   provides a global point of access to it




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern
              You are my
               only wife




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern
                                                                                                     You are my
              You are my
                                                                                                    only husband
               only wife




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern -- java




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern -- java

                  Eager loading




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern -- java

                  Eager loading
                  Lazy loading




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern -- ruby
                  Ruby built-in singleton




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Singleton Pattern -- ruby
                  Ruby built-in singleton




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby for Design Pattern
                  Built-in (Singleton)




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern
                  defines a one-to-many dependency between
                   objects so that when one object changes state,
                   all of its dependents are notified and updated
                   automatically




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern




                                                                  Subscribe

                                                           Temperature
                                                             Detector


www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern




                                                                  Subscribe
                                                                                                        Temprature
                                                           Temperature
                                                                                                        changed
                                                             Detector


www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern




                                                 Notify                                   Notify



                                                                  Subscribe
                                                                                                        Temprature
                                                           Temperature
                                                                                                        changed
                                                             Detector


www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Define interface by yourself




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Define interface by yourself




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Define interface by yourself




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Define interface by yourself




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Define interface by yourself




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Define interface by yourself




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Java built-in observer




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- java

                  Java built-in observer




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- ruby

                  Ruby built-in observer




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- ruby

                  Ruby built-in observer




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Observer Pattern -- ruby

                  Ruby built-in observer




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby for Design Pattern

                  Built-in (Singleton, Observer)
                  Mixin




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Iterator Pattern
                  provides a way to access the elements of an
                   aggregate object sequentially without exposing
                   its underlying representation




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Iterator Pattern

                           Count                 1         2        3                                   10




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Iterator Pattern -- java
           Java built-in Iterator and mock Iterator




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
Iterator Pattern -- java
           Java built-in Iterator and mock Iterator




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
Iterator Pattern -- java
           Java built-in Iterator and mock Iterator




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
Iterator Pattern -- java
           Java built-in Iterator and mock Iterator




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
Iterator Pattern -- ruby
                  Nothing, just .each




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Iterator Pattern -- ruby
                  Nothing, just .each




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Iterator Pattern -- ruby
                  Nothing, just .each




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby for Design Pattern

                  Built-in (Singleton, Observer, Iterator)
                  Mixin




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern
                  returns an instance of one of several possible
                   classes, depending on the data provided to it.




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- java
                  Compare with String, a lot of if/else




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- java
                  Compare with String, a lot of if/else




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- java
                  Compare with String, a lot of if/else




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- java
                  Compare with String, a lot of if/else




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- java
                  Compare with String, a lot of if/else




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- java
                  Compare with String, a lot of if/else




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- ruby
                  Classes are Objects




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- ruby
                  Classes are Objects




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- ruby
                  Classes are Objects




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Simple Factory Pattern -- ruby
                  Classes are Objects




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby for Design Pattern

                  Built-in (Singleton, Observer, Iterator)‫‏‬
                  Mixin
                  Classes are Objects




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern
                  encapsulates a request as an object, thereby
                   letting you parameterize clients with different
                   requests, queue or log requests, and support
                   undoable operations.




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern -- java




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern -- java




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern -- java




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern -- java




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern -- java




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern -- ruby
                  Proc




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Command Pattern -- ruby
                  Proc




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby for Design Pattern

                  Built-in (Singleton, Observer, Iterator)‫‏‬
                  Mixin
                  Classes are Objects
                  Proc




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Other Design Patterns




                                         Make use of ruby advantage




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby's Principle




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby's Principle

         DRY – Don't Repeat Yourself




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Ruby's Principle

         DRY – Don't Repeat Yourself
         Convention Over Configuration




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Resources

         Design Pattern – Elements of Reusable Object-Oriented Software
               Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides

         Head First Design Pattern

                  Kathy Sierra, Bert Bates


         Design Pattern in Ruby

                  Russ Olsen



www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
Q&A



                                   happy to discuss and fix my mistakes




www.ekohe.com
Web Development & Graphic Design
China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development

More Related Content

Similar to Design Pattern From Java To Ruby

Contributing To Rails By Plugin Gem
Contributing To Rails By Plugin GemContributing To Rails By Plugin Gem
Contributing To Rails By Plugin GemDaniel Lv
 
Rails bestpractices.com
Rails bestpractices.comRails bestpractices.com
Rails bestpractices.com
Richard Huang
 
Static Code Analysis For Ruby
Static Code Analysis For RubyStatic Code Analysis For Ruby
Static Code Analysis For Ruby
Richard Huang
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09
Shaer Hassan
 
Ruby Kaigi09 China Rubyupdate20090718
Ruby Kaigi09 China Rubyupdate20090718Ruby Kaigi09 China Rubyupdate20090718
Ruby Kaigi09 China Rubyupdate20090718tengu
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
Momentum Design Lab
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010arif44
 
Ruby on Rails : First Mile
Ruby on Rails : First MileRuby on Rails : First Mile
Ruby on Rails : First Mile
Gourab Mitra
 
Css sprite best practices
Css sprite best practicesCss sprite best practices
Css sprite best practices
Richard Huang
 
Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)
Tobias Pfeiffer
 
Merb For The Enterprise
Merb For The EnterpriseMerb For The Enterprise
Merb For The Enterprise
Matt Aimonetti
 
Úvod do Ruby on Rails
Úvod do Ruby on RailsÚvod do Ruby on Rails
Úvod do Ruby on Rails
Karel Minarik
 
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)Shanda innovation institute
 
Better Framework Better Life
Better Framework Better LifeBetter Framework Better Life
Better Framework Better Life
jeffz
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
Paul Pajo
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
iradarji
 
Ruby application based on http
Ruby application based on httpRuby application based on http
Ruby application based on http
Richard Huang
 
Ruby on Rails Web Development Best Practices and Tips.pdf
Ruby on Rails Web Development Best Practices and Tips.pdfRuby on Rails Web Development Best Practices and Tips.pdf
Ruby on Rails Web Development Best Practices and Tips.pdf
lubnayasminsebl
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
José Maria Silveira Neto
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
Jim Jones
 

Similar to Design Pattern From Java To Ruby (20)

Contributing To Rails By Plugin Gem
Contributing To Rails By Plugin GemContributing To Rails By Plugin Gem
Contributing To Rails By Plugin Gem
 
Rails bestpractices.com
Rails bestpractices.comRails bestpractices.com
Rails bestpractices.com
 
Static Code Analysis For Ruby
Static Code Analysis For RubyStatic Code Analysis For Ruby
Static Code Analysis For Ruby
 
Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09Ror Seminar With agilebd.org on 23 Jan09
Ror Seminar With agilebd.org on 23 Jan09
 
Ruby Kaigi09 China Rubyupdate20090718
Ruby Kaigi09 China Rubyupdate20090718Ruby Kaigi09 China Rubyupdate20090718
Ruby Kaigi09 China Rubyupdate20090718
 
Ruby on Rails
Ruby on RailsRuby on Rails
Ruby on Rails
 
Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010Ruby On Rails Seminar Basis Softexpo Feb2010
Ruby On Rails Seminar Basis Softexpo Feb2010
 
Ruby on Rails : First Mile
Ruby on Rails : First MileRuby on Rails : First Mile
Ruby on Rails : First Mile
 
Css sprite best practices
Css sprite best practicesCss sprite best practices
Css sprite best practices
 
Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)Web application intro + a bit of ruby (revised)
Web application intro + a bit of ruby (revised)
 
Merb For The Enterprise
Merb For The EnterpriseMerb For The Enterprise
Merb For The Enterprise
 
Úvod do Ruby on Rails
Úvod do Ruby on RailsÚvod do Ruby on Rails
Úvod do Ruby on Rails
 
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
[.Net开发交流会][2010.06.19]better framework better life(吕国宁)
 
Better Framework Better Life
Better Framework Better LifeBetter Framework Better Life
Better Framework Better Life
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
 
Ruby On Rails
Ruby On RailsRuby On Rails
Ruby On Rails
 
Ruby application based on http
Ruby application based on httpRuby application based on http
Ruby application based on http
 
Ruby on Rails Web Development Best Practices and Tips.pdf
Ruby on Rails Web Development Best Practices and Tips.pdfRuby on Rails Web Development Best Practices and Tips.pdf
Ruby on Rails Web Development Best Practices and Tips.pdf
 
Real World Technologies
Real World TechnologiesReal World Technologies
Real World Technologies
 
Aspose pdf
Aspose pdfAspose pdf
Aspose pdf
 

Recently uploaded

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 

Design Pattern From Java To Ruby

  • 1. Design Pattern -- from Java to Ruby Richard Ekohe www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 2. Why use Design Pattern  For reuse www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 3. Why use Design Pattern  For communication www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 4. Why use Design Pattern Define a Node interface, all of leaf nodes and internal nodes should implements the interface, internal nodes has a list that  For communication includes other internal nodes and leaf nodes and it can add and remove sub-nodes. But leaf node can’t have add sub-node method. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 5. Why use Design Pattern Define a Node interface, all of leaf nodes and internal nodes should implements the interface, internal nodes has a list that  For communication includes other internal nodes and leaf nodes and it can add and remove sub-nodes. But leaf node can’t have add sub-node method. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 6. Why use Design Pattern Define a Node interface, all of leaf nodes and internal nodes should implements the interface, internal nodes has a list that  For communication includes other internal nodes and leaf nodes and it can add and remove sub-nodes. But leaf node can’t have add sub-node method. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 7. Why use Design Pattern  For communication www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 8. Why use Design Pattern  For communication Composite Pattern www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 9. Why use Design Pattern  For communication Composite Pattern www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 10. Difference from java to ruby www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 11. Difference from java to ruby  Classes are Objects www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 12. Difference from java to ruby  Classes are Objects  Messages, not function call www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 13. Difference from java to ruby  Classes are Objects  Messages, not function call  Duck Typing www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 14. Difference from java to ruby  Classes are Objects  Messages, not function call  Duck Typing  Mixin www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 15. Singleton Pattern  ensures a class has only one instance, and provides a global point of access to it www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 16. Singleton Pattern www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 17. Singleton Pattern You are my only wife www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 18. Singleton Pattern You are my You are my only husband only wife www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 19. Singleton Pattern -- java www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 20. Singleton Pattern -- java  Eager loading www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 21. Singleton Pattern -- java  Eager loading  Lazy loading www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 22. Singleton Pattern -- ruby  Ruby built-in singleton www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 23. Singleton Pattern -- ruby  Ruby built-in singleton www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 24. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 25. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 26. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 27. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 28. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 29. Ruby for Design Pattern  Built-in (Singleton) www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 30. Observer Pattern  defines a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 31. Observer Pattern Subscribe Temperature Detector www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 32. Observer Pattern Subscribe Temprature Temperature changed Detector www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 33. Observer Pattern Notify Notify Subscribe Temprature Temperature changed Detector www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 34. Observer Pattern -- java  Define interface by yourself www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 35. Observer Pattern -- java  Define interface by yourself www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 36. Observer Pattern -- java  Define interface by yourself www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 37. Observer Pattern -- java  Define interface by yourself www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 38. Observer Pattern -- java  Define interface by yourself www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 39. Observer Pattern -- java  Define interface by yourself www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 40. Observer Pattern -- java  Java built-in observer www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 41. Observer Pattern -- java  Java built-in observer www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 42. Observer Pattern -- ruby  Ruby built-in observer www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 43. Observer Pattern -- ruby  Ruby built-in observer www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 44. Observer Pattern -- ruby  Ruby built-in observer www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 45. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 46. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 47. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 48. Ruby for Design Pattern  Built-in (Singleton, Observer)  Mixin www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 49. Iterator Pattern  provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 50. Iterator Pattern Count 1 2 3 10 www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 51. Iterator Pattern -- java  Java built-in Iterator and mock Iterator www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
  • 52. Iterator Pattern -- java  Java built-in Iterator and mock Iterator www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
  • 53. Iterator Pattern -- java  Java built-in Iterator and mock Iterator www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
  • 54. Iterator Pattern -- java  Java built-in Iterator and mock Iterator www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Merb - Offshore Web Development
  • 55. Iterator Pattern -- ruby  Nothing, just .each www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 56. Iterator Pattern -- ruby  Nothing, just .each www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 57. Iterator Pattern -- ruby  Nothing, just .each www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 58. Ruby for Design Pattern  Built-in (Singleton, Observer, Iterator)  Mixin www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 59. Simple Factory Pattern  returns an instance of one of several possible classes, depending on the data provided to it. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 60. Simple Factory Pattern www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 61. Simple Factory Pattern -- java  Compare with String, a lot of if/else www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 62. Simple Factory Pattern -- java  Compare with String, a lot of if/else www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 63. Simple Factory Pattern -- java  Compare with String, a lot of if/else www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 64. Simple Factory Pattern -- java  Compare with String, a lot of if/else www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 65. Simple Factory Pattern -- java  Compare with String, a lot of if/else www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 66. Simple Factory Pattern -- java  Compare with String, a lot of if/else www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 67. Simple Factory Pattern -- ruby  Classes are Objects www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 68. Simple Factory Pattern -- ruby  Classes are Objects www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 69. Simple Factory Pattern -- ruby  Classes are Objects www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 70. Simple Factory Pattern -- ruby  Classes are Objects www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 71. Ruby for Design Pattern  Built-in (Singleton, Observer, Iterator)‫‏‬  Mixin  Classes are Objects www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 72. Command Pattern  encapsulates a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations. www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 73. Command Pattern www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 74. Command Pattern -- java www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 75. Command Pattern -- java www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 76. Command Pattern -- java www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 77. Command Pattern -- java www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 78. Command Pattern -- java www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 79. Command Pattern -- ruby  Proc www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 80. Command Pattern -- ruby  Proc www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 81. Ruby for Design Pattern  Built-in (Singleton, Observer, Iterator)‫‏‬  Mixin  Classes are Objects  Proc www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 82. Other Design Patterns Make use of ruby advantage www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 83. Ruby's Principle www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 84. Ruby's Principle  DRY – Don't Repeat Yourself www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 85. Ruby's Principle  DRY – Don't Repeat Yourself  Convention Over Configuration www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 86. Resources  Design Pattern – Elements of Reusable Object-Oriented Software Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides  Head First Design Pattern Kathy Sierra, Bert Bates  Design Pattern in Ruby Russ Olsen www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development
  • 87. Q&A happy to discuss and fix my mistakes www.ekohe.com Web Development & Graphic Design China Ruby on Rails Development - Rails Consulting - Rails Services - Merb - Offshore Web Development