Tight coupling vs. complete abstraction

T

Trans

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top