hnb - bad code

for an example of how not to do things, hnb is pretty good. it's a shame, because it looked like a handy, console based todo list with an xml backing. I don't mean to trash opensource work, but here's some constructive critisim

  • the code follows no known standard coding convention.

    indent(1L)
    

    can help you there

  • whenever you use the magic cast operator in C, be really really sure you know what you are doing.

    Node *pos=(Node *)data;
    ...
    return (int)pos;
    

    The code does this at least a hundred times! Obviously some code that was copied from somewhere but renders the program usless on any 64 bit machine, where sizeof(int) != sizeof(pointer). This also says something about abstraction, since it does it so many times this really hints it should have been broken out.

  • If someone says "XML", think Python, Perl, Ruby ... anything but C