From First Draft to Quality Code
Henry wrote a ghost-wrangler app for his Python Processing class. It worked. The ghosts floated, the eyes followed the mouse, the stars twinkled, and the movement controls responded. For a first draft, it was a genuine success.
The Ghost Saga asks the next question: what does the same design look like when you apply the lessons learned at TNT? Named constants instead of magic numbers. HSB color mode instead of raw RGB. Object structure that separates what an object is from what it does. Shared vocabulary across JavaScript, Java, and Python. Each improvement is documented and compared so novices can see not just the finished result, but the decisions that produced it.
The saga is not a criticism of Henry’s original. It is a conversation with it — and the original code is always present in the comparison so students can see exactly what changed and why.
Henry’s original Python sketch runs. That is the baseline. Every improvement is measured against what actually works, not an imagined ideal.
The twinkling stars backdrop is extracted and refined independently before being put back into the ghost canvas. Each component earns its own showcase.
Every improvement is expressed in JavaScript, Java, and Python side by side. The design decision is the lesson; the language is just the dialect.
Henry’s Ghost Saga Gallery
Each stage isolates a component, improves it, and cross-trains it across all three languages.
Henry’s original app: custom ghost shapes drawn with
beginShape(), sinusoidal floating, mouse-tracking
eyes, random blinking, WASD movement, and click-to-select.
Ported directly to JavaScript p5.js and Java Processing to establish
the cross-training baseline.
The star-field backdrop extracted and redesigned. Named constants replace magic numbers. HSB color mode replaces raw RGB. Sinusoidal phase offsets give every star independent twinkling. Multiple cross-training stages show the design evolving from draft to final.
A deliberate offroading trip: continuous hue drift added to the
twinkling stars, three bugs found and fixed in the Java version,
and a class design lesson that expanded to all three languages.
Star and Sinusoid classes defined in
JavaScript, Java, and Python side by side. The lessons here
directly inform the full ghost rebuild coming next.
The complete ghost body, glow, eyes, mouth, and selection ring revisited. Constants for all magic numbers. Improved object structure. The improved twinkling stars backdrop wired back in. Quality code that a student can read, understand, and extend.