Playing Factorio requires starting out by performing a few tasks by hand, then thinking about how to incrementally automate factories with trains, drones, combinator circuits, and blueprints, with high level modular repeatable patterns. And estimating where the break-even point is between completing a few tasks by hand, and spending the time to automate more common tasks.<p>That evokes an article that Richard Potter wrote about "Just-in-Time Programming" in Alan Cypher's classic book (which is now online for free), "Watch What I Do: Programming by Demonstration", about when "the user attempts to write a program for a task that is already in progress":<p><a href="http://acypher.com/wwid" rel="nofollow">http://acypher.com/wwid</a><p>Watch What I Do: Programming by Demonstration. Edited by Allen Cypher. Co-edited by Daniel C. Halbert, David Kurlander, Henry Lieberman, David Maulsby, Brad A. Myers, and Alan Turransky. 1993. The MIT Press, Cambridge, Massachusetts, London, England.<p><a href="http://acypher.com/wwid/Chapters/27JITP.html" rel="nofollow">http://acypher.com/wwid/Chapters/27JITP.html</a><p>Chapter 27: Just-in-Time Programming. Richard Potter.<p>Introduction<p>Many of the other chapters have presented advancements in programming by demonstration (PBD) by presenting PBD systems and their innovations. In other words, these chapters have presented solutions. This chapter takes another tack by discussing PBD in the context of a problem. The problem is to create a new type of programming system that overcomes the obstacles users encounter when they attempt to use present-day programming systems for just-in-time programming. This chapter defines just-in-time programming and identifies five of these obstacles: inaccessible data and operators, the effort of entering the algorithm, limited computational generality, effort of invoking the algorithm, and risk. Just-in-time programming motivates PBD research because PBD can potentially overcome several of these obstacles.<p>Just-in-time programming is the implementing of algorithms during task-time, the time when the user is actually trying to accomplish the task. It can be characterized by a situation with the following components:<p>- a computer user who could be either a novice user or an experienced programmer,<p>- a task that the user is manually accomplishing and completion of which is the user's primary goal,<p>- a repetitive subtask[1] of the task that could potentially be automated, thereby making it easier for the user to complete the task,<p>- an algorithm that will accomplish the subtask and that the user envisioned while working on the task,<p>- and an attempt by the user to implement the algorithm for the purpose of more effectively completing the task.<p>In short, the goal of just-in-time programming is to allow users to profit from their task-time algorithmic insights by programming. Instead of automating with software that was carefully designed and implemented much earlier, the user recognizes an algorithm and then creates the software to take advantage of it just before it is needed, hence implementing it just in time.<p>[...]