# Tight coupling vs. complete abstraction

**URL:** <https://www.ruby-forum.com/t/tight-coupling-vs-complete-abstraction/74048>\
**Category:** Ruby\
**Created:** [October 29, 2006, 2:50pm UTC](https://www.ruby-forum.com/t/tight-coupling-vs-complete-abstraction/74048 "2006-10-29T14:50:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/dfb087/32.png) [@Trans](https://www.ruby-forum.com/u/Trans)\
**Post date:** [October 29, 2006, 2:50pm UTC](https://www.ruby-forum.com/t/tight-coupling-vs-complete-abstraction/74048/1 "2006-10-29T14:50:50Z")

</div>

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](http://facets.rubyforrge.org)
