#277 in Computers & technology books
Use arrows to jump to the previous/next product

Reddit mentions of Design Patterns in Ruby

Sentiment score: 9
Reddit mentions: 20

We found 20 Reddit mentions of Design Patterns in Ruby. Here are the top ones.

Design Patterns in Ruby
Buying options
View on Amazon.com
or
Specs:
Height9.3 Inches
Length7.1 Inches
Number of items1
Weight1.7857443222 Pounds
Width1 Inches

idea-bulb Interested in what Redditors like? Check out our Shuffle feature

Shuffle: random products popular on Reddit

Found 20 comments on Design Patterns in Ruby:

u/Fiend · 6 pointsr/ruby

Design Patterns In Ruby - Russ Olsen

u/MetalMikey666 · 5 pointsr/ruby

My path back when I was a rubyist was;

​

u/rebo · 2 pointsr/programming

I'd also recommend Design Patterns in Ruby : http://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/0321490452

It's very straight forward and readable.

u/dacat · 2 pointsr/ruby

Ruby by Example

Design Patterns

Well Grounded Rubyist

by the time you finish those three.. you will know what you want to move to.

u/InanePenguin · 2 pointsr/ruby

Are you looking for something to teach you specifically ruby syntax or something a little less syntax heavy? I'd HIGHLY recommend Design Patterns in Ruby by Russ Olsen.

It's answered so many common problems I have run into and have to work around. To me it seems like pretty advanced thinking/techniques but I'm not sure your level. Either way, it should provide some great insight! He dedicates a chapter to reviewing Ruby so maybe that would at least help some.

u/djcp · 2 pointsr/rails

That article is specifically about legacy apps, and as such the good examples can be a little out of date. For instance:

class User < ActiveRecord::Base
scope :active, -> { where(active: true) }
scope :by_last_login_at, -> { order(:last_login_at) }
end

would just be:

class User < ActiveRecord::Base
def self.active
where(active: true)
end
def self.by_last_login_at
order(:last_login_at)
end
end

in a more modern codebase. Also, I think it's perfectly fine to use sql outside of models when you've extracted a bit of functionality into a service object. I think the nuance here might be articulated as "don't use sql in controllers, views, or other places it doesn't belong."

I agree with most of it, especially "extracting rake tasks to classes". If you're in the habit of extracting service objects to define interactions between things, you can frequently use these to make writing rake tasks easier, too and vice-versa.

Random things:

We created Hound as a hosted style checker, and I'm pretty fond of our guides.

I've worked on projects where we ran rubocop as part of a default rake. Took some care and feeding but it was handy.

You might also check out bundle-audit and brakeman.

Codeclimate does some very clever static analysis to find issues too, very worth it.

If you're looking for info about design patterns, I love Design Patterns in Ruby.

u/oaddit · 2 pointsr/ruby

Design patterns in Ruby is great for this. Much more lighter and entertaining than it sounds, and a fantastic introduction to both OOP design patterns and more advanced Ruby techniques.

u/brandonhilkert · 2 pointsr/ruby

This isn't dedicated to algorithms, but I think of it in the same category. It's one of the few patterns books not in Java: http://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/0321490452

u/kichael · 1 pointr/rails

My favorite is the book design patterns in ruby

u/zaclacgit · 1 pointr/rubyonrails

Answers to follow, but try to make sure that you're not being overzealous in your attempts to learn Ruby. Questions about general code methodology are good, but in order to really understand and apply them you'll have to have a pretty solid grasp on the basics.

Despite how it may seem, you might be making it harder on yourself by trying to "skip ahead" and start applying later concepts early on.

There's a reason the first program most people write doesn't involve creating a Person class that responds to greet_with_hello(world).

If you've simply finished the Rails tutorial and want some Ruby experience, I'd recommend giving The Well-Grounded Rubyist a try. Many people in your position have done very well by it, and it will teach you what you need to know as you need to know it.

But as for your actual questions.

>What is the best resource to learn general code methodology and syntax, language agnostic. I'm picking things up what I would consider to be pretty quickly, but I know being able to learn about general themes and syntax of coding would help immensely.

Syntax is inherently tied to the language you're using. While there are similarities between some languages, there's no general "Guide to Syntax" that you would need to worry about. Happily, many people find that syntax is the easiest thing to pick up while learning an additional language. The general concepts are what you learn the first time, and then you learn "How do you do loops in C++ again?"

So don't worry about syntax.

However, Ruby does have the Ruby Style Guide that will answer questions about how to make your code look. As you'll find is the case with many things in Ruby, the style guide is not written in stone. It's just a good idea, most of the time.

With that out of the way, we can move on to things that are not language specific. Well, sort of.

Data Structures, Algorithms, and Design Patterns are established ways of doing or handling certain tasks. In theory/abstract, these are language agnostic. In practice, application or use can vary between languages.

There are a handful of decent books that will instruct you on advanced data structures and algorithms. I would visit /r/learnprogramming and peruse their sidebar for recommendations. That being said, I have yet to find a book written with examples in Ruby though. If you're completely unfamiliar with other languages then you might want to find something that deals in some sort of pseudocode.

