• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

cohesion question

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Select 3 options ?

A) Cohesion helps understand a class and method does
B) Cohesion helps understand one class without studying others
C) Cohesion minizes changes in other classes when one class is changed
D) Cohesion allows the use of description names
E) Cohesion promotes reuse of classes or methods
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmm... i always get these wrong. Is it A C E ?
 
Ashley Bideau
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have the answer for this question but selected B,C & E.

-Ashley
 
Ranch Hand
Posts: 584
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I would go for A, D and E.

B and C are incorrect because everything that mention dependence with other classes are related to coupling. In fact, B and C are mentioning the beneficits of loose coupling.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think any of those answers are 100% complete, and therefore would say they are all wrong.

Cohesion is the ability of one class to do one thing and one thing really well. So you don't have a Object that is a Car that also Drives itself.

Mark
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ashley Bideau:
Select 3 options ?

A) Cohesion helps understand a class and method does
B) Cohesion helps understand one class without studying others
C) Cohesion minizes changes in other classes when one class is changed
D) Cohesion allows the use of description names
E) Cohesion promotes reuse of classes or methods



Some of these are hard to understand, as I think they're missing some words, but here's what I think the answers are and why.

"A)" because a cohesive method is highly focused on a single task, which should simplify the code and make it easier to follow. The same should hold true for the entire class.

"D)" If it's focused on a single task, descriptive naming is easy.

"E)" I know this one is right (the most obviously right one, I think). By keeping things as generic as possible (yeah I know how is it focused and generic)....eh...I feel like I'm stretching now, so I'll say no more
reply
    Bookmark Topic Watch Topic
  • New Topic