Tuesday, January 17, 2012

Oh no! Fears Confirmed!

The fears I expressed in my last blog entry have been completely justified.  I got the requirements for PA1 implemented and working only to discover that my implementation does not match Keenan's unit test code.

So now I have a decision to make.  Do I change and simplify my implementation to match Keenan's, or do I take the easy way out and build some sort of adapter between his expected interface and my implementation?

It makes me sick that I'm having this dilemma the night before the assignment is due.  But it's OK.  I'm going to take the adapter approach and see where it gets me.  Surely there is some way that I get my PCSNode to peacefully coexist with Keenan's...right?

I'll  have to devise implementations for things like setChild and setSibling.  My code has no such methods, nor did it require them to get the job done. These methods weren't even hinted at in the assignment writeup so I did not anticipate them in the test code. I think I can figure out a way to implement setSibling by inserting a node just after the node the method was called on.  I guess setChild will insert a new node at the beginning of the list of a node's children.  I guess.

I feel a bit dismayed. I correctly suspected that last night's relief would be short lived.  Once again, I am a sad little coder.  :(

No comments:

Post a Comment