Large classes
This is another very common smell. How many times have you found yourself working on classes with thousands of lines? It’s nobody’s fault, it’s just that classes start small and, very understandably, gradually end up incorporating more information and functionality. There’s nothing wrong with that; the important thing is to realize it and refactor it.
A practical way to notice that a class is too big is when there are too many fields (instance variables). If there are too many fields in a class, it’s likely doing too many things; besides having too many responsibilities, often in this case, code duplication becomes a problem.
You can create (extract) a new class to group several variables together. Pick the variables that naturally go hand in hand and put them in a component. For instance, if you see a bunch of parameters called something such as priceAmount
and priceCurrency
, they are probably meant to be part of the same component...