Programming Fundamentals
Part of the Interview Prep Roadmap. Coverage ratings are explained there.
Object-Oriented Programming
What problem OOP solves, the fundamentals of classes and objects, the four pillars, relationships between classes, and the keywords that tie it together.
Coverage: rich
Resources · Java OOP — W3Schools · OOP concepts — GeeksforGeeks
Motivation for OOP
- Problems OOP solves
- Difference from procedural programming
Practice
- Why OOP instead of procedural programming — Relisource
- Principles of OOP, and why we use it — Exabyting, with answer
Classes & Objects
- Identity, state, and behavior of an object
- Constructors
- Instance vs. object
Practice
- Which characteristics represent an object — Brain Station 23
- Constructor overloading, traced — Brain Station 23
- Which classes cannot be instantiated — Brain Station 23
Pillars of OOP
- Encapsulation
- Abstraction
- Inheritance
- Polymorphism
Practice
- Which is not a fundamental OOP concept — Brain Station 23
- The four principles, explained — Exabyting, with answer
- Overriding vs. overloading — bKash, with answer
- Method overloading rules — Brain Station 23
Class Relationships
- Inheritance (is-a)
- Composition (has-a)
- Aggregation
- Association
- Abstract classes vs. interfaces
- Upcasting and downcasting
Practice
- Inheritance, from first principles — bKash, with answer
- Which relationship is IS-A — Brain Station 23
- Abstract class vs. interface — WSD
- Identify the casting in this code — Brain Station 23
- What casting is demonstrated — Brain Station 23, with answer
Special Keywords & Gotchas
staticfinalthis- Multiple inheritance and the diamond problem
Practice
- What
staticmeans on a method — Brain Station 23, with answer - Explain the
statickeyword — DSI - Purpose of
final— Brain Station 23, with answer finalon variables and classes — WSD- What
thisrefers to — Brain Station 23, with answer - Static counter output trace — Brain Station 23
- The diamond problem — Brain Station 23, with answer
Object-Oriented / Low-Level Design
Turning a word problem into a class design — identifying entities, modeling relationships between them, and handling systems with more than one kind of actor.
Coverage: thin
Resources · Awesome Low Level Design — free problem set with worked solutions, good to work through end to end
Modeling Entities & Relationships
- Identifying entities from a word problem (
ParkingLot,Vehicle,Product) - Entity attributes
- Relationships between entities (a
Caris-aVehicle; aVendingMachinehasProducts)
Practice
- Design a parking management system — Therap, with answer
- Design a vending machine — Therap, with answer
Role-Based System Modeling
- Multiple actors acting on the same data (admins, cashiers, checkers, users)
- Class design driven by actor responsibilities
Practice
- Ticket management system with five roles — Brain Station 23, with answer
Design Patterns & SOLID Principles
What a design pattern is and why they exist, the SOLID principles that guide good design, and Singleton as a concrete pattern built on top of them.
Coverage: thin
Resources · Refactoring.Guru — Design Patterns · Refactoring.Guru — SOLID
Design Pattern Fundamentals
- Reusable solutions to recurring design problems
- When to reach for a design pattern
- Creational, structural, and behavioral categories
Practice
- What design patterns are, and why they matter — Stamford University
- Choosing a pattern for an auth service — ShellBeeHaken, with answer
SOLID Principles
- Single Responsibility Principle
- Open/Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle
Practice
- Describe SOLID with examples — Astha IT
- What are the SOLID principles — REVE Systems
Singleton Pattern
- Definition and purpose
- Implementation
- Thread-safety issues in the naive implementation
Practice
- Implement Singleton — Kite Games, full Java implementation plus a thread-safety warning
- Describe Singleton and write it in Java — REVE Systems
- Write and explain the Singleton pattern — REVE Systems
- Describe the Singleton pattern — WellDev