Generative Programming in Practice: From a Prompt to a Runnable Prototype
This article examines how generative programming turns natural-language descriptions into runnable prototypes and where the gap between a demo and a deliverable remains. It explains how to define goals, runtime constraints, required behaviors, and acceptance checks; how to test interaction, 3D, and dynamic prototypes differently; how to evaluate first-round generation and limited-round repair; and how to move from demo to engineering delivery through isolated execution, reproducible feedback, and implementation review.
1. What Does “Wishful Programming” Lower?
“Wishful programming” means that developers first describe the desired effect in natural language, and then a code generation model outputs an implementation plan or a runnable project skeleton. For example, building a simple racing prototype used to require setting up rendering and input logic first, then implementing lap detection and UI state. Now a team can describe the gameplay, delivery format, and runtime constraints, let the model generate a first version, and then use actual runtime results to decide what to change.
What this approach lowers first is startup cost and trial-and-error cost. When requirements are not yet fixed, a prototype can answer questions that are difficult to discuss through documents alone: Are the controls intuitive? Which feedback matters most to users? Is this effect worth investing in, or should the scope be reduced? The easier a prototype is to change, the more likely a team is to discover disagreements in direction before formal development begins.
But there is still a distance between “can generate” and “can deliver.” In the racing prototype example, smooth visuals and working key presses prove only that part of the flow works. If the car can cross the finish line backward and still count a lap, or if the timer is not reset after a restart, the core rules have not been established. The value of generative programming should not be measured only by how impressive the first output looks, but by whether it can reach agreed acceptance criteria at a limited rework cost.
2. Turning Wishes into Verifiable Tasks
An effective prompt does not have to be long, but it should specify at least four things: the goal, the runtime environment, the required behaviors, and how to check the results. The easiest item to omit is the verification method. A model can make reasonable guesses about words such as “fun,” “natural,” or “complete,” but those words are not enough for a team to judge whether the task is done. Replacing adjectives with observable behavior is usually more useful than adding more style descriptions.
Here is a task description suitable for a first-round generation:
Implement an offline-runnable top-down racing prototype. Deliver a page that can be opened directly in a browser, with graphics drawn programmatically and no external assets requested. The player can control the car with the arrow keys. The car must pass checkpoints in order and then cross the finish line in the specified direction before a lap is counted; after three laps, stop the timer. Provide a restart button; after restart, restore the initial position and clear the timer, lap count, and checkpoint state. Do not implement networking, opponent cars, or sound effects for now. When delivering, explain how to run it and list four manual verification steps: normal completion, skipping checkpoints, reverse crossing of the finish line, and restart after completion.
This description does not prescribe how each function should be written, but it tightens the most important decision space. For example, “offline-runnable” affects not only the source of assets but also dependency choices; “reverse crossing does not count as a lap” requires the implementation to distinguish crossing direction rather than only checking whether the car overlaps the finish area. The clearer the task, the easier it is to identify the source of a problem later: did the generated code deviate from the requirements, or was the requirement itself still unclear?
At the same time, distinguish hard constraints from adjustable preferences. Offline operation and correct lap counting are hard constraints; color scheme, car body shape, and decorative effects can use default solutions first. If the first round pursues complex visuals and complete gameplay at the same time, it becomes difficult to tell whether an unsatisfactory result comes from unfulfilled core logic or from extra features increasing implementation burden. It is usually easier to locate problems by ensuring the main flow first and adding presentation later.
3. Different Prototypes Require Different Checks
1. Interaction Prototypes: Verify State Transitions First
Interactive work is most prone to the phenomenon of “a normal run works, but a different order of operations breaks it.” A racing prototype can distinguish three states: waiting to start, racing, and finished, and then check which inputs are accepted in each state. For example, after completion, can the car still move and change the result? If the restart button is clicked repeatedly in a short time, does it start multiple timer loops? After the browser window loses focus, does the car continue turning because the key release event was not received?
These problems cannot be judged from screenshots. For lap counting, timing, and reset logic that can run independently, automated tests can be written; for keyboard focus, canvas scaling, and actual operational feedback, manual walkthroughs should be performed in the target environment. Only by combining the two can “looks usable” become a reviewable conclusion.
2. 3D Scenes: Do Not Check Only the Initial Camera
Take a lakeside building as an example. The first-round result may already show water, buildings, and vegetation, but a suitable initial viewpoint does not mean the scene itself is valid. Moving the camera to the side of the building may reveal that the entrance is blocked; zooming in may reveal object intersections, imbalanced proportions, or abnormal shadows.
A more reliable approach is two-stage acceptance. The first stage checks spatial layout, object proportions, camera movement range, and runtime stability; the second stage adjusts lighting, materials, color, and detail density. If the project is required to run on ordinary devices, the test environment and observation method should be agreed in advance, rather than treating the smooth experience on the developer’s own machine as a universal conclusion.
3. Dynamic Demos: Check Temporal Continuity
Script-generated animations and screen recordings of interactive work may perform well in a single frame but expose problems during full playback. During review, pay attention to whether object positions jump suddenly, whether actions connect smoothly, whether camera cuts obscure key information, and whether the first and last states are consistent when playback loops. If the deliverable will also need repeated editing, confirm that animation duration, camera paths, and object states can be modified separately, without regenerating the entire scene just to adjust a few seconds of camera movement.
4. How Do You Know Whether First-Round Generation Has Really Improved?
A single successful case shows only what one generation accomplished; it does not prove that similar tasks are generally easier to complete. To judge whether an improvement is meaningful, first fix the task description, input assets, runtime environment, and acceptance rules, and then compare. If observing changes in the same service over different periods, generation timestamps and obtainable version records can be retained, but changes in service identifiers themselves cannot explain capability changes and certainly cannot replace actual testing.
It is recommended to record results in three layers:
- First-round result: whether it runs without manual modification, how many required behaviors pass acceptance, and whether it introduces unrequested external dependencies.
- Limited-round repair result: under the same number of follow-up questions or human intervention budget, whether failed items can be fixed and whether the fixes break features that already passed.
- Delivery cost: how much human time is needed to organize the code, add tests, review dependencies, and complete run instructions.
Test tasks should cover different difficulties. Small interaction tasks with complex states are suitable for checking rule implementation; 3D tasks are suitable for observing spatial organization and visual completeness; making local changes to existing code can check whether the model preserves existing behavior and avoids turning one change into a rewrite. For each type of task, it is best to retain failure samples and distinguish runtime errors, missing requirements, boundary condition errors, and presentation deficiencies. Such records are more useful than a simple good-or-bad ranking: they help a team decide which tasks can directly use a generative workflow and which still need requirement decomposition or stronger review.
5. From Demo to Engineering Delivery
The first step is isolated execution. When running generated code for the first time, use an environment without real credentials or sensitive data, and do not grant write permissions to production resources by default. When a deliverable claims to run offline, verify it in a network-disabled environment rather than only checking whether the homepage opens. If external dependencies need to be introduced, check their source, purpose, and license before deciding whether to keep them.
The second step is writing feedback as reproduction steps. Instead of saying “lap counting has a problem, please optimize it,” say: “Without passing any checkpoint, crossing the finish line backward changes the lap count from zero to one; the expected value remains zero.” When feedback includes preconditions, actions, actual results, and expected results, the model is more likely to make a local fix. Then solidify that scenario as a regression check and retest normal completion and restart, so that fixing one branch does not break another.
The third step is reviewing the implementation behind the runtime result. A prototype can first be concentrated in a single file to make distribution and trial use easier; if it is going to be maintained long term, state logic, rendering, and input handling should be separated, and exception handling and resource cleanup should be made explicit. Pay particular attention to whether generated code repeatedly registers event listeners, repeatedly creates timers, or hardcodes environment-specific paths. These defects may not appear in a short demo, but they increase the cost of continued use and later modification.
Finally, acceptance thresholds should change with the purpose. For a prototype used for internal requirements discussion, it is usually enough that the main flow can be demonstrated and limitations are clearly stated; for features facing real users, accessibility, privacy, security, compatibility, and rollback paths still need to be checked in context. Prototype-stage standards cannot replace launch standards, nor is it necessary to build a complete production architecture in advance for a demo used only to validate an idea.
The most practical change brought by generative programming is not that one sentence replaces the entire development process, but that a team can obtain an artifact earlier that can be operated, questioned, and modified. The easier requirements are to accept and the easier feedback is to reproduce, the less likely the time saved by the first generation will be offset by later rework.
