Front Page › Forums › MOOM › Q&A Thread #5 – what are your questions for Betsy Haibel and Avdi?
-
Q&A Thread #5 – what are your questions for Betsy Haibel and Avdi?
Posted by [email protected] on 2018-02-15 at 13:52Before becoming a software developer and architect, Betsy was a professional theatrical set designer. She has a deep knowledge of Ruby and Rails, is co-founder of wecohere.com, and is a full-stack web developer who brings a fresh approach to our world. Learn more about Betsy at http://betsyhaibel.com/ or twitter @bestythemuffin.
The URL for this session will be: https://www.youtube.com/watch?v=kPZA6YJi_ec
The Q&A will go live at that URL on Thursday, February 22nd at 12:00 noon EST. Mark your calendar!
Cheers – Robin (Avdi’s helper)
replied 5 years, 6 months ago 0 Member · 9 Replies -
9 Replies
-
Let’s assume there is a piece of the functionality expected to be implement in the future like
class Workflow
def call
step_one
step_two
custom_step.call # expected to be implemented later
endprivate
def initialize(custom_step: NonExistingClass.new(self))
@custom_step = custom_sep
enddef step_one; end
def step_two; end
endwhat would you do
- leave implementation for later?
- use null object following Nothing is Something’
- sth else?
@avdi if I remember you said you sometimes use mocks for things that don’t exist yet, how that woks/looks in your classes? Could you describe how would you implement two collaborating classes using TDD and mocks?
-
Here’s a question I’ve used to divide teams of Ruby programmers with hours of disagreement:
Should domain objects persist themselves? -
Hello Betsy and Avdi!
I have been struggling recently with a large complex mass of code that is written procedurally in services. Each service has a perform method that gets called, and those perform methods are more or less a list of private methods that are called in order. To make it even more of a challenging, those services call other services that are themselves large, procedural, and complex. I’m having trouble keeping it all in my head, let alone knowing where to start looking for an abstraction. I know that in the course we talked about being ok with writing more procedural code sometimes rather than settling on the wrong abstraction, but this code has grown to a point where it is getting difficult to manage. Would you have any words of advice for finding the seams in code that has been written procedurally so that I find those hidden objects
Another question for Betsy I’d love to hear about how has your work as a theatrical set designer informed or influenced your work as a programmer!
Thanks y’all!!!
-
RailsConf 2016 – Get a Whiff of This by Sandi Metz is great place to start learning about refactoring
-
-
Week 5 had some interesting ideas I read about before that use polymorphism to get different behavior for the same message, like the Null Object and the Special Case pattern.
The application I’m working on at work is littered with conditionals all over the views (not only, but lets focus on the views). In your experience, did you ever go over a complete revamp in order to abstract all these conditionals (which a lot of times have several lines of HTML in each branch) into proper objects/partials/decorators? Or do you usually use these techniques only where they make most sense / where you can see a good match for that style?
I remember reading something about people trying to have views that are logic-less. I guess this is a technique to remind you to keep logic in objects and thus more naturally use special cases and null objects?
(Bottom line, sometimes I get a bit overwhelmed by the amount of conditionals we have in a 3 years old app. And I get the feeling that I would end up with huge objects/decorators just to account for every small variation we have on the views themselves.)
-
My set design & software architecture talk: http://confreaks.tv/videos/rubyconf2017-set-design-putting-the-art-in-architecture
-
Thanks Betsy! This was a really great Q&A; thanks to you and Avdi for the thoughtful answers. I am definitely going to check out your talk!
That is really interesting to think about what limitations we have to work in. I know for me, being a parent has been a limitation that forces me to be efficient and productive during the day because time outside of work is mostly taken up by the kiddos lol. In light of your comments, it’s cool to think about how I can use that limitation in positive ways.
-
-
First off, thanks so much for the Q&A!
I wanted to follow up on the idea of Railway-Oriented Programming that Betsy mentioned, and see if anyone had any ideas about implementation details (especially in an OO context)
It looks like this is the canonical blog post for explaining ROP: https://fsharpforfunandprofit.com/posts/recipe-part2/ – basically:
- there are a sequence of checks or steps performed as a procedure, set up like a pipeline
- each step returns either a success* (wrapping any useful information and/or results), or an error* (wrapping something like an error message)
- when a step receives an error as an input, the execution halts, and the error is returned
(Note that it returns a wrapper structure called error, it does not throw an exception)
I can see the appeal of this – the work I do right now goes through a handful of preflight validation (checking inventory, checking timelines, checking whitelists) and work-performing steps. I only care about the point at which the process fails. I don’t need a dedicated state captured for each type of failure (like a lifecycle object). Looser states (say failing at validation, or purchase, or fulfillment) don’t capture the reason for the error, unless I add an extra field somewhere, which my gut says is overkill.
Has anyone implemented something like this in Ruby (either rolling-your-own, or using a library) and would you describe it as (pardon the pun) as success or error?
Log in to reply.