Building resupply

Well, I was wrong about how close I was to having resupply reintegrated; I moved the global functions that did all the work into a scratch file, and finally merged them into five simpler functions with the actually functionality properly compartmentalized. I can probably now refine that down to 3 functions.

The actual resupply queue shouldn’t be so tricky now, but I’ll have to review my plan. As ever, there was a ton of duplicated and redundant functionality that was designed to make each layer capable of dealing with various conditions, but very little of which was really neccessary to the bigger picture – complexity begets complexity.

Its possible that before my previous sweeps, there was additional code in there that required this extra complexity to make things happen in the right order, but when you start writing OO code it just becomes cleaner.

I also ran into a problem with GCC on my build box *sigh*. I was able to solve it by tagging a whole bunch of function prototypes as “extern”. This does not bode well.

4 Comments

You could always give SunStudio a go (I know it’s cpp is slightly more verbose – and does support linux too (ok, shameless plug – but it’s free :D

— asn

“…a ton of duplicated and redundant…”

I’m betting you didn’t even get your own joke :P

…@/

Changing compilers for a project full of so many hand-crafted optimizations would be a bitch ;)

I didn’t make one. Duplicated functionality isn’t always redundant.

open() {
 m_country = newOwnership() ;
 m_side = wwiiSide(m_country) ;
 mate->close();
 m_open = true ;
}
close() {
 m_country = newOwnership() ;
 m_side = wwiiSide(m_country) ;
 m_open = false ;
}

2 out of 3 lines of the second function are duplicated but not redundant – unless line 3 of the first function is the reason for having two functions instead of just one which takes an argument.

changeState(bool isOpen) {
 m_country = newOwnership() ;
 m_side = wwiiSide(m_country) ;
 if ( isOpen == true )
   mate->changeState(false);
 m_open = isOpen ;
}

In the case of the code I’m refering to, it’s become duplicated and redundant by my elimination of many classes, structures and lists that were involved in holding together other functionality and/or exposing possible future expansion in a direction that we are clearly no-longer planning to go.

Undefined behavior leads to an undefined amount of complexity.

Leave a Reply

Name and email address are required. Your email address will not be published.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

You may use these HTML tags and attributes:

<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <pre> <q cite=""> <s> <strike> <strong> 

%d bloggers like this: