In today’s free Monday episode of RubyTapas, some thoughts on how to enable method logic to remain stable and unchanged while evolving and changing the source and scope of the values used by the logic.

httpv://youtube.com/watch?v=7SSc1mQ4-Ck

[boilerplate bypath=”rubytapas-sample”]

Published by Avdi Grimm

11 Comments

  1. Well done, very informative and got me thinking. I would be interested to see how you would see this playing into rails views.

    Reply
  2. Great episode, and I love the Discworld reference 🙂

    Reply
  3. This episode was really good.

    Reply
  4. I always thought which version is better:

    def full_name; “#{@first_name} #{@last_name}”; end
    def full_name; “#{first_name} #{last_name}”; end

    So you’re suggesting to stick with the second variant when there’s attr_reader for both :first_name and :full_name specified?

    Reply
  5. […] RubyTapas Episode 4: Barewords (Eric) […]

    Reply
  6. Thank you for this episode. I was wondering, what emacs stuff do you use to do that ‘evaluate and insert as comment’ trick?

    Reply
  7. Great video, and a neat pattern. Elixir has a similar mechanism — mixfiles take advantage of it (see deps):

    defmodule MyApp.Mixfile do
    def project do
    […,
    deps: deps]
    end

    defp deps do
    [{:ecto, “~> 0.3.0”}]
    end
    end

    When reading more complex code, barewords for function calls does make the references harder to trace; you have to check multiple contexts to know how a reference is being resolved. I rambled about that here: http://jtmoulia.pocketknife.io/blog/2015/03/12/elixir-fun-call-parens/

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *