Are some ways of structuring a class hierarchy more efficient than others? Is there a way to measure this? How do design patterns factor in to computational complexity? Am I just thinking about this wrong? Just curious.
Asked
Active
Viewed 129 times
-1
-
These questions are *very* broad. Not to mention any answers would be irrelevant anyway (design trumpfs performance almost universally, and if you have to ask if your case is an exception, it isn't). – Nov 22 '11 at 18:33
2 Answers
2
Object-oriented programming has nothing to do with algorithms (and thus asymptotic runtime), it's just a popular way of structuring programs in an attempt to make them more flexible and resistant to change.
Same for design patterns.

Peter Alexander
- 53,344
- 14
- 119
- 168
0
If you don't introduce silly bugs in your OO code, asymptotic complexity of any algorithm won't change. Constant multiplier in formula for memory consumption/running time of your particular algorithm can change, but not it's asymptotic behavior. But this change , usually, is practically unimportant.

Victor Sorokin
- 11,878
- 2
- 35
- 51