cohesion (1 Viewer)

Tech

Registered User.
Local time
Today, 18:24
Joined
Oct 31, 2002
Messages
267
im not sure if this is a right place to post this but i would like to know what cohesion is?

what do they mean when there can be a 10% cohesion and a 90% cohesion when looking at a diagram with access paths?

thx :)
 

pono1

Registered User.
Local time
Today, 10:24
Joined
Jun 23, 2002
Messages
1,186
Tech said:
im not sure if this is a right place to post this but i would like to know what cohesion is?

what do they mean when there can be a 10% cohesion and a 90% cohesion when looking at a diagram with access paths?

thx :)

Primarily, it means two people are trying to tell one another they are in the same club because they speak the same language.

Strictly in the context of programming, it means the programming code is broken down into re-usable parts, usually into stand-alone classes. This way, the code parts can be more easily understood as well as easily moved from one project to another (like modular office furniture) without having to pay a developer to re-do similar things over and over again.

Even if you're not familiar with classes, this technique can be illustrated with a simple function. Ideally a function stands on its own, independent of any outside code to complete its task. As such, even though one programmer writes a function, many others can use it, even if they don't understand how it does what it does (this is one of the main reasons so many people visit forums like this -- to hunt for code to use).

Code:
Function AddTwoNumbers(FirstNum as Long, _
		      SecondNum as Long) as Long
'Given two numbers, return their sum.

	Dim MyNumA as Long
	Dim MyNumB as Long

	MyNumA = FirstNum
	MyNumB = SecondNum

	AddTwoNumbers = MyNumA + MyNumB
	
End Function

Any programmer can copy this function into their program and start using it. They don't have to know how to add two numbers -- or how to write code to add two numbers -- because the function does it for them. They would only need to know how to call it...

Code:
	Dim MySum as Long
	MySum = AddTwoNumbers(482, 928)

In the context of tables and "access paths," cohesion might be synonymous with atomicity. That is, maybe as they looked at the diagrams, they could have just as easily said: "This is broken down nicely." I'm not wholly sure. Or maybe you misheard them. Perhaps someone said, "The thing about winter -- I'm freezin 90% of the day."

Some people out there are nodding their heads and stroking their chins. Others are dozing off...

Regards,
Tim
 

Tech

Registered User.
Local time
Today, 18:24
Joined
Oct 31, 2002
Messages
267
huh? lol
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:24
Joined
Feb 19, 2002
Messages
43,638
Cohesion is actually the measure of the strength of functional relatedness of elements within a module. A module in this context can be anything - an application, a diagram, a module, a function, a subroutine. An element is an instruction, a group of instructions, a data definition or a call to another module; that is, any piece of code that accomplishes some work or defines some data.

A module that is strongly cohesive lends itself to being reused because its behaviour will be easy to describe and isolated from interaction with other pieces of code.

You should also look up coupling to get an understanding of the connections between modules. The concepts of coupling and cohesion have been written about since the early 70's and are the precursors to ideas that evolved into what are now called objects.

Obtaining a good understanding of coupling and cohesion and applying the principles will make your applications more stable and easier to build on for future requirements.
 

Users who are viewing this thread

Top Bottom