Concept Explanation
This lesson is a checkpoint on structure rather than syntax. By this point, you should start separating responsibilities instead of placing all logic in one file or one long method. A simple C# program becomes easier to test when input handling, core logic, and output are clearly divided. Here you will sketch a small console-style architecture, connect the pieces, and review why the layout matters. The main goal is to recognize when a program is still small enough to understand, but already large enough to benefit from better organization.
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 part of the example owns the business rule and which part only handles output.
- Move one responsibility into a separate method or class and check whether the flow is clearer.
- Change the rule inside the service without rewriting the program entry point.
- Describe why this structure is easier to test than putting everything directly in Main.
Step-by-step Guide
- Read the sample once and label the role of each class or method.
- Run the code and confirm that the service produces the final message.
- Change one rule inside the service, such as formatting or trimming, and rerun the example.
- Compare this layout with a version where all code lives in Main.
- Finish by deciding whether the current structure is simple, clear, and easy to extend.
Practice Exercises
- Create a small service that formats order totals or user names instead of greetings.
- Add a second method to the service and decide whether it still belongs in the same class.
- Rewrite the sample with a helper method first, then compare it with the class-based version.
Coding Challenges
- Design a tiny console app with separate parts for reading input, applying logic, and printing output.
- Compare two structures for the same task and explain which one would be easier to grow later.
Mini Practice Tasks
- Rename one class or method to make its responsibility clearer.
- Add one small improvement without changing the overall structure.
- Write a one-line note explaining what this architecture is protecting you from.
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.