Re: Scripting language for DBAs

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Mon, 16 Apr 2012 15:15:40 +0200
Message-ID: <9v2kbsFclpU1_at_mid.individual.net>



On 16.04.2012 14:39, Mladen Gogala wrote:
> On Mon, 16 Apr 2012 13:18:55 +0200, Robert Klemme wrote:
>
>> I find myself often using a few self defined classes (and of course a
>> lot of classes from the standard library) even in short ad hoc scripts.
>
> Hopefully, I will never have to maintain your script, without you being
> around. Your methodology doesn't have to resemble mine and understanding
> your classes would probably be a significant problem for me. Those
> classes aren't very well documented, are they?

I did not post any documenting comments in those quickly made up examples. But choosing proper names for things (classes, methods) goes a long way already.

> In that case, I prefer standardized types like integer, float or string
> to do my evil deeds. The person who will have to untangle my scripts
> after me will find them much easier to understand.

Only if you have documented them properly because an int itself does not tell you whether it is an age or seconds since the epoch. One advantage of classes over using standard collection types (arrays, hash tables) is that you can give them names. I have waded through script code which uses nested arrays and hashes a few levels deep which was certainly as impenetrable as the short Ruby snippets I posted must occur to you. Please do note, that things like look significantly different if you knew the language and std lib.

Kind regards

        robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Received on Mon Apr 16 2012 - 08:15:40 CDT

Original text of this message