archive by month
Skip to content

a parable of optimizing the software development process

I habitually take a top-down view of things (I’m a lumper, not a splitter), and I want to use an example to draw a comparison. The example is: Steamhammer’s production queue data structure is inherited from UAlbertaBot. It looks like this (I left out the constructors).

struct BuildOrderItem
{
    MacroAct macroAct;  // the thing we want to produce
    bool isGasSteal; 
}

Steamhammer renames UAlbertaBot’s MetaType (which might mean anything) to MacroAct, and extends it with a MacroLocation to specify where things are to be built (and other changes).

I want to simplify this, and it should be easy to understand why. Stealing gas amounts to building a refinery at a given location—it should be specified as a MacroLocation, not as a separate flag outside the MacroAct. I can drop the wrapping BuildOrderItem data structure and keep a queue of straight MacroAct values. There will be one less level to the data structure, a distinct improvement.

On the one hand, it simplifies the code and it’s a straightforward, low-risk refactoring. There are many uses of BuildOrderItem and it will take time to handle them all, but the compiler will tell me if I forget to rewrite one of the uses. On the other hand, it doesn’t affect play in the least. The production queue will behave the same, and it is not a heavily used data structure that affects performance.

So from a project management perspective, what’s the best time to carry out the work? The sooner you do a code simplification, the longer you benefit from it. But it will take time, and I want to concentrate on play improvements for AIIDE. What’s the best timing?

Well, it’s not an important question. I might do it before AIIDE or after, and it won’t make a big difference either way. But I find it interesting to think about. Optimizing the development process is similar in concept to optimizing Starcraft play: It is about taking actions, sometimes tiny actions, that improve efficiency over time. It requires similar subtle judgment calls. Take actions with big enough cumulative effect, and you pull ahead; you have to decide which actions are worth your limited time. To me, taking the abstract view, the big difference is that in software development you get more time to think about it—coding is a slower-moving game.

Trackbacks

No Trackbacks

Comments

Antiga / Iruian on :

It might make sense to do optimizations outside of tournament seasons and do tournament focused prep during it. Essentially linking your dev cycle to the tournament calendar.

Arrak on :

I think ideally code simplification should be done when time is "most available," any time before a clairvoyant would predict the occurrence of "substantial slowdown" in the development process as a result of removable code complexity. If tournaments are considered a sufficient constraint on the availability of time, then I suppose a likely time would be after tournament submission. If the issue is minor, then code simplification might never need to be done.

McRave on :

I like the MacroLocation part of SH's build order framework, but never found a way to use it in my own. I reworked my build order queue, so I want to add that going forward, sooner than AIIDE hopefully. It's a very simple method that tidies up a lot of logic for "where do I want this".

Antiga / Iruian on :

Arrak is now open source and did an update! https://github.com/avan994/Arrakhammer

MicroDK on :

Arrakhammer was also open source before since it has participated in AIIDE. ;)

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.