Oleg Andreev



Software designer with focus on user experience and security.

You may start with my selection of articles on Bitcoin.

Переводы некоторых статей на русский.



Product architect at Chain.

Author of Gitbox version control app.

Author of CoreBitcoin, a Bitcoin toolkit for Objective-C.

Author of BTCRuby, a Bitcoin toolkit for Ruby.

Former lead dev of FunGolf GPS, the best golfer's personal assistant.



I am happy to give you an interview or provide you with a consultation.
I am very interested in innovative ways to secure property and personal interactions: all the way from cryptography to user interfaces. I am not interested in trading, mining or building exchanges.

This blog enlightens people thanks to your generous donations: 1TipsuQ7CSqfQsjA9KU5jarSB1AnrVLLo

Re: Stop picking on alias_method_chain

Both Ben and Yehuda are wrong. They both use messy metaprogramming where Ruby has a nice solution already. It is a chain of modules and a super method. If the base functionality is provided in a module it looks like this:

module BaseFeatures
  def hello
    "Hello, world!"
  end
end

module AnyGreetingPlugin
  def hello(arg = "world")
    super.sub(/world/, arg)
  end
end

class MyConfiguration
  include BaseFeatures
  include AnyGreetingPlugin
  include AnotherPlugin
end
If your base functionality is packed in a class, rather than in a module — no problem, the solution is pretty much the same:
class MyConfiguration < BaseFeatures
  include AnyGreetingPlugin
  include AnotherPlugin
end

Now let me respond to each point from the Ben’s article:

1. “The method names don’t properly describe what is going on”. Module name describes what particular functionality it adds to the methods it contains.

2. “The base method shouldn’t care what other modules are doing, modularity is broken”. That’s not the case when you use regular modules.

3. “Logic is not 100% contained”. Logic is 100% contained: no magical macros anywhere.

4. “Promotes messy code”. Again, nothing to even seem messy.

5. “Exposes a documentation flaw”. When you think modules it is easy to separate concerns and understand how every little aspect of functionality affects everything else. You don’t have to speak any other language except Ruby. You think of module chains and message passing: no structure is created dynamically where not necessary. Only thing you have to do: describe in the documentation what this particular class or module is supposed to do. Then provide examples of a default configurations (when some modules are included in a single class) to make the picture complete. Respect the language. Keep it simple, stupid.