- Tell me about the Hollywood Principle.
- Why are global and static objects evil? Can you show it with a code example? [A]
- Tell me about Inversion of Control and how does it improve the design of code. [A]
- The Law of Demeter (the Principle of Least Knowledge) states that each unit should have only limited knowledge about other units and it should only talk to its immediate friends (sometimes stated as "Don't talk to strangers"). Would you write code violating this principle, show why it is a bad design and then fix it?
- What are the differences between Active-Record and Data-Mapper? [A]
- Active-Record is the design pattern that promotes objects to include functions such as Insert, Update, and Delete, and properties that correspond to the columns in some underlying database table. In your opinion and experience, which are the limits and pitfalls of the this pattern?
- Data-Mapper is a design pattern that promotes the use of a layer of Mappers that moves data between objects and a database while keeping them independent of each other and the mapper itself. On the contrary, in Active-Record objects directly incorporate operations for persisting themselves to a database, and properties corresponding to the underlying database tables. Do you have an opinion on those patterns? When would you use one against the other?
- Why it is often said that the introduction of
null
is a "Billion dollar mistake"? Would you discuss the techniques to avoid it, such as the Null Object Pattern introduced by the GOF book, or Option types? - Many state that, in Object-Oriented Programming, Composition is often a better option than Inheritance. What's you opinion? [A] [A] [A]
- Tell me about Domain driven design. A
- What is an Anti-corruption Layer? [A]
- Singleton is a design pattern that restricts the instantiation of a class to one single object. Writing a Thread-Safe Singleton class is not so obvious. Would you try?
- The ability to change implementation without affecting clients is called Data Abstraction. Produce and example violating this property, then fix it.
- How would you deal with Dependency Hell?
- Is goto evil? You may have heard of the famous paper "Go To Statement Considered Harmful" by Edsger Dijkstra, in which he criticized the use of the
goto
statement and advocated structured programming instead. The use ofgoto
has always been controversial, so much that even Dijkstra's letter was criticized with articles such as "'GOTO Considered Harmful' Considered Harmful". What's your opinion on the use ofgoto
? [A] - The robustness principle is a general design guideline for software that recommends "Be conservative in what you send, be liberal in what you accept". It is often reworded as "Be a tolerant reader and a careful writer". Would you like to discuss the rationale of this principle?
- Separation of Concerns is a design principle for separating a computer program into distinct areas, each of ones addressing a separate concern. There are a lot of different mechanisms for achieving Separation of Concerns (use of objects, functions, modules, or patterns such as MVC and the like). Would you discuss this topic?