On Jan 3, 2007, at 9:21 AM, Krekna Mektek wrote:

> Hi,
>
> Just to make sure, I'd like to know from your as OO programmers if I
> did the 'object thinking' right.
> The idea is the following:
>
> 1.- I have different development servers (Unix) where the developers
> of various sites have their files to be processed, those files are
> application server archives and web server archives, and maybe other
> files/archives in the future.
> 2.- I have a software library server where the software needs to be
> placed for processing via certain tool. Ruby is installed on this
> server.
> 3.- When I know the -site name-, I know the source server, source
> directory, destination directory, filename and naming convention, and
> perhaps more necessary info later.
> 4.- I have made a list with all this info (I've put it in a 2
> dimensional array now) related to a certain site
>    eg.  [sitename,
> type,src_server,src_dir,dest_dir,appl_archive,web_archive,dest_server]
> 5.- I need to find out the version number of the last file from a
> certain site after copying. Because then I can give the new file the
> correct follow-up numer (and some other tweaking)
> 6.- The same thing applies to the directory on this software library
> server, they also have a follow up name according to the date
> 7.- After this I can call this special tool non-interactively and
> import these archives and check if it all worked out.
> 8.- Sometimes in the request they want to have the web archive and the
> application archive to be processed, and sometimes only one of them.
>
>
> There is a little bit more to this, but those are technicalities which
> are not relevant for the object design question I have, or so I think
> (some checking, file tweaking, comparing, user switching, ssh and scp
> use and so on).
>
> I was thinking at the following objects:
>
> Site object   -->  where the methods are at least able to serve all
> the attribute from this list (see point 3 ). This object is called
> with this array (from the list) as an argument
>
> File object   -->  where methods are able to give the name, change
> the file name, changing the permissions of the file name
>
> Directory object  --> where methods are able to do the same sort of
> things as with the file name. This object can be a parent of the File
> object maybe.
>
> SiteList object --> I now have this array just in my front-end code,
> but it could better be in an object? However, it is data, and should I
> put data in an object? It only changes when a site is added, which
> happens two times a year at a maximum.
>
> ThisSpecialTool object --> Do I need to make an object from this
> special tool which I use non-interactively?
>
> Some sort of Ruby front-end is initializing the the objects and needs
> to be simple, the real code will be in the Site.class.rb,
> File.class.rb and Directory.class.rb
>
> Is this the correct way? I hope you can give me some directions if I
> am doing things correctly.
> How to decide if more objects need to be defined, or some of the
> mentioned objects are not necessary at all?
>
> Many thanks for any help, directions, code examples or whatever!
> Krekna

Well you already have a File and Directory that will handle what you  
need in Ruby.  You could probably just add some stuff to them.  But  
otherwise, it seems reasonable to me.

However, I wonder if you might not need some objects just to marshal  
data around.  What I see here are mainly data objects with some  
operations.  That might be enough.  But if you find yourself having a  
lot of repetition when coding it up, be on the lookout for some sort  
of controller object.  Something like ServerConnection comes to mind,  
but it'll depend on the details of your implementation.
-Mat