AI Builder Series — Workshop 2
by Brendon Thiede
What happens when everything is tangled together?
Watch: I'll try to add a feature to our messy quiz code...
Each part of your code should have one job.
Let's find the 4 concerns in our quiz app.
Mark each line in your code with a color.
Stretch, grab water, and come back ready to refactor.
If you could only change one part of your quiz, what would it be?
Extract the question data.
"Move the questions array into a separate file called questions.js. Don't change anything else."
Separate logic and styling.
"Extract the score tracking and answer checking into their own functions. Don't change the questions or the HTML."
Test with Playwright after.
"Move all the CSS from the style tag into a separate styles.css file. Don't change any functionality."
Test with Playwright after.
What happens if you ask AI to "refactor everything at once"?
quiz-app/
index.html ← display
styles.css ← styling
questions.js ← data
script.js ← logic
Each file has one job.
Save Points
Now that your code is organized, we'll learn to save our progress before experimenting — so we can always go back.