Questions About Code Design Flashcards

1
Q

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?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why do array indexes start with ‘0’ in most languages?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do tests and TDD influence code design?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Write a snippet of code violating the Don’t Repeat Yourself (DRY) principle. Then, explain why it is a bad design, and fix it.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s the difference between cohesion and coupling?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is refactoring useful for?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Are comments in code useful? Some say they should be avoided as much as possible, and hopefully made unnecessary. Do you agree?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between design and architecture?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In TDD, why are tests written before code?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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]

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the pros and cons of holding domain logic in Stored Procedures?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In your opinion, why has Object-Oriented Design dominated the market for so many years?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What would you do to understand if your code has a bad design?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly