Wednesday, December 07, 2005

libyirae: API updated to clearly differentiate a list from a node

I put my words to action yesternite, and updated all the functions to properly differentiate b/w a Node and the List itself. The NODE objects are used internally in the List implementation, and keep things clean, for the user of the library, all you’ll ever need to do, is to use the LIST and its functions.

 

It was actually fun to do. The fun part was, change all the declarations, recompile, and run the test, see the SegFaults, and start making them all go away one at a time :-), it doesn’t get better than that… ohhh… it just did… VALGRIND!!! Yup, I also had to plug mem leaks and once again we’re VALGRIND certified to boot!!! :P. I’ve really learnt a tremendous lot doing all this.

 

There is a decision I’m dilly-dallying on… Currently, I have the NODE functions and LIST functions in one file still…. I have to do basic File Content refactoring obviously, the question is now… how closely do I couple the two? I’m trying to think ahead to when I start inheriting (tonite to be precise), close coupling will entail doing something like:

 

  1. Pull the list functions out of ysnode.c into yslist.c
  2. Define the move the struct _ysNode definition into ysnode.h
  3. beable to to call struct->next, etc from yslist.c

 

loose coupling will entail:

  1. Pull the list functions out of ysnode.c into yslist.c
  2. leave the struct _ysNode definition in ysnode.c (hence hiding it from yslist.c)
  3. defining accessor functions ysnGet_Next(), ysnSet_Next(), ysnGet_Data(), ysnSet_Data() for the NODE objects
  4. using these accessors from yslist.c

 

Why am I dilly-dallying? Theoritically, loose coupling is the way to go, but it just seems like an unnecessary hoop deep in my gut… hmmm… especially since I’m not even sure how the inheritance is going to work yet till I start coding. Anyway, I think I just made up my mind. I’ll stick with loose coupling, and be ready to change my mind if things start getting unnecessarily complex. Yup… that’s what I’ll do. That means, by tonite, I should start on the doubly linked lists implementation, then will release 0.3

 

I’m looking forward to close of work already :D (don’t tell Bunmi I said that ;) )

 

Essien out.

0 Comments:

Post a Comment

<< Home