Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between bloated class and tagged class?

As i read in Effective java

Bloated class hierarchies can lead to bloated classes containing many methods that differ only in the type of their arguments, as there are no types in the class hierarchy to capture common behaviors.

and in Link

A bloated class often has many special cases: attributes or behavior valid for some instances but not others. Often programmers attempt to deal with special cases by introducing type tags.

and similarity is there between Tagged class to bloated class as in Effective java it is mentioned that:

a class whose instances come in two or more flavors and contain a tag field indicating the flavor of the instance. instances are burdened with irrelevant fields belonging to other flavors.

so concluding both classes might have Tag Types/Fields and both classes are having so many implementations (so many features simulated in one class).

i got confused to these terminologies and i want to know that ,what is the difference between these two Bloated class and Tagged class??

like image 807
Prashant Avatar asked Mar 20 '15 13:03

Prashant


1 Answers

  • A bloated class is bloated (see below).
  • A tagged class has one or more tags.
  • A tagged class is likely bloated, a bloated class is not necessarily tagged.

"Bloated" is (somewhat) subjective, "tagged" is trivial to identify. "Bloat" can refer to many things; poor separation of concerns, missing encapsulation, differing levels of abstractions, and so on.

"Tagged" is less subjective, because there will be a field that defines the separation of functionality, abstraction, etc.

like image 181
Dave Newton Avatar answered Sep 19 '22 10:09

Dave Newton