Factorio
I recently picked up Factorio for a third go around.
Unless you’re a weird combination of gamer and engineer, you probably haven’t heard of it, so here’s the brief rundown:
Factorio is a game where you build a factory.
The challenge is that, to do so, you need to use raw resources to create tools to extract more resources, and to craft those into more tools and “science packs” that can be used to unlock even more tools. The science packs become increasingly complex to create. Meanwhile, you face the challenge of moving the resources, and crafted items around to where they need to be. The way it’s designed means that your usage of the raw resources will grow exponentially as you progress towards later game science and the end goal of building a rocket to escape the alien planet where the whole thing is based.
And to add to all that, the alien “biters” become angry as you pollute their world and will attack you and your factory.
So, basically, it’s a game where you’re constantly dealing with constraints and trying to satisfy many at the same time.
Refactoring
One thing that becomes apparent if you make it past the first stage is that you need to refactor.
Refactoring is a term that comes from software engineering. It means to restructure your code while preserving it’s behavior.
In Factorio, you have to refactor for a variety of reasons. The biggest one is to rearrange parts of your factory to use less space, or at least to not be in the way. The resources your factory consumes will radically change over time, and so production of those will also require refactoring.
Though not always necessary, refactoring in Factorio works best if you can do it while keeping the factory functioning. It’s kind of like the phrase “building the plane while it’s flying”.
The same is often true with software. Refactoring software is safest if you do it in small steps where each step keeps the software in a working state.
Refactoring Your Life
In a sense, this is what we all are trying to do throughout our lives.
While living, without taking a break from life, we want to make changes.
Build habits.
Take on a new job, or hobby, or relationship, or child, or volunteer opportunity.
Each of these requires restructuring our life to let the new thing “fit”. Without that, something else will fall apart.
That restructuring needs to happen while we keep living: eating, making money, maintaining a healthy marriage or social life, staying in shape, etc.
It’s not always easy.
Let me share a few principles that come from software (and Factorio) that can help.
1. Small steps
The key to successful refactoring is to iterate in very small steps. Change one thing. See what happens. Decide on the next change. Laying out a whole plan for changing your life that involves multiple steps probably won’t work. Yes, you need a direction. But often the results of one small step will determine what the next small step should be.
2. Put some areas on autopilot
Refactoring means taking a really close look at certain parts of your life, and overhauling those. While you do so, it’s best if unrelated things chug along on autopilot. That’s one reason that having a set of daily habits is so useful. Those can keep you grounded while you work on changing one of them, or dealing with other changes.
3. Repeat Yourself
Often, the first step is to build in some redundancy. If you’re rebuilding the airplane while it’s flying, it really helps to have two engines, so you can work on one while the other keeps the plane in the air. With code, it’s easiest to copy it and change things, leaving the original to continue doing it’s thing until you feel confident that the new, changed code works correctly.
This is best illustrated in life when you want to gain more freedom. If you have one source of income, it’s safer to build a second one while the first one keeps bringing in the money. Then switch over once the second one is successful. Or at least look for a new job while you still have the old one, when possible.
Repeating yourself gives you the freedom to experiment a bit.
4. Then Don’t Repeat Yourself
Long term, repeating yourself is wasteful. It helps you scale up and gives you a workplace to experiment while allowing for failure. But once the experimentation is done, use what you learned to streamline and simplify.
5. Regular testing
Throughout the process, you’ll want to test to make sure nothing broke as you were refactoring. If it did, fixing it is a priority.
As you test frequently, it lets you catch and fix small problems along the way, before they become big problems.
For example, by just changing one habit at a time, and regularly evaluating, you can see if it’s becoming too stressful and you need to back off. Hopefully before it leads to a breakdown, or, more likely, a wasted weekend binging on Netflix and dessert.
One Small Change
So right now, ask yourself “what is one small change I could make to improve my life?”
You probably already know the answer.