Suffice to say, I didn’t get the job
Better late than never
Now here’s the questions I was asked along with the answers I’ve come to understand. If an answer is missing then I’m working on it (not text book definitions but a practical understanding).
- What’s the difference between Null and Undefined?
- They’re different Types; Null being a special type of Object whereas Undefined is an ‘undefined’ type. Null is assigned whereas Undefined implies a declared variable has not been assigned a value
Object Oriented Programming
- What is encapsulation?
- What is inheritance?
- Using the methods and attributes of a (parent) class as the foundation of a (child) class, so it helps with code reuse.
- Why favour composition over inheritance? (Design Pattern)
- Firstly, what is composition and how does it differ from inheritance?
Not asked but probably would have, to round off the big four tenants of OOP:
- What is abstraction?
- What is polymorphism?
- Instances of Classes have different functionality while sharing the same interface. E.g. an instance of a Shape Class may take on one of many forms (e.g. it’s instance may be a triangle, square, etc.) but regardless of its internal state, they may all have a .draw() method available (as opposed to .drawCircle(), .drawSquare()). This helps with writing modular code.
- What is composition?
- Similar to the mathematical idea of composition; that functions can be chained by taking the result of the first as input to the second, the result of the second as input to the third and so on.
Being able to sit down with someone who’s some years ahead of you in what you want to do is valuable. Passing comments during pair programming such as the unintuitive ‘do repeat yourself’ (so that a function has a single responsibility) have left an impression which influences how I think about code. It’s reinforced my understanding of why mentors are important, even if you have just such a fleeting experience.