Are you among those who wonder what to study for the Low Level System Design interviews or Object Oriented System Design interviews? If you are, then here is a step-by-step breakdown of what your preparation should look like.
Object Oriented Programming Concepts
The first step in your preparation should be mastering the concepts of OOPs (Object Oriented Programming). It is something which all freshers as well as experienced software developers must know. This includes topics like
There are deep-dives you can make into each of these topics as well, like how, for instance, in polymorphism we must know things like:
- What is compile time?
- What is run time?
- What is method over loading?
- What is method over writing?
You should be thorough with these concepts since system design is extremely subjective and when you’re going to design their classes or discuss the same with the interviewer, you should be able to use the appropriate terms for the concept you’re explaining . Imagine an interviewer asks you whether you will keep specific data together or separate? You should be able to use terms like Encapsulation or Abstraction when telling the interviewer about your thought process, and use these concepts in your discussion.
Once you’ve developed your understanding of OOPs concepts, the next important item on the list is SOLID principles. This is a topic which you just can’t memorize as interviewers are rarely interested in asking theoretical questions about SOLID principles. What you do need to have is a thorough understanding of SOLID principles because once you start designing and implementing your classes, you will need these principles in your process.
For instance, you may think that in order to implement Single Responsibility, you need to design your class in a specific way. Or you might want to make sure that your class is extendable, leading you to talk about the ‘O’ in SOLID.
Once you do have a grasp of these principles, whenever you are examining LLD examples or working on code for your work, you must try to identify what SOLID principles have been used in the code. Whether you are encapsulating or abstracting, and how you are implementing it. This will help you to improve your thinking and you will start to design classes in your LLD interviews faster. These are some of the basic concepts that one should definitely know.
The next important thing to ace any LLD interview are Design Patterns. People really underestimate this topic when compared to HLD or DSA. These patterns are very crucial for your LLD interviews as well as in your day-to-day coding.
Design patterns, despite being so important, are among the lesser known and explained topics in programming. In short, design patterns implement OOPs concepts and SOLID principles to create solutions for very commonly occurring problems. This is so important that even if you are not giving LLD interviews, you must know it.
There are a lot of misconceptions regarding this as well. People often get overwhelmed by seeing that there are so many design patterns. They miss out on the fact that the most common and important design patterns are Factory, Abstract Factory, Singleton and Observer. Whenever you are creating classes or objects, you must question yourself, “Am I solving a problem that any of the above mentioned patterns solve?”
These types of pattern questions are very common in interviews. Along with the four design patterns mentioned above, it is also recommended that you learn about the
design patterns. If you know these nine design patterns clearly, you can clear all LLD interviews. But make sure that you understand where and why to apply these design patterns, so that when a question is given you can tackle it well.
Another must-have for any LLD interview is the ability to draw class diagrams. You should know how to name it, where to write the methods and the properties, how to mention what’s public and private, and so on. A class diagram is critical because you are able to visualize how your entire system is going to work. When drawing your class diagrams:
- You should be able to explain the relationships between the classes.
- You should be able to explain the lifetime of the class.
- You should be clear about which classes you are marking as abstract classes
- You must also talk about multiplicity, like how there might a single object for a class or n objects for a class, leading to 1-to-1 relationships and 1-to-n relationship.
Something very important to note about describing relationships between classes is the difference between ‘has an instance’ and ‘is an instance’ – like how one class object has another class object or one class object is a class object. The differences between the two should be pretty clear for you so you’re able to use them in the right scenario, and explain it when needed.
And of course, when you’re drawing class diagrams, make sure you use UML conventions.
Since most interviews nowadays are happening online, you will be given access to a whiteboard and there are possibilities that you might not be able to draw arrows properly in your diagram. But you should still be able to talk about it.
As an example, the interviewer might ask you to write relations between classes properly explaining whether it is aggregation or composition. So even if you are not able to draw properly, you should be able to explain it.
Sequence Diagrams and Use Case Diagrams
Other than class diagrams, these are two other types of diagrams which are very rarely asked in interviews but you must be familiar with so you’re fully prepared. These are pretty easy diagrams to learn, and all you will really need is to say what will happen for a particular use case, and draw a rough diagram. These are definitely not as important as class diagrams or design patterns, and so having a rough idea is enough for you to draw it and communicate it to others.
You might be asked in the LLD interview to talk about the test cases for the system you will design. Now this is something which is not that common, but you should definitely give it a look. This way you’ll be thinking about edge cases when you’re designing the system itself. Also if you are writing code, you might be asked about thread safety from the topic of multithreading, especially when you are applying singleton design pattern.
Once you are done with all these topics, you need to look at the most common examples of LLD interviews. You can check out a lot of these in YouTube videos and blog posts. Few important ones are
- Hotel Management system
- Car Parking System
- Elevator management
- Chess Design (or any 2-player game design)
- Tic-tac toe game
- Ticket booking System
These are few of the common questions that are being asked. So when going through these solutions, you should also think about everything that you have studied, like what principles are being applied or how the class diagram looks. From the diagram, you should be able to understand where they’ve used specific types of relationships, and why they used those relationships. This will help you logically answer the interviewer’s questions.
We really hope this guide helps you in your LLD interview preparation. Would you like to watch a video walking you through the different steps in our LLD Roadmap? Check out our video on the official YouTube channel!