How I Cracked the Object Oriented Design Interview at Amazon
Find more useful articles at www.davidseek.com
The most prominent questions to last week’s article, “How I got into FAANG”, revolved around the Object Design interview. Namely, “what it is?”, “how to prepare for it?” as well as what the OOP interview at Amazon actually looks like.
Object Oriented Design
Object Oriented Programming is a programming paradigm based on the concept of objects, which can contain properties and functionality.
When designing the OOP way, we could define a class Human
. With attributes such as height
and hairColor
and methods such as eat()
and sleep()
.
Our desire could now be to extend the functionality of the Human
Object by the method code()
. But since we don't want every Human
to be able to code()
, we'd sub-class Human
, to inherit all attributes and methods.
We then have the ability to add further functions or attributes, or override existing ones.
class SoftwareEngineer: Human {}
When designing objects, make sure to think about what kind of attributes should be exposed and what kind of parent properties can potentially be extracted into a super-class.