Questions About Code Design Flashcards
It is often said that one of the most important goals in Object-Oriented Design (and code design in general) is to have High Cohesion and Loose Coupling. What does it mean? Why is it that important and how is it achieved?
Why do array indexes start with ‘0’ in most languages?
How do tests and TDD influence code design?
Write a snippet of code violating the Don’t Repeat Yourself (DRY) principle. Then, explain why it is a bad design, and fix it.
What’s the difference between cohesion and coupling?
What is refactoring useful for?
Are comments in code useful? Some say they should be avoided as much as possible, and hopefully made unnecessary. Do you agree?
What is the difference between design and architecture?
In TDD, why are tests written before code?
C++ supports multiple inheritance, and Java allows a class to implement multiple interfaces. What impact does using these facilities have on orthogonality? Is there a difference in impact between using multiple inheritance and multiple interfaces? Is there a difference between using delegation and using inheritance? [This question is from The Pragmatic Programmer, by Andrew Hunt and David Thomas]
What are the pros and cons of holding domain logic in Stored Procedures?
In your opinion, why has Object-Oriented Design dominated the market for so many years?
What would you do to understand if your code has a bad design?