Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Design Patterns

design patterns oop programming

  • Please log in to reply
4 replies to this topic

#1 Andre Dublin

Andre Dublin

    Signalman

  • Members
  • 13 posts
  • LocationCharleston, SC

Posted 15 August 2013 - 02:21 AM

I've always been a fan of learning design patterns. There like the puzzle pieces of programming you fit together to make this run smoothly and code look sexy as hell.

 

So lets get this conversation rolling.

 

  1. What are some of your most used patterns?
  2. What have you learned from that code design pattern?
  3. Have you picked up on any new design patterns and if so what have they taught you?

 

1) For me its been the repository pattern since I write c# for work.  It separates my controller/view code from the database layer by providing interface abstractions to the data layer.  I quite enjoy it since it keeps things fairly separate and easy to change.

 

2) What I've learned from this is that code changes... a lot. Its tough to predict what design pattern to use, and you should never go in with the mind set of using a design pattern, thats the domain or business layers job.  I've also learned about really making your code as agnostic and dumb to other modules/namespaces etc from each other so you don't start tripping over your feet once you are waist deep in software.

 

3) Lately I've been reading up on DCI in Ruby and the Metaphor pattern in Rails.

 

More about the metaphor pattern

 

I would like to bring these paradigms to other languages like Javascript and c#.  I haven't gotten to far in DCI, but the metaphor pattern has me fleshing out my controllers to use more method signatures for object state instead of a bunch of if/else control statements.


Edited by Andre Dublin, 15 August 2013 - 02:23 AM.

  • Kelli Shaver likes this

#2 artiyousharma

artiyousharma

    Passenger

  • Members
  • 7 posts

Posted 16 August 2013 - 12:11 PM

such a really good information your video are very informative



#3 AstonJ

AstonJ

    Dispatcher

  • Members
  • 35 posts

Posted 16 August 2013 - 12:30 PM

Not sure I have a favourite DP, but I LOVE Design Patterns in Ruby by Russ Olsen :) (I mini-reviewed it here Best way to learn Rails)


:)


#4 Kevin

Kevin

    Signalman

  • Members
  • 21 posts

Posted 02 October 2013 - 02:21 PM

strategy pattern would be a choice when you're faced with many if-then conditions.

Actually, I don't have any favourites pattern.



#5 Rowel

Rowel

    Controller

  • Members
  • 109 posts

Posted 02 October 2013 - 06:44 PM

My favorite design pattern is the "path of least resistance." :) 






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users