How does one start to think about abstraction
in code?
As a beginner programmer, you're about to create your first meaningful abstraction - a PhoneBook. But what does that mean exactly?
Think about a real-world phone book: it's a collection of names paired with phone numbers, organized in a way that makes it easy to find someone's contact information. In programming, we can model this same concept using basic data structures like dictionaries (or HashMaps in Java) and lists. The magic happens when we wrap these simple structures inside a class that provides a clean, intuitive interface.
When you implement the PhoneBook class, you're essentially building a specialized tool. Other programmers (including your future self) won't need to worry about whether you used a dictionary, how you store multiple phone numbers per person, or how you handle edge cases. They'll simply call methods like add()
, lookup()
, or reverseLookup()
and trust that your implementation handles all the details correctly. This is the power of abstraction - hiding complexity behind a simple, understandable interface.
By creating this PhoneBook module, you're not just solving a coding exercise. You're learning to think like a software architect, taking real-world concepts and translating them into reusable code components. Every major software system is built from layers of such abstractions, each one solving a specific problem so that higher-level code can focus on bigger challenges.
This is a dual lab, one leg for java, one leg for python.
Check out the folder which applies to you.
Mkae your pull requests as you make progress and finish.