Top 10 Object-Oriented Design Interview Questions

Amanda Fawcett - Nov 4 '20 - - Dev Community

Object-Oriented Design Interviews are essential for succeeding as a software engineer. Today, go over the top 10 OOD questions and the best approaches for design. This article was written by Fahim Ul Haq, CEO of Educative and former senior software engineer at Microsoft.


Object-Oriented Design (OOD) skills are a huge factor in your hireability at most big tech companies. OOD questions and answers give interviews a good sense of the following:

  • Whether a candidate can translate complex problems into a concrete set of objects
  • Whether a candidate can comprehend the interactions among those objects
  • Whether the candidate can identify patterns and apply time-tested design solutions

Object-Oriented Design Interviews are essential for succeeding as a software engineer, but most engineers dread OOD questions. They get abstract quickly, and there are usually more than one correct answer to any question. On top of that, most beginner developers have not had an opportunity to design complex systems in the real-world.

We want to make it easier for all software developers to prepare for design interview questions, so we've compiled the top 10 questions you can expect in an interview at top tech companies like Google, Amazon, Microsoft, and Facebook. I’ll discuss the best approaches and design patterns to help you apply them in real life coding interviews.


How to approach OOD interview questions

When it comes to Object Oriented Design interview questions, interviewers are trying to assess your nuanced understanding of complex problems and how you transform requirements into comprehensible classes and subclasses.

OOD questions generally follow similar patterns. During the job interview, you will be given a vague design problem and a set of constraints. Then, you need to leverage your design skills to figure out the “level” of solution that the interviewer is looking for.

You need to think about what functionality is needed and come up with a workable using design principles and a programming language of your choice.

Note: For OOD interviews, top tech companies prefer mainstream object-oriented programming (OOP) languages like Java, Python, C+, JavaScript, Ruby, and more.

Interviewers care most about the right balance between a solution that works immediately that is adaptable and flexible to change in the future. To simplify things, you can take the following approach for any OOD question you encounter:

Alt Text

  1. Clarify requirements: You need to what the interviewer expects of you. You should ask clarifying questions. The interviewer will likely appreciate it. Doing this at the start will save a tremendous amount of time later.

  2. Hash out the primary use cases: Brainstorm and talk through the use cases of your design problem. Make sure you understand the functionality your system is expected to have.

  3. Identify key Objects: Now, you want to identify all objects that will play a role in your software design solution. For example, if you’re designing a parking lot, these you'll need to identify the vehicles, parking spots, parking garages, entrances, etc.

  4. Identify Operations supported by Objects: Now with the objects you've identified, you need to think about their behaviors. For example, a car can move, park in a given spot, and display a license plate. And so on.

  5. Identify Interactions between Objects: Map out the relationships between the objects that interact with each other. This is a really important step. For example, a car should be able to park in a parking spot. Parking garages should be able to fit multiple parking spots, and so on.

Now we will go over the top questions that I’d recommend practicing. I will also share some pointers about the main things an interviewer is looking for in your answers throughout the interview process.

Alt Text

Design Amazon / Flipkart: build an online shopping platform

An interviewer will be looking for the basic functionality of necessary features like signup and logic. They will also be assessing the following:

  • Discoverability: How will a buyer be able to discover a product? How will their search display results?
  • Cart & Checkout: Users expect a checkout process and virtual to behave a certain way. How will the frontend design adhere to these best practices while also implementing new or innovative checkout semantics?
  • Payment Methods: Users should be able to pay with credit cards, gift cards, etc. How will the payment method work? What new functionalities can be added to improve payment processes?
  • Product Reviews & Ratings: Ratings improve online shopping experiences. When and how can a user post a review or a rating? How will you track useful reviews and de-prioritize less useful reviews?

Design a Movie Ticket Booking System

For a movie ticket booking system, you'll need to design a system where a person can search movies for a given city and book it. Interviewers look for the following points beyond the main system architecture:

  • Duplication: How will you handle common instances, such as the same cinema having multiple cinema halls that show different movies at the same time?
  • Payment Handling: What is the process purchasing a ticket? What options are available to a user (i.e. credit card, gift card)?
  • Selection: How can a user pick their seat? How do we communicate which seats have already been taken?
  • Price Variances: How will you account for discounted pricing (i.e. children, veterans, etc.)?

Alt Text

Design an ATM

Designing an ATM requires many classes and interactions between objects. This is a common system design interview question that tests your ability to think complexly about many interacting objects. Interviewers would want to see you discuss things like:

  • Overdrawing: What would you do when the ATM has no cash left?
  • Pin Verification: What happens when a user enters an incorrect PIN multiple times?
  • Card Reading: How do we detect and communicate that the user has entered a card the wrong way?

