Top 10 Object Oriented Analysis and Design Interview Questions and Problems for Experienced Developers
Check your Object Oriented Analysis and Design skills by solving these Object Oriented Design Problem before your next Programming job interview

Testing Object Oriented analysis and design skill of a candidate is quite common in programming job interviews. Questions like, how do you design a vending machine or a traffic control system are very popular in object-oriented programming language interviews, like Java and C++. Designing a software System requires good experience and knowledge of tools of object-oriented design and analysis.
You should not only be good at OOP fundamentals like Abstraction, Inheritance, Polymorphism, Encapsulation, Coupling, Cohesion, Association, Aggregation, or Composition but also on several crucial object-oriented design principles like SOLID Principles of Object-Oriented Design, which is the building block for writing flexible and maintainable code. Good knowledge of when to use a class over an interface is also essential for designing a maintainable software or Java application. Now, the questions are how do you develop such skills? You need to practice and practice hard. This is why I am sharing some frequently asked object-oriented design questions from Java programming interviews here. Anyway, Software design has many facets, object-oriented system design is just one of them. Sometimes, you may be asked to design a database for an e-commerce application. Database design is totally different than object-oriented design. There you need to follow rules of flexible and maintainable designs and Normalization. You need to make sure your tables are in 3rd normal form, and there is a nice balance between duplication of data and the easiness of querying the data. Btw, this tutorial is about object-oriented system design, and I’ll share questions on that. I’ll write about SQL and database design sometime later to give you more information and some practice questions as well. Another thing to note is that now there are a couple of excellent courses available online, which can help you with this challenging aspect of coding interviews. I have tried the Grokking System Design Interview and Grokking the Object-Oriented Design Interview courses from Educative, and I must say they are excellent to prepare well. These courses are designed by the hiring managers of Google, Facebook, Microsoft, and Amazon. They not only has a set of carefully handpicked case studies, which have been repeatedly asked at the top tech companies but also provide a thorough experience to handle different object-oriented design scenarios.
10 Object-Oriented and Software Design Interview Questions and Problems
Here is my list of frequently asked object-oriented and software design questions from programming job interviews. You will find such kinds of questions not only on biggies like Amazon, Google, Microsoft, and Facebook but also on small startups and service-based companies like Infosys, Wipro, TCS, and Cognizant. Though for a comprehensive preparation, I also suggest you take a look at Java Programming Interview Exposed, which contains questions from all important Java topics, like Core Java, data structure and algorithms, multithreading, garbage collection, JVM internals, and frameworks like Spring and Hibernate.
Problem 1: Design a Vending Machine in Java (solution)
You need to design a Vending Machine which follows the following requirements: 1. It should accepts coins of 1,5,10,25, 50 Cents, i.e., penny, nickel, dime, and quarter as well as 1 and 2 dollar note
2. Allow user to select products like CANDY(10), SNACK(50), NUTS(90), Coke(25), Pepsi(35), Soda(45)
3. Allow users to take a refund by canceling the request.
4. Return the selected product and remaining change if any
5. Allow reset operation for vending machine supplier
You can try solving the problem on your own before looking at the solution. At least come up with classes and method names and relationship between classes. Preparing a UML diagram is bonus.

Problem 2: Design a URL shortener service like bit.ly? (solution)
You need to design a URL shortener service like bit.ly or goo.gl. You can insert the full URL and get a short one. Your short URL should also record the stats about how many times it was accessed. Your system should also be able to handle concurrent users and millions of URL shortening per day. Think about auditing and bookkeeping, as well. Btw, If you struggle to start with these questions, then you can also see the Grokking The System Design Interview, which contains a whole chapter on designing URL shortening services like TinyURL, Google URL, and Bitly. Here is the system diagram from the same course, which explains the different components of a URL shortening service. I strongly suggest you check the course, this lesson is also available for a FREE preview.

Problem 3: Design a Lift system in your programming language?
An elevator is a combination of at least two elevators, one going up and another coming down. The goal is to minimize the waiting time of the user. Make sure you how your design will evolve if a lift is installed on high-rise buildings over 20 floors. How many lifts do you need to serve 40 floors with a waiting time of no less than 30 seconds on average. Think about the parking strategy of your lift, i.e., which floor they should be resting on or should they keep going up or down, etc.
If you need solution, you can watch the following video which explains how to design a lift system step by step but as I said, you must try to come up with basic design first.









