Solved

# Explain the term "Granularity"

Posted on 2002-04-08
650 Views
Greetings all,

Could someone explain what the term "granualrity" means please when used in the context of object-oriented systems.

0
Question by:ruff_ryder

LVL 5

Accepted Solution

jamoville earned 50 total points
ID: 6925595
Application Granularity:
One of the goals of object-oriented design is finer granularity. The purpose is to achieve a greater level of abstraction than possible with data/procedures-oriented design.
An application constructed with more finely granular objects (i.e. a lower number of functions per object) is likely to be more easily maintained because objects should be smaller and less complex.

More finely granular objects should also be more reusable. ... Therefore, each object's behavior should be more easily understood and analyzed.

Total Number of Objects
Application Granularity =  -------------------------
Total Function Points"

0

LVL 3

Author Comment

ID: 6927307
Hi jamoville,

I rejected you answer just so that we can have more discussion on this. I really want to make sure I'm understanding properly.

From what you've posted, This is what I understand:

Object Granularity describes how rich/complex a class' interface is. That is, if a class has a large interface, then it has a fine granularity, if small interface it has a large Granularity (i.e closer to 1.0).

I'm working this based on the formula you gave with one object and small and large interface accordingly.
0

LVL 2

Expert Comment

ID: 6927365
Simply put, the granularity is a measure of the amount of functionality (in terms of actual code and contained objects) a object contains. The finer the granularity, the simpler the object is. In OOD this is the goal - have a lot of simple objects in stead of a huge complex one. The reasons are easy to understand - maintainabilty, upgradeablity, re-use and so on.
0

LVL 3

Author Comment

ID: 6927383
Ok, I get you there. But doesn't having alot of objects in a system make it complex as well in terms of design?
0

LVL 2

Expert Comment

ID: 6927587
Initially, it might seem so. However, any given system has got X amount that it must do, and that must be explained/detailed in your design (if the design is to implemented thoroughly). So, whether you have a 10 page description of one class, or 10 single page descriptions of smaller classes with an extra page describing interactions, you end up with roughly the same amount of "work" to do in the design.

Of course there is overhead introduced by using smaller, simpler classes. But this initial outlay is more than compensated for in later stages of the development life-cycle when the inevitable addendums and alterations to the design happens. Also, for the programmers that has to implement the design, it is much easier to digest and implement/debug/test smaller pieces, if each piece is an independent entity.

Of course, there is a limit to everything. Breaking a class apart just for the sake of making it smaller isn't the idea.
0

LVL 16

Expert Comment

ID: 6928429
Referring to your post of 04/08/2002 10:03PM, note that the granularity of the object with the smaller interface would be finer.
0

## Featured Post

### Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.