📘 Week 2 – Crucial Questions
(Functions, Structs & Packages)
🔹 Struct & Design Philosophy
- Why does Go prefer composition over inheritance?
- How is a struct in Go different from a class in Python?
- When would you use a pointer receiver vs a value receiver?
- What happens if you forget to capitalize a struct field?
- Why does Go use capitalization to control visibility?
🔹 Functions & Multiple Returns
- Why are multiple return values powerful?
- What design advantages come from returning
(value, error)? - When should a function return an error instead of panicking?
- What is a pure function?
- Why are small functions preferred in Go?
🔹 Packages & Project Structure
- Why is project layout important in Go?
- What happens if two packages import each other?
- Why should packages have a single responsibility?
- What is the benefit of keeping
mainsmall?
🔹 Code Design Scenario
- If you had to model a “User” and “Admin” system, how would you design it without inheritance?