Tight coupling vs. complete abstraction

On n’ off I’ve been thinking about something Ruby allows one to do more
so than most other languages --in many usecases it allows one to
construct a program that is tightly coupled to the language interpretor
itself rather than use the langage to create a complete abatraction of
the problem. To give an example of what I mean consider Facets[1]
command line tool:

cat greet

#!/usr/bin/ruby

require ‘facets’
require ‘command’

MyCmd < Console::Command

def __who(v)
  @who = v
end

def hello
  puts "Hello, #{@who}!"
end

end

greet --who Mom hello
Hello, Mom!

Notice how the functionality of the command line is strongly tied to
the functionality of Ruby’s method calls. ConsoleCommand does a lot of
neat metaprogramming tricks to send the right message to the right
place with the right data depending on arity of the methods defined ,
etc.

Coding like things can make many programming chores dirt simple,
becuase there’s no need to learn YAAPI (Yet Another API). But there can
be some unexpected side effects. For instance there is potential for
name clashes with built-in methods. Now most of these problems can be
mitigated but no doubt there’s alwys that overlooked case, and ther are
some edge uses that simply have to be avoided.

So I’m wondering, is it worth it? Does the simplicity of tight coupling
outweigh it’s potential pitfalls? Or is there a better way to
essentially get the best of both worlds? What do other’s think of this
techinque of coding?

T.

[1] http://facets.rubyforrge.org

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs