java - How does this code have LCOM4 value 1? -
the sonar documentation shows following refactored code of lcom4 = 1. seems me should 2, because there no cohesion between getfullname , getfulladdress. missing?
public class client { public string firstname; public string lastname; public address address; public string getfullname() { return firstname + " " + lastname; } public string getfulladdress() { return address.getfulladdress(); } }
seems you've found documentation issue! according freddy mallet, isn't great example of lcom4 refactoring , fixed:
http://sonar.15.n6.nabble.com/question-about-lcom4-td5009876.html
generally speaking, there handful of data structures don't fit lcom4 algorithm, important remember when making refactoring decisions. pojos , concrete implementations of template method pattern 2 examples have found fall category.
in specific case mallet in above link explains specific bean granted lcom4=1 because getfulladdress considered bean accessor, , bean accessors excluded lcom4 scoring.
Comments
Post a Comment