VIM is good for your health!
Thanks to my good friend and mentor Jerry Jackson forcing me to practice every day until I grew to like it, I am a die hard VIM user. To me it is just a much faster way to write code and edit text in general.
Once upon a time I was suffering from repetitive stress injuries to my mouse hand from long hours of 3D modeling and graphic design. Once I started to move away from the creative side of things and more to development (and thus using VIM regularly) that all went away.
Several weeks ago I began a new project here at my day job. For reasons of practicality I have been forced to deal with the evils of a more traditional IDE. The IDE in question is Visual Studio .NET (don’t get me started on how much I hate .NET – I will save that for a much longer and more thorough article).
Earlier today I noticed the all too familiar discomfort and tightness in the connective tissues of my wrist. The constant in all of this is the percentage of time I am using my mouse. The mouse is just VERY bad for your hands and wrist. With VIM you rarely leave the home row… the mouse becomes “that weird thing on your desk that you don’t use anymore”.
Hopefully I will be done with this project soon and be able to move back to some Rails projects where I can be back at home with a text editor that doesn’t hurt to use. Yet another compelling reason to stick with that archaic, esoteric old thing known as VI improved!
Fun with Ruby blocks, modules, class inheritance, and “super”
The situation: A class, it’s descendant, and a module included in the parent class all have a method of the same name. Calling super from the child’s method causes a call to the parent class and not the module…
module Something
def foo(&block)
puts "Hello Module,"
yield
puts "Goodbye Module... it was nice knowing you. "
end
end
class ParentFun
include Something
def foo(&block)
puts "Hello Parent,"
yield
puts "Goodbye Parent.. it was nice knowing you"
end
end
class ChildFun < ParentFun
def foo
super do
puts "I am a Child."
end
end
end
ChildFun.new.foo #=>
# Hello Parent,
# I am a Child.
# Goodbye Parent.. it was nice knowing you
Now put the module include in the Child class instead of Parent.
module Something
def foo(&block)
puts "Hello Module,"
yield
puts "Goodbye Module... it was nice knowing you. "
end
end
class ParentFun
def foo(&block)
puts "Hello Parent,"
yield
puts "Goodbye Parent.. it was nice knowing you"
end
end
class ChildFun < ParentFun
include Something
def foo
super do
puts "I am a Child."
end
end
end
ChildFun.new.foo #=>
# Hello Module,
# I am a Child.
# Goodbye Module... it was nice knowing you.
Interesting.