[Aiml-programr-developers] New graphmaster "node" class completed

mauro at cicio.org mauro at cicio.org
Thu Oct 4 16:37:52 EDT 2007


Hi Nicholas,

> Regarding the first two points (Ruby indentation / 80 column rule): no
> problem, go for it (what exactly are the ruby indentation rules? where
> might I find them? I thought I was following them?).

> what exactly are the ruby indentation rules?
Simple: 2 spaces (not the C/C++ 4).

> where might I find them?
I don't remember, I read them about 7 years ago and always respected since.
Anyway: the generated code (e.g. Rails) respects all of them.

> I thought I was following them?
Yes, I think so too: I just modified the 4 to 2.

> Coding "style"
> rules are fine with me... it helps keep the code consistent and readable.

I agree. In each lang, I stick to the main stream of that lang.

> Regarding comments: :-P I always comment first and then code. Helps me
> remember what I'm supposed to be doing!

This is fine. Not a reason -per se- to keep the comments once the
coding is done :-)  I find them annoying, considering that your code
is very clear, but is not a big deal.

> Also, as the Node class is (only
> slightly) conceptually abstract yet essential to the correct workings of
> a bot so I wanted to make sure anyone reading the code would have no
> doubt how it works.

Good point.

I was referring to things like:
    # @children to contain the child nodes from this node
    @children = Hash.new()

I suspect that if somebody needs a comment to understand what the
@children of a Node class are, then s/he is reading the wrong
literature ;-)

> My usual commenting style is much more terse and I
> definitely subscribe to the self-commenting code school of thought.

Great!

> Nevertheless, when working from a detailed specification (like the AIML
> standard) I usually include relevant details in the class documentation
> so it shows up in things like rdoc.

I completely agree on this. I have never looked into it, but I think
that Ruby has a mechanism to merge the comment file and the code file
on the fly.
Of course this is only for the class comment.

> Concerning editors: on anything but Windows I use VI (vim)

Me too!

Now I wanted to begin doing some real work myself!
What I did is to rewrite your class up to the add_category method.
Nothing new from the functional point of view, only style.
At the add_category I stopped, in order to prepare a few comments and
open a discussion on style, OO, programming.
I have created a parallel file (play/nicholas/graphmaster/lib/node_mc.rb)
where I also attempt a "defence" of the equivalent method in the old
implementation. Using this technique (processing ourr code, like we
where lawyers), is supposed to help us in becoming better programmers.

Of course this kind of detailed work is very "expensive", so if you
are not into this kind of things (I think you both are!), tell me and
I drop my coach attitude :-)
Very interesting is the point 5 in the file. I left it open for you to
have the first word on it. I really hope you like the game (and have
time to play it),

Ciao,
Mauro


More information about the Aiml-programr-developers mailing list