Do they belong to you? Claim these comments.
Me
Is this you? Claim Profile »
6 months ago
in I’m not moving from Textmate to Emacs or Vim on smarticus-blogThe Prags say pick one editor and learn it well, and I think it’s good advice. Somewhere between five and eight years ago I surveyed the mishmash of editors I had used, surveyed the field of editors available, and decided Emacs was the only one that offered the features I was looking for. I dedicated myself to learning Emacs. It probably took a good six months to become really comfortable with it, and I’m still learning things about it to this day. But at this stage I’ve become sufficiently one with the tool that I can’t imagine being as productive in anything else.
I really don’t get all editor fad-ism going on in Ruby/Rails land. The only thing I can figure is that a lot of these people were still stuck in the “use whatever <span class="caps">IDE</span> comes with the language stack” mindset, and Ruby/Rails work was the first time they realized they could and must choose their own. So I guess it’s a good thing.
To my mind the only reason to switch tools is if you see someone doing things in another tool that a) you can’t imagine doing in your usual tool; and b) once you’ve seen them, you can’t stand living without. Once you switch, pursue mastery. A lot of people know only the fraction of their tools’ capabilities, which I suspect is one of the reasons they are susceptible to these tool fads.
I can think of only once exception to the rule of sticking with one editor. Occasionally there are tools so well-integrated into a language that it behooves you to make the adjustment when using that language. The two examples that come to mind are the various Smalltalk browsers, and Eclipse for Java. The first because only a tool integrated with the running Smalltalk image can expose the full power of Smalltalk; and the latter because you need something which will take care of manual drudge-work for you if you’re going to work with a language as tedious as Java.
For languages which don’t have a language/editor symbiosis that strong, I say pick one editor, learn it well, and stick with it.
11 months ago
in Phenomenal Cosmic Power on Virtuous Code1 year ago
in Sustainable Development in Ruby, Part 2: Method Injection on Virtuous Code1. To quote Knuth, premature optimization is the root of all evil ;-) Considering that our mythical Flying Monkey Transport Protocol probably has a packet latency measured in hours, I suspect that this is the least of their performance problems.
2. See the introduction to this series. If two separate pieces of code independently try to add the same method, it's no longer a method addition and becomes an inadvertent method redefinition.
3a. I apply YAGNI pretty religiously. I used to code based on the "we'll need it someday" principle a long time ago, and it never got me anywhere good.
3b. Reuse is not the only reason to extract code into a method. Other reasons include readability and enforcing the Single Responsibility Principle. The code that calls #end? is not concerned with how we know that the message is at the end, but with what to do if it is. Having the implementation details of how we know at that point is a distraction from the core purpose of the code.
But this kind of misses the point anyway, because this is demo code which I have deliberately kept simple in order to focus on the techniques being presented. In the real world #end? might very well be a more complicated (and distracting) algorithm.
1 year ago
in Why Your Social Website Should Support OpenID on Virtuous CodeI'm not concerned so much about the issue of centralization - I am my own OpenID provider. (And yes, I realize that I am in the minority in that). The fact that I *can* be my own provider, though, makes OpenID less centralized than previous attempts at single sign-on.
I could probably be convinced that OpenID is not the best solution, although it would take concrete examples of better solutions. What I am not interested in is people telling me that it serves no purpose. It serves me well, and if it is flawed I want to hear about improvements, not hand-waving about how nobody needs it anyway.
1 year ago
in Why Your Social Website Should Support OpenID on Virtuous Code1 year ago
in Announcing Ninja-Patching! on Virtuous Code1 year ago
in Sustainable Development in Ruby, Part 1: Good Old-Fashioned Inheritance on Virtuous Code1 year ago
in Monkeypatching is Destroying Ruby on Virtuous Code> You do monkey-patch in your NullDB. You reopen AR::Base to add a nulldb_connection method.
True. This, unfortunately, is part of the contract of the
ActiveRecord connection adapter API - you are expected to do this if
you want connection_establish :adapter => :foo to work. Whether this
is a true "monkey patch" is debatable; a lot of people only consider
such a thing a monkey patch if it actually *redefines* existing
methods. Of course, the Rails guys could easily have avoided the
whole question by giving us a less-silly API that allowed us to simply
register a new database connection class.
> Subclassing isn't always possible. With AR::Base subclasses have special
> semantic meaning, ie. Single Table Inheritance. That is why everything with
> ActiveRecord is done through mix-ins +/or eval. (You can subclass AR::Base
> not for STI but it's a pain)
It's not a pain, you just set abstract_class = true.
> Whether it is the Rails framework or a plugin, understand it enough to debug
> it. Then you can eval as much as you like.
This is easy to say, but in real world large projects it simply isn't
feasible to understand all of the code in the project, let alone all
of the third-party code it depends on. That is why community
conventions are essential for maintainability.
Thanks for the comment!
1 year ago
in alias_method_chain :alias_method_chain, :awesome (or, how I learned to stop worrying and made Python nation and anyone else afraid of monkey-patching my bitch) on Pat MaddoxI actually think *alias_method_chain* is slightly less dangerous than some other techniques, because at least it's a convention and a way to avoid silently stomping existing methods. But that's a good technique for the environments where *alias_method_chain* is available, and I may utilize it next time I'm debugging unexpected behavior in Rails. Thanks!