It might be difficult to translate the concepts that are presented in pseudocode (or whatever language the book chooses) into Ruby. Especially if you are not decently comfortable with solving problems in Ruby, and thinking about problems in Ruby.

However, there are some books out there on how to design things in Ruby. They happen to be really good books too. I've honestly lost count of how many times I've recommended them, let alone how many time I've seen them recommended.

Practical Object-Oriented Design in Ruby will essentially guide you through learning what should and should not go into an object, and when to make those decisions. It is an eminently readable book, and conveys the information in concise and graspable fashion.

But if you're not in a position where you're really comfortable with the idea of what Objects are, and how you create/use them in Ruby, this book might be best saved for after you get a handle on the basics of that stuff.

In fact, most people seem to get the most benefit out of this book after they should have already read (and heeded) it. Sort of a situation where the right way makes the most sense only after you've been doing it the wrong way.

Secondly, Design Patterns in Ruby will show you how several common ways of doing things are utilized in Ruby. Personally, I read POODR before Design Patterns in Ruby, but I'm not aware of any reason read them in any particular order.

I'll reiterate that both of these books have general design concepts inside of them, but that they are dyed-in-the-wool Ruby books. You will absolutely learn things that you can take elsewhere, but it won't come to you in a purely abstracted manner.

>Is there a list of all the predefined calls in Ruby that I can find somewhere. Occasionally I write to do something only to find out that I'm breaking down a process that is shortened already. I'm sure these are commonplace for people who have coding experience before starting Ruby, but that's not a luxury that I'm afforded.

Absolutely! It's at Ruby Docs.

Don't get yourself down on this one. In this very particular case you might be a little better off than someone that has a bunch of programming experience in other languages.

Why you ask?

Lots of people aren't necessarily expecting the ease in which you can cause things to happen in Ruby with just a few method calls. They are waaaaaaaaaaaaaaay more used to breaking things down into smaller problems as a matter of necessity than you are. So congrats! Fewer habits to break there!

You can actually just google "ruby docs class-name" for whatever class you're working with to see what methods are available to you out of the box and what those methods do.

As a recommendation, I'd get pretty familiar with the module Enumerable, and check out the Array class. You'll end up using those a lot.

Like a whole lot.

In case you're curious, the awesomeness found in Enumerable is usually where people with prior programming experience tend to make things harder on themselves, because they're use to things being harder on them. A one line split, sort, and join is just a thing of beauty.

>Lastly if there was anything that really helped you that I didn't mention I'm open to any suggestions really.

In all honesty, what really helped me the most in learning Ruby was getting really comfortable with the syntax, and then learning what to do after that.

RubyMonk is probably one of the best places I've used to get a guide through Ruby, even advanced topics.

CodeWars is a good way to give your mind a nice stretch and workout. You'll just solve little problems that force you to make sure you know how to use Ruby when you need it.

After you're comfortable with the language, start making some small projects.

Games are usually a good first start. They have clearly defined rules and orders of events, as well as lots of things that are easy to recognize as objects.

Black Jack, Tic-Tac-Toe, MasterMind, BattleShip, and Chess are all pretty good projects to work on, and maybe in that order too.

Somewhere around then end of Tic-Tac-Toe or MasterMind I'd probably crack open POODR and giving it a read through. The value of all the lessons might not make complete sense at first, but it's that way with everybody. Just trust the author and go along with it.

Lastly, and I can not stress this enough, learn how to write and use tests for your code.

I know. It seems like tests are a waste of time. You're writing them before you're even really writing the code. On top of that, you already know how you want to do the thing you want to do, and it'll work!

Trust me. If the thing you're making is at all complicated, write some tests.

If you're ever going to want to change anything about it, write tests for it.

It will save you an incredible amount of time when you start breaking things, and will also give you the confidence that things probably aren't broken after you've fixed them.

Also, feel free to ignore everything I said about not jumping too far ahead. People learn in different ways, and desire to learn in different ways. If you feel like learning more advanced concepts now is going to be way more interesting for you, then you should totally do so.

u/danwin · 1 pointr/ruby

Well, while we're on the topic, I'll recommend another book I've liked ;)

"Design Patterns in Ruby" by Russ Olsen

http://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/0321490452

It covers Gang of Four patterns (well, most of them) except in Ruby...an extremely helpful reference and very readable...my only caveat is that if you get it for Kindle, the code is not particularly well-formatted.

u/vxxn · 1 pointr/ruby

I mispoke (somebody else in thread linked it), but Russ Olsen most definitely wrote a great book on patterns.

http://www.amazon.co.uk/Design-Patterns-Ruby-Addison-Wesley-Professional/dp/0321490452

u/rodreegez · 1 pointr/rails

I second the comment to learn SQL really well. Also regular expressions come up frequently enough to be worth learning a bit about. Some familiarity with data structures is worth picking up, and getting a grasp on some common design patterns is well worth the time.

On the last point, I’d recommend Design Patterns in Ruby and Refactoring Ruby

Hope that helps.

u/chris_ledett · -5 pointsr/ruby

Fucking moron, i think you missed the most important one? http://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/0321490452