| Author |
About cohesion in Java
|
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
Hi ,
all these is theory i found about Cohesion class in Java .
High-cohesion means well-structured classes .
Cohesive means that a certain class performs a set of closely related actions.
A lack of cohesion, on the other hand, means that a class is performing several unrelated tasks
Though lack of cohesion may never have an impact on the overall functionality of a particular class
Can i get an example for this type of behaviour of a class??
Thanks .
|
Save India From Corruption - Anna Hazare.
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
Lets say that you have a hotel management program and that it has a class Manager that handles the checking in and out of customers and also the registering of customer.
That class has low cohesion. It would be much better to have 2 classes. One that handles checking in and out and the other one of registering customers.
Because then the have a high cohesion.
You could also read this
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
Ravi Kiran Va
Ranch Hand
Joined: Apr 18, 2009
Posts: 2234
|
|
|
Thank you very much .It was nice explanation.
|
 |
 |
|
|
subject: About cohesion in Java
|
|
|