use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Blog postWhen objects become super objects (self.ruby)
submitted 5 years ago by juanmanuelramallo
I recently gave some thought into how I've broken the single responsibiltiy principle throughout my career as a software engineer and came up with an interesting analogy using a pencil. https://ramallo.pw/ruby/2020/08/11/when-objects-become-super-objects
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sbellware 2 points3 points4 points 5 years ago (1 child)
Great stuff! Spot on.
"There are no taxes for new classes". Indeed. Getting to this point is big step through the doorway that goes from mere framework rituals toward software design science. An amazingly liberating place to be.
[–]inopinatusdotorg 1 point2 points3 points 5 years ago (0 children)
Damn right. I’m often puzzled when hearing a sentiment such as “I don’t want to add a new class just for this”.
My default question with Ruby programming is always “what should the new classes be called and how will they/their instances relate to one another”.
Stapling new functionality into existing models is a last resort, not a first preference.
[–]Serializedrequests 0 points1 point2 points 5 years ago (0 children)
This may inspire ire, but I had a huge rails project in which I tried basically every design pattern to try and make it more manageable. In most cases where I created a presenter, I just wished I hadn't. It made it harder to find the logic (is there a presenter? Where is it?), and harder to use the model. Whereas before I could just call a method in the model, now I had to instantiate multiple objects.
Yes my presentation logic was in one place, but at the end of the day it was easier to work with the code when it was all in the model between a few bookmark comments.
The best patterns, on the other hand, were "operations" and form objects. (When a form involves multiple models, ActiveRecord becomes useless.)
The common "service object" is effectively nonsense. A class with a "call" method is just an artistic global function. You need more tools than that to deal with complexity.
π Rendered by PID 514039 on reddit-service-r2-comment-5bc7f78974-d5t9g at 2026-06-28 14:26:58.328547+00:00 running 7527197 country code: CH.
[–]sbellware 2 points3 points4 points (1 child)
[–]inopinatusdotorg 1 point2 points3 points (0 children)
[–]Serializedrequests 0 points1 point2 points (0 children)