[Rails] The bigger picture

"Luis G. Gómez" lgomez at vfxnetwork.com
Thu Nov 25 08:36:14 GMT 2004


Hi,

Tonight I sat down to play arround with Rails like I have done for the 
last few days and I realized, being new at all of this framework and OO 
stuff, that it'd be great to be able to have a personal repository of 
classes that I could share between different projects. This may sound 
obvious for most of you but OO is an approach that I'm getting familiar 
with through Ruby. I know it is possible if I make the effort of 
creating well designed classes maintaining dependencies to a minimum, 
etc... but what about the big picture as far as how I use all of this 
from a practical point of view?

How do experienced developpers do it? Do you usually keep a library of 
classes that you know well available for every project and then mix and 
match? Is there a way of maybe having a server "serve" these 
functionality so it can be used by my clients (web services?)? If so, 
have you seen a setup like this one?

I've learnt most of what I know about programming because I enjoy it but 
my background is in design so I don't know how a "freelance" developper 
would go about organizing his material. I'd like think I can focus on an 
approach that will save me from repeating myself and feeling like I have 
done everything 100 times.

For example, as far as Rails goes, say I've been using it for some time 
and have a collection of nice controllers  scattered arround in various 
applications. How can I share these between apps while keeping the code 
in one place or at least a "master" in one place? I know Needle or 
Needle-like functionality is being integrated but don't know if this helps.

Imagine having a Rails application with a stucture like this one (this 
is only for illustration purposses):

/appsrv/
/appsrv/cart/create
/appsrv/cart/list
/appsrv/cart/add_item
/appsrv/cart/mod_item
/appsrv/cart/...

/appsrv/inventory/create
/appsrv/inventory/list
/appsrv/inventory/locations
/appsrv/inventory/add_locations
/appsrv/inventory/add_item
/appsrv/inventory/mod_item
/appsrv/inventory/...

/appsrv/catalog/create
/appsrv/catalog/add_item
/appsrv/catalog/...

Then being able to create an application (maybe even on a different 
server - a client's server) and "calling" these different controllers 
(mixing and matching). Maybe a particular client only needs to have 
inventory functionality so you only use that controller. I realize this 
has many performance and security complications (and probably more) but 
I'm dicussing conceptual approaches to structuring a developpers 
material for re-use and efficiency of development not necessarily 
propossing this as the right approach.

Maybe Railing all of it is not the right approach and having organized 
folders with classes that I can share petween Rail apps is better. But 
then how do you consume these services or controllers from other 
servers? I don't know....

Do you mind sharing your opinions or recommendations on how one should 
or could approach development?

Thank you,

<lgomez>


More information about the Rails mailing list