# Lost in "=", forest searching for methods of abstraction (bad habits die hard)

**URL:** <https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695>\
**Category:** Ruby\
**Created:** [February 10, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695 "2008-02-10T17:55:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 10, 2008, 5:55pm UTC](https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695/1 "2008-02-10T17:55:33Z")

</div>

Hello,

I have done few years of programming in Clipper and few more in MS  
Access (experience not worth repeating).

Since then I have being using ruby (sporadically and not for big  
projects), but with a bad style (I recognised this, when trying to  
write something bigger).

When I see projects like rspec, sequel and ramaze, I am amazed what is  
possible with ruby.

The question is, what concepts are necessary to grasp to be able to  
create something like that (in ruby), and, is there a good read  
(preferably on-line) about them?

Vlad

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 10, 2008, 6:04pm UTC](https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695/2 "2008-02-10T18:04:08Z")

</div>

Vladimir K. wrote:

> The question is, what concepts are necessary to grasp to be able to  
> create something like that (in ruby), and, is there a good read  
> (preferably on-line) about them?
> 
> Vlad

Some of the most interesting things about projects like rspec are their  
DSL features. This is: they manipulate the ruby language itself into  
something more specific to the domain for which they are writing their  
application. Creating effective DSLs is probably one of the most  
complicated processes in ruby and touches on everything from ruby’s open  
classes to meta-programming to special ruby methods (method missing and  
send).

I’d recommend starting from the ground up with a couple of great books:  
why’s poignant guide to ruby, programming ruby (first edition free  
online). If you want to throw down some cash I’m really liking Hal  
Fulton’s The Ruby Way. Also, check out the ruby blogs out there! Tons of  
good info on the more “hardcore” aspects of ruby.

- Drew

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 10, 2008, 6:19pm UTC](https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695/3 "2008-02-10T18:19:06Z")

</div>

> Vladimir K. wrote:
> 
> > The question is, what concepts are necessary to grasp to be able to  
> > create something like that (in ruby), and, is there a good read  
> > (preferably on-line) about them?
> > 
> > Vlad

Try writing Ruby code to look like english. If you focus on making  
things look nice like that, most of it will fall into place. You can  
do your project in english, but the hard part is doing it in Ruby. So  
why not make Ruby do your project in english!

Ari  
--------------------------------------------|  
If you’re not living on the edge,  
then you’re just wasting space.

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 11, 2008, 1:50pm UTC](https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695/4 "2008-02-11T13:50:19Z")

</div>

2008/2/10, Vladimir K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Since then I have being using ruby (sporadically and not for big  
> projects), but with a bad style (I recognised this, when trying to  
> write something bigger).
> 
> When I see projects like rspec, sequel and ramaze, I am amazed what is  
> possible with ruby.
> 
> The question is, what concepts are necessary to grasp to be able to  
> create something like that (in ruby), and, is there a good read  
> (preferably on-line) about them?

There are some fundamental principles in software engineering that  
apply regardless of programming language chosen: basically you have to  
carefully think about how you distribute functionality across  
different programming artifacts (methods, functions, classes and the  
like). In other words, complex systems are built by divide and conquer  
and abstraction. There are different methodologies (top down, bottom  
up, various OO approaches) but they all try to come up with a  
distribution of functionality that avoids redundancies (ideally no two  
methods / classes that do the same) and keeps things modular (so you  
can easier reuse).

Off the top of my head I could not recommend a book or other resource  
that will teach this. I tend to believe that, to a good extend, this  
is learned from experience. Maybe looking into OO patterns can help,  
because they deal exactly with this question “how do I create my  
classes and make them collaborate?”:

> **[Software design pattern](https://en.wikipedia.org/wiki/Design_pattern_%28computer_science%29)**
>
> In software engineering, a software design pattern is a general, reusable solution to a commonly occurring problem within a given context in software design. It is not a finished design that can be transformed directly into source or machine code. Rather, it is a description or template for how to solve a problem that can be used in many different situations. Design patterns are formalized best practices that the programmer can use to solve common problems when designing an application or system....

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 13, 2008, 8:35pm UTC](https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695/5 "2008-02-13T20:35:43Z")

</div>

On 11.02.2008 13:49, Robert K. wrote:

> > (preferably on-line) about them?  
> > can easier reuse).
> 
> Off the top of my head I could not recommend a book or other resource  
> that will teach this.

I found one which seems to cover what I meant:

> **[Structure and Interpretation of Computer Programs - 2nd Edition (MIT Electrical...](https://www.amazon.com/Structure-Interpretation-Computer-Programs-Engineering/dp/0262510871)**
>
> Structure and Interpretation of Computer Programs - 2nd Edition (MIT Electrical Engineering and Computer Science) \[Abelson, Harold, Sussman, Gerald Jay, Sussman, Julie\] on Amazon.com. \*FREE\* shipping on qualifying offers. Structure and Interpretation...

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 14, 2008, 2:50am UTC](https://www.ruby-forum.com/t/lost-in-forest-searching-for-methods-of-abstraction-bad-habits-die-hard/128695/6 "2008-02-14T02:50:46Z")

</div>

On Feb 13, 2008 11:34 AM, Robert K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > create something like that (in ruby), and, is there a good read  
> > > methods / classes that do the same) and keeps things modular (so you  
> > > can easier reuse).
> > 
> > Off the top of my head I could not recommend a book or other resource  
> > that will teach this.
> 
> I found one which seems to cover what I meant:
> 
> [http://www.amazon.com/Structure-Interpretation-Computer-Programs-Engineering/dp/0262510871/](http://www.amazon.com/Structure-Interpretation-Computer-Programs-Engineering/dp/0262510871/)

The full text of SICP is available for free on the Web. Not as  
convenient in some ways as dead trees, but for anyone interested  
reading the thread, its easier to poke around and see if it meets your  
needs: [http://mitpress.mit.edu/sicp/full-text/book/book.html](http://mitpress.mit.edu/sicp/full-text/book/book.html)
