How would you define the following code?
a) High cohesion
b) Low cohesion
I would say High as even though takeAndGlue()
does 2 things they are called with 2 separate methods, hence the stackTrace
is traceable.
public class Assembler()
{
public void take()
{
System.out.println("Take the thing");
}
public void glue()
{
System.out.println("Glueing the thing");
}
public void takeAndGlue()
{
take();
glue();
}
}