Chapter 60: Software Design

Slide Deck

One of the central ideas of this class is that we don’t have enough time. Games are complicated to make, so we’re trying to keep our ideas as simple as possible, and we’re preparing to spend a lot of time coding.

When we’re trying to move as fast as possible, it might seem like anything non-essential that takes up time should be ignored, in particular:

However, these are things that definitely waste time:

Bad Code

How many of you have been slowed down by bad code?

Why do we write bad code?

Some people say that bad code comes from a lack of discipline. We’re rushing, we need to meet deadlines, we have other things to do. So we purposefully write bad code just to get the job done.

I think that happens sometimes, but that it’s not the main problem. Writing good code from scratch is incredibly difficult. Usually when we talk about good code, we’re talking about structure - we have appropriate classes, effective interfaces, the code is all terse but readable. But code is bad both when it is unstructured (just a huge pile of loops in a single main.cpp) as well as when it has the wrong structure, or too much structure.

So we need to learn how to add the right structure. How do we do this?

This is my approach: