Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (47 sloc) 1.96 KB
Root.Smell.ClassSmell.FeatureEnvy Parent Index
Sibling aspects ClassSize DataClump


Classes that excessively use methods of other classes.


This aspect does not have any sub aspects.


public class Phone {
    private final String unformattedNumber;
    public Phone(String unformattedNumber) {
        this.unformattedNumber = unformattedNumber;
    public String getAreaCode() {
        return unformattedNumber.substring(0,3);
    public String getPrefix() {
        return unformattedNumber.substring(3,6);
    public String getNumber() {
        return unformattedNumber.substring(6,10);
public class Customerprivate Phone mobilePhone;
    public String getMobilePhoneNumber() {
        return "(" +
            mobilePhone.getAreaCode() + ") " +
            mobilePhone.getPrefix() + "-" +


This smell may occur after fields are moved to a data class; which makes the code less readable, and difficult to debug.

How to fix this

Move the operations on data to the newly defined class(given that the fields of one class were moved to this class) as well.