Concept Explanation
This lesson introduces architecture at a beginner-friendly level: organizing code so each part has one clear job. You are not building a large system yet, but you will practice separating data, behavior, and program flow instead of placing everything in one file or one method. That habit matters early because clean structure makes testing easier, reduces confusion, and gives you a smoother path from simple exercises to real applications.
Where to Put the Code
- Define color and position variables at the top.
- Create shape drawing or placement logic in the middle.
- Render output (print, canvas, SVG, or styled block) at the end.
Command Reference
- Identify which class stores data and which class handles formatting or behavior.
- Run the example, then change one input value to confirm each part still works as expected.
- Refactor one responsibility out of main so the entry point stays small and readable.
- Write one sentence explaining why this structure is easier to extend than putting everything in one method.
Step-by-step Guide
- Read the example and mark the role of each class before changing anything.
- Run the baseline code to confirm the current output.
- Make one architectural improvement, such as moving formatting or validation into a separate class.
- Compare the new version with the original and decide which one is easier to understand.
- End with a short note about how structure affects readability and future changes.
Practice Exercises
- Add a second class that validates user data before it is displayed.
- Change the example from a user record to a product or order record while keeping the same structure.
- Write a brief output summary that shows the data object and the class responsible for presentation.
Coding Challenges
- Create two small designs for the same problem and compare which one keeps responsibilities cleaner.
- Design a tiny package layout for a beginner project that includes data, service, and entry-point classes.
Mini Practice Tasks
- Rename one class or method to make its responsibility more obvious.
- Add one quick manual test using a second User object.
- Write a one-line summary of what architectural choice improved this example.
Common Mistake
Mixing x and y axes or using wrong coordinate origin causes shapes to appear in unexpected places.
Real-life Mini Challenge
Draw one square, one triangle, and one circle, then move X marker 2 steps right and 1 step down.