📘 Week 2 – Crucial Questions

(Functions, Structs & Packages)


🔹 Struct & Design Philosophy

  1. Why does Go prefer composition over inheritance?
  2. How is a struct in Go different from a class in Python?
  3. When would you use a pointer receiver vs a value receiver?
  4. What happens if you forget to capitalize a struct field?
  5. Why does Go use capitalization to control visibility?

🔹 Functions & Multiple Returns

  1. Why are multiple return values powerful?
  2. What design advantages come from returning (value, error)?
  3. When should a function return an error instead of panicking?
  4. What is a pure function?
  5. Why are small functions preferred in Go?

🔹 Packages & Project Structure

  1. Why is project layout important in Go?
  2. What happens if two packages import each other?
  3. Why should packages have a single responsibility?
  4. What is the benefit of keeping main small?

🔹 Code Design Scenario

  1. If you had to model a “User” and “Admin” system, how would you design it without inheritance?


This site uses Just the Docs, a documentation theme for Jekyll.