Design an Airline Management System

This system involves the scheduling of flights, air ticket reservations, flight cancellations, customer support, and staff management. Daily flights updates can also be retrieved by using the system. A good answer from an interviewer’s perspective addresses:

  • Itinerary Complexity: How do multi-flight itineraries work? How will you handle the situation where multiple passengers on the same itinerary?
  • Alerts: How will customers be notified when there is flight status change?
  • External Access: How would the system interact with other actors in the reservation process, such as a front-desk operator for an airline?

Your complete guide to the OODI.

Confidently approach OOD questions by studying carefully handpicked case studies. Educative's text-based courses are easy to skim and feature live coding environments, making learning quick and efficient.

Grokking the Object Oriented Design Interview

Design Blackjack (a card game)

Your goal is to design the popular game Blackjack. The main classes will be cards, decks, dealer's shoe, hand, players, and game sequence.
Your answer should consider the following as you design this system:

  • Scoring: On what level of the system is scoring handled? What are the advantages and disadvantages?
  • Rules: What flexibility exists for playing with slightly different house rules?
  • Betting: How are bet payouts handled? How will you factor odds?

Alt Text

Design a Hotel Management System

A Hotel Management System is a software built to handle all online hotel activities easily and safely. The system should allow the manager to keep track of all the available rooms, book rooms, and generate bills. You’ll want to make sure you discuss:

  • Room Complexity: How will the system support different types of rooms?
  • Alerts: How will the system alert users that their check-in date is approaching?
  • Customization: How can users make special requests? Which requests are supported by the system?
  • Cancellation / Modification: How will cancellation work? How will other modifications be handled?

Design a Parking Lot

This is one of the most common OOD interview questions. It is essential that you ask questions about requirements for this system, as they differ significantly. The interviewer will want to hear the following points:

  • Payment Flexibility: How are customers able to pay at different points in the lot and by different methods?
  • Capacity: How will the capacity of each lot be handled? What happens when the lot is full?
  • Vehicle Types: How will capacity be allocated for different parking spot types?
  • Pricing: How will pricing be handled? It should accommodate different rates for each hour.

Design an Online Stock Brokerage System

An online stock brokerage system automates traditional stock trading using computers and the internet, making the transaction faster and cheaper. This question is all about speed. A good answer will cover these points:

  • Watchlists: How will the system handle watchlists created to save/monitor specific stocks?
  • Transaction Types: How would the system handle different transaction types? What types should be supported?
  • Stock Lots: How will the system differentiate between ‘lots’ of the same stock if a user has bought that stock multiple times?
  • Reporting: How will the system generate reports for updates at a monthly, quarterly, and annual rate?

Design a Car Rental System

A Car Rental System is a software built to handle the renting of automobiles and other forms of transportation for a short period of time. A car rental system often has numerous local branches and be primarily located near airports. You should be able to discuss the following:

  • Identification: How will each vehicle be uniquely identified and located? Where will they be located?
  • Fees: How will the system collect a late fee when required?
  • Logs: What kind of log system will track identification for vehicles? How will that log be accessed?
  • Customization: How will the system handle requests for additional user services such as roadside assistance, full insurance, and GPS?

Alt Text

Design Facebook — a social network

A social network like Facebook requires many relationships and interconnected networks. It should allow for a lot of variance, personalization, and recommendation systems using ML components. Your answer should ideally discuss:

  • Discoverability: How will users search for other users’ profiles? Will there be ML components in place for this?
  • Following: How will users follow or unfollow other users without becoming a direct connection?
  • Groups / Pages: How can members create groups, pages, and profiles?
  • Privacy: How does the system handle privacy lists with certain content to be displayed only to specified connections?
  • Alerts: How will users be notified for pre-selected events?

What to learn next

Questions like these demonstrate your skills in object oriented analysis and design. Programmers who can think complexly about object oriented systems stand out for having more potential beyond basic computer science skills.

As you are preparing for object oriented design interviews, it's important to refresh the basic principles of OOP as well (encapsulation, polymorphism, and so on). Then, begin working through real-world OOD problems.

If you’re looking for detailed answers to the above questions, including actual UML diagrams and code snippets, take a look at Educative's course Grokking the Object-Oriented Design Interview. This course is a complete guide to master the OODI using a set of carefully handpicked case studies . You'll cover everything you'll need to nail your interviews with confidence.

Happy learning!

Continue reading about programming interviews

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player