Disclaimer: This article was written few years ago and may no longer be relevant as software engineering has changed a lot in the last few years. This is what may be more relevant now: Future of Software Engineering - Gaurav Chandak
Machine Coding Round Complete Guide
Given the recent popularity of the machine coding round, most of the top tech companies (like Flipkart, Uber, Swiggy, Razorpay, Cred, etc) have started adopting it into their interview process. Since it is a relatively new interview format, very few candidates prepare for it and hence face elimination in this round.
Let’s look at the primary things you need to work on to crack the machine coding round:
Learn Object-Oriented Programming
In a machine coding round, the general expectation is that you’ll write object-oriented code.
Writing everything in a single file without any classes is just not acceptable in the interview. You are supposed to create multiple classes each containing properties and methods only related to that particular class (there should be a separation of concerns). Each class should have a file of its own. Single file is fine if you're coding in C++.
If you want to learn OOP hands-on, you can enroll into the 'Object Oriented Programming in C++' course.
You should be able to identify all the entities in the problem statement and should create classes for them. The entity classes (or models) should ideally reside in a ‘models’ folder. A model should only contain the properties of the entity, a constructor, getters, and setters for the properties.
There should not be any business logic in any model. And so you should create different classes for the business logic layer. These classes interact with different models and contain the core logic of the solution. They are generally called services and are kept in the ‘services’ folder.
The main method which will be used to test your solution should reside in a Driver class. Anything that does not deal with the core logic of the solution, like taking user input, should reside here. Ideally, the primary service class should be initialized and called from this class.
Learn to write readable code
Most of us are used to writing code that is only read by a computer. This is not the case in an interview or on the job where the code is read by actual people as well. And so writing unreadable code is something that you need to get out of.
It is essential to learn how to write proper and self-explanatory variable and method names. The interviewer should be able to understand the purpose of the variable or the method name just by reading its name. If that is not happening then you’ll most likely get rejected even if your code is fully functional with a decent design.
Create method names based on what is actually happening inside that method instead of why the caller is calling that method. Ensuring this makes the method/function reusable at multiple places. If the name says what the logic inside the method actually does, it allows the interviewer to skip going through it and instead focus on the core logic.
Create smaller methods and avoid having a lot of logic in a single method. If you can break the code in a method into multiple smaller methods, your code becomes more readable and reusable. Of course, every single line doesn’t warrant a new method unless it increases reusability.
Practice
One needs to practice to become good at anything, and this is no different. You’re supposed to write a clean, modular and extensible code in a couple of hours in a machine coding round.
To check if you’re ready to ace your machine coding interview round, you should try solving a few machine coding practice questions.
If you’re able to write a well-designed code in a couple of hours then you’re good to go. If not, practicing a few problems and improving with each attempt may help you get there.
Bonus: This tip is based on a few solutions in our 1st mock machine coding round. Either use camelCase or underscore_separated based on the language’s convention. Please do not use both in your solution.
This is a basic guide on how to prepare for the round. You may have to learn more concepts related to design principles and patterns, multithreading, etc. based on your seniority level.
---
Join our discord community to have healthy discussions on programming, interviews and job search.



