tags:

views:

53

answers:

2

Hi All

What should be the measures that should be used to identify that code is over abstracted and very hard to understand and what should be done to reduce over abstraction?

+1  A: 

Personally I would say that "What is the ideal level of abstraction?" is a subjective question.

I don't like code that uses a new line for every atomic operation, but I also don't like 10 nested operations within one line.

I like the use of recursive functions, but I don't appreciate recursion for the sole sake of recursion.

I like generics, but I don't like (nested) generic functions that e.g. use different code for each specific type that's expected...

It is a matter of personal opinion as well as common sense. Does this answer your question?

Martin
+2  A: 

"Simplicity over complexity, complexity over complicatedness"

So - there's a benefit to abstract something only if You are "de-leveling" complicatedness to complexity. Reasons to do that can vary: better modularity, better encapsulation etc.

Identifying over abstraction is a chicken and egg problem. In order to reduce over abstraction You need to understand actual reason behind code lines. That includes understanding idea of particular abstraction itself (in contrast to calling it over abstracted cause of lack of understanding). And that's not enough - You need to know a better, simpler solution to prove that it's over abstracted.

If You are looking for tool that could do it in Your place - look no more, only mind can reliably judge that.

Arnis L.
"only mind can reliably judge that" ... at least for the next 20 years... ;-)
Martin