coarse-grained object and fine-grain object

Discussion in 'Java' started by gk, Sep 6, 2010.

  1. gk

    gk Guest

    what is coarse-grained object and fine-grain object ? I find this
    references in HTTPSession context.

    (1)what are they ?
    (2) why/how such peculiar varbiage ?
     
    gk, Sep 6, 2010
    #1
    1. Advertising

  2. gk

    Eric Sosman Guest

    On 9/6/2010 8:30 AM, gk wrote:
    > what is coarse-grained object and fine-grain object ? I find this
    > references in HTTPSession context.
    >
    > (1)what are they ?


    See this page for explanations:

    http://www.google.com/search?q=coarse grain object

    > (2) why/how such peculiar varbiage ?


    Just the prafarance of whoaver invanted the tarminology.

    --
    Eric Sosman
    lid
     
    Eric Sosman, Sep 6, 2010
    #2
    1. Advertising

  3. Eric Sosman wrote:
    > On 9/6/2010 8:30 AM, gk wrote:
    >> what is coarse-grained object and fine-grain object ? I find this
    >> references in HTTPSession context.
    >>
    >> (1)what are they ?

    >
    > See this page for explanations:
    >
    > http://www.google.com/search?q=coarse grain object
    >
    >> (2) why/how such peculiar varbiage ?

    >
    > Just the prafarance of whoaver invanted the tarminology.


    The Stan James comment in
    http://www.coderanch.com/t/99845/patterns/Coarse-grained-fine-grained-objects
    is how I usually see it. I got there by following your link.

    AHS
    --
    Before a man speaks it is always safe to assume that he is a fool.
    After he speaks, it is seldom necessary to assume it. -- H.L. Mencken
     
    Arved Sandstrom, Sep 6, 2010
    #3
  4. gk

    Lew Guest

    gk wrote:
    >>> what is coarse-grained object and fine-grain object ? I find this
    >>> references in HTTPSession context.
    >>>
    >>> (1)what are they ?


    Eric Sosman wrote:
    >> See this page for explanations:
    >>
    >> http://www.google.com/search?q=coarse grain object


    gk wrote:
    >>> (2) why/how such peculiar varbiage ?


    Eric Sosman wrote:
    >> Just the prafarance of whoaver invanted the tarminology.


    There's absolutely nothing peculiar about the terminology. It is utterly
    standard English and utterly common.

    <http://en.wikipedia.org/wiki/Granularity>

    Why? Because the term accurately describes the usage.

    How? By typing "coarse-grained" or "fine-grained".

    --
    Lew
     
    Lew, Sep 6, 2010
    #4
  5. gk

    gk Guest

    On Sep 6, 7:22 pm, "Arved Sandstrom" <> wrote:
    > Eric Sosman wrote:
    > > On 9/6/2010 8:30 AM, gk wrote:
    > >> what is coarse-grained object and fine-grain object ? I find this
    > >> references in HTTPSession context.

    >
    > >> (1)what are they ?

    >
    > >     See this page for explanations:

    >
    > >http://www.google.com/search?q=coarse grain object

    >
    > >> (2) why/how  such peculiar varbiage ?

    >
    > >     Just the prafarance of whoaver invanted the tarminology.

    >
    > The Stan James comment inhttp://www.coderanch.com/t/99845/patterns/Coarse-grained-fine-grained...
    > is how I usually see it. I got there by following your link.


    Not yet clear. I found the following text from the link you posted.

    It says...

    Coarse grained is often better in distributed systems because calls
    between distributed components can be expensive and time consuming.
    Fine grained might be better in a very flexible system because clients
    could invent new combinations of calls to do new tasks.


    Not happy yet. Could you please provide EXAMPLE which could illustrate
    the things better way.
    I'm talking about coarse-grained *object* and fine-grain *object* in
    HttpSession context. Looks like they are talking about something else.
     
    gk, Sep 7, 2010
    #5
  6. gk

    gk Guest

    On Sep 6, 9:04 pm, Lew <> wrote:
    > gk wrote:
    > >>> what is coarse-grained object and fine-grain object ? I find this
    > >>> references in HTTPSession context.

    >
    > >>> (1)what are they ?

    > Eric Sosman wrote:
    > >>      See this page for explanations:

    >
    > >>http://www.google.com/search?q=coarse grain object

    > gk wrote:
    > >>> (2) why/how  such peculiar varbiage ?

    > Eric Sosman wrote:
    > >>      Just the prafarance of whoaver invanted the tarminology.

    >
    > There's absolutely nothing peculiar about the terminology.  It is utterly
    > standard English and utterly common.
    >
    > <http://en.wikipedia.org/wiki/Granularity>
    >
    > Why?  Because the term accurately describes the usage.


    Ok. I have gone through that link . I find these texts interesting...

    it says ...

    "...For example, a yard broken into inches has finer granularity than
    a yard broken into feet.
    The terms granularity, coarse, and fine are relative, used when
    comparing systems or descriptions of systems. An example of
    increasingly fine granularity: a list of nations in the United
    Nations, a list of all states/provinces in those nations, a list of
    all counties in those states, etc...."

    OK...so far the definition looks nice.

    However, we are talking about coarse-grained objects and fine-grained
    objects in HttpSession context ?

    SO, Can we map this way that fine-grained objects holds more detailed
    information properties of the object ? and coarse-grained objects are
    less informative ?

    In other words if I write two classes as below

    class USA1{
    private String[] states

    }


    class USA2{
    private String[] states
    private String[] city
    private String[] mayor

    }


    Is not objects of class USA2 are finer grained objects now ? I say so
    because they are holding much detailed information than objects of
    class USA1) ?

    So, In my understanding objects of class USA2 are finer grained
    objects relative to objects of class USA1.

    Correct me if my understanding is wrong.

    Thanks
     
    gk, Sep 7, 2010
    #6
  7. In article
    <>,
    gk <> wrote:

    > Could you please provide EXAMPLE which could illustrate the things
    > better way. I'm talking about coarse-grained *object* and fine-grain
    > *object* in HttpSession context.


    This article discusses granularity as it relates to the performance of
    HTTPSession state persistence:

    <http://www.theserverside.com/news/1364410/Under-the-Hood-of-J2EE-Clustering>

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Sep 7, 2010
    #7
  8. gk

    Lew Guest

    On 09/07/2010 03:28 AM, gk wrote:
    > On Sep 6, 9:04 pm, Lew<> wrote:
    >> gk wrote:
    >>>>> what is coarse-grained object and fine-grain object ? I find this
    >>>>> references in HTTPSession context.

    >>
    >>>>> (1)what are they ?

    >> Eric Sosman wrote:
    >>>> See this page for explanations:

    >>
    >>>> http://www.google.com/search?q=coarse grain object

    >> gk wrote:
    >>>>> (2) why/how such peculiar varbiage ?

    >> Eric Sosman wrote:
    >>>> Just the prafarance of whoaver invanted the tarminology.

    >>
    >> There's absolutely nothing peculiar about the terminology. It is utterly
    >> standard English and utterly common.
    >>
    >> <http://en.wikipedia.org/wiki/Granularity>
    >>
    >> Why? Because the term accurately describes the usage.

    >
    > Ok. I have gone through that link . I find these texts interesting...
    >
    > it says ...
    >
    > "...For example, a yard broken into inches has finer granularity than
    > a yard broken into feet.
    > The terms granularity, coarse, and fine are relative, used when
    > comparing systems or descriptions of systems. An example of
    > increasingly fine granularity: a list of nations in the United
    > Nations, a list of all states/provinces in those nations, a list of
    > all counties in those states, etc...."
    >
    > OK...so far the definition looks nice.
    >
    > However, we are talking about coarse-grained objects and fine-grained
    > objects in HttpSession context ?
    >
    > SO, Can we map this way that fine-grained objects holds more detailed
    > information properties of the object ? and coarse-grained objects are
    > less informative ?
    >
    > In other words if I write two classes as below
    >
    > class USA1{
    > private String[] states
    >
    > }
    >
    >
    > class USA2{
    > private String[] states
    > private String[] city
    > private String[] mayor
    >
    > }
    >
    >
    > Is not objects of class USA2 are finer grained objects now ? I say so
    > because they are holding much detailed information than objects of
    > class USA1) ?
    >
    > So, In my understanding objects of class USA2 are finer grained
    > objects relative to objects of class USA1.
    >
    > Correct me if my understanding is wrong.


    Eric and Arved already answered that question.

    --
    Lew
     
    Lew, Sep 7, 2010
    #8
  9. gk

    gk Guest

    On Sep 7, 5:16 pm, "John B. Matthews" <> wrote:
    > In article
    > <>,
    >
    >  gk <> wrote:
    > > Could you please provide EXAMPLE which could illustrate the things
    > > better way. I'm talking about coarse-grained *object* and fine-grain
    > > *object* in HttpSession context.

    >
    > This article discusses granularity as it relates to the performance of
    > HTTPSession state persistence:
    >
    > <http://www.theserverside.com/news/1364410/Under-the-Hood-of-J2EE-Clus...>


    Thanks. I have gone through that link . I did a quite R&D on this
    stuff once upon a time in fact...Weblogic clustering and session
    replication and load balancer.

    But I could not get you . Which section is discussing about coars-
    grained and fine-grained objects ? Is there any specific section you
    are talking about ? could you please paste that relevant part if I'm
    missing. I'd like to re-visit that part once again if I'm missed.

    Thanks for your time.
     
    gk, Sep 7, 2010
    #9
  10. In article
    <>,
    gk <> wrote:

    > On Sep 7, 5:16 pm, "John B. Matthews" <> wrote:
    > > In article
    > > <>,
    > >
    > >  gk <> wrote:
    > > > Could you please provide EXAMPLE which could illustrate the
    > > > things better way. I'm talking about coarse-grained *object* and
    > > > fine-grain *object* in HttpSession context.

    > >
    > > This article discusses granularity as it relates to the performance
    > > of HTTPSession state persistence:
    > >

    <http://www.theserverside.com/news/1364410/Under-the-Hood-of-J2EE-Clustering>
    [...]
    > But I could not get you. Which section is discussing about coars-
    > grained and fine-grained objects ? Is there any specific section you
    > are talking about? could you please paste that relevant part if I'm
    > missing. I'd like to re-visit that part once again if I'm missed.


    Searching the page cited for the keyword "granularity", this
    observation seemed relevant: "Some J2EE vendors ... provide [a]
    fine-granularity distributed-object sharing mechanism to improve
    cluster performance." The section entitled "Backup granularity"
    elaborates further.

    For the connection among the terms granular, granularity, fine- and
    coarse-grained, see

    <http://en.wiktionary.org/wiki/granular>

    --
    John B. Matthews
    trashgod at gmail dot com
    <http://sites.google.com/site/drjohnbmatthews>
     
    John B. Matthews, Sep 7, 2010
    #10
  11. gk

    gk Guest

    On Sep 7, 7:22 pm, "John B. Matthews" <> wrote:
    > In article
    > <>,
    >
    >  gk <> wrote:
    > > On Sep 7, 5:16 pm, "John B. Matthews" <> wrote:
    > > > In article
    > > > <>,

    >
    > > >  gk <> wrote:
    > > > > Could you please provide EXAMPLE which could illustrate the
    > > > > things better way. I'm talking about coarse-grained *object* and
    > > > > fine-grain *object* in HttpSession context.

    >
    > > > This article discusses granularity as it relates to the performance
    > > > of HTTPSession state persistence:

    >
    > <http://www.theserverside.com/news/1364410/Under-the-Hood-of-J2EE-Clus...>
    > [...]
    >
    > > But I could not get you. Which section is discussing about coars-
    > > grained and fine-grained objects ? Is there any specific section you
    > > are talking about? could you please paste that relevant part if I'm
    > > missing. I'd like to re-visit that part once again if I'm missed.

    >
    > Searching the page cited for the keyword "granularity", this
    > observation seemed relevant: "Some J2EE vendors ... provide [a]
    > fine-granularity distributed-object sharing mechanism to improve
    > cluster performance." The section entitled "Backup granularity"
    > elaborates further.
    >
    > For the connection among the terms granular, granularity, fine- and
    > coarse-grained, see
    >
    > <http://en.wiktionary.org/wiki/granular>



    I did some R&D and have found my answer . Posting here if someone find
    this useful later....this is very simple .

    coarse-grained business objects, such as those that provide complex
    behavior beyond simply getting and setting field values. These coarse-
    grained objects typically have *dependent objects*. A *dependent
    object* is an object that has no real domain meaning when not
    associated with its coarse-grained parent.

    coarse-grained methods are those that provide significant behavior
    whereas fine-grained methods are typically low-level getters and
    setters.

    Example:
    ---------
    an Order entity could take an OrderItem value object in an
    addOrderItem method. That would be coarse-grained.


    This is very nice. I was looking for this....we could close the
    discussion now.
    Thanks for the all the time.
     
    gk, Sep 7, 2010
    #11
  12. gk

    Lew Guest

    Lew wrote:
    >>>> Eric and Arved already answered that question.

    >


    gk wrote:
    >>> Did you read what I posted ? That is not the answer to what I posted .

    >


    Lew:
    >> Yes, I did, O Snarky One.  Did you read what they posted?

    >


    gk:
    > Yes. I read and posted the summary  after reading from there also.
    > However,that was not exactly what I wanted to know. Please see my
    > latest post , I found my answer and just posted the answer. You will
    > get a feel what I was asking.
    >


    Your summary substantially restates what they told you.

    --
    Lew
     
    Lew, Sep 7, 2010
    #12
  13. gk

    Tom Anderson Guest

    On Tue, 7 Sep 2010, Lew wrote:

    > Lew wrote:
    >>>>> Eric and Arved already answered that question.

    >
    > gk wrote:
    >>>> Did you read what I posted ? That is not the answer to what I posted .

    >
    > Lew:
    >>> Yes, I did, O Snarky One.  Did you read what they posted?

    >
    > gk:
    >> Yes. I read and posted the summary  after reading from there also.
    >> However,that was not exactly what I wanted to know. Please see my
    >> latest post , I found my answer and just posted the answer. You will
    >> get a feel what I was asking.

    >
    > Your summary substantially restates what they told you.


    That's what a summary is, isn't it?

    I have to say, i've been following this thread, and i've realised i don't
    have a very good grasp of what coarseness of grain means when applied to
    objects. I can tell you what it means for locks - row vs table vs database
    locks, for example, or device vs subsystem vs kernel - or access control,
    but not really for objects.

    I have a gut feeling for how it applies to distributed object systems,
    which roughly boils down to whether you end up making lots of little
    calls, or a few big ones. For example, a mortgage application processor
    that looked like:

    interface MortgageApplication {
    void setProperty(Property house);
    void addApplication(Applicant app);
    void apply();
    boolean hasBeenProcessed();
    boolean accepted();
    }

    interface Property {
    void setPostcode(Postcode pc);
    void setValuation(int valuation);
    }

    // etc

    Would be fine-grained. Whereas one which looked like:

    interface MortgageApplicationProcessor {
    boolean apply(Property house, List<Application> apps);
    }

    class Property implements Serializable [
    }

    // etc

    Would be coarse-grained. But really, that's more about a sliding scale
    between classical early-90s distributed-object style and a good old
    fashioned RPC. I don't think the *objects* involved in either mode are
    more fine-grained; after all, i have exactly the same set of types!

    The problem with objects is that big ones are made of smaller ones. How
    can you have anything other than fine-grained objects?

    Perhaps coarseness of grain isn't about what the objects are, but what you
    *do* with them - whether you lock one at a time, or hundreds; whether you
    allow access to one at a time, or hundreds; whether you send one at a time
    over the network, or hundreds. Maybe the objects are the ruler with which
    you measure the grain.

    tom

    --
    As far as I can tell it's a mixture of stream-of-consciousness writing,
    random mathematical formulae, and half-crazed references to sex.
     
    Tom Anderson, Sep 7, 2010
    #13
  14. gk

    markspace Guest

    On 9/7/2010 3:58 PM, Tom Anderson wrote:

    > Perhaps coarseness of grain isn't about what the objects are, but what
    > you *do* with them - whether you lock one at a time, or hundreds;
    > whether you allow access to one at a time, or hundreds; whether you send
    > one at a time over the network, or hundreds. Maybe the objects are the
    > ruler with which you measure the grain.



    My understanding (and I could be wrong about this) is the grain is about
    designs and interfaces, not objects per se. Of course, objects
    implement the design, so you do have objects eventually, but it's more
    about the intent and the way objects are used.

    Here's a coarse grained interface for an HTTP Request:

    public interface HttpRequest {
    OutputStream handleRequest( Request r )
    throws HttpException;
    }

    That's it. There's really only one way to use this API. It does
    everything you want, is almost impossible to configure incorrectly
    (there's no configuration!) and high level code way up in the design
    hierarchy will have no problem using this because there's only one way
    to use it. No matter what happens, it's very unlikely that changes to
    the implementation will affect the way that high level code uses this
    interface because it is so simple. This is an advantage for interfaces
    that are designed to be extended and then used by library code or
    frameworks or applications like JEE containers, since it's easy to
    predict what the user is going to do and handle all possibilities correctly.

    Now fine grained APIs would be more like Swing, where you have a
    configure this and a configure that for every conceivable option. And
    sometimes Swing does interact weirdly with its sub-components because,
    well, there's a lot of ways those components can be used and it's not
    always clear how they do interact.

    These ideas ignore the concept of network latency, which got brought up
    earlier. Clearly, trying to run Swing objects remotely is likely to
    involve far too much overhead, whereas HTTP is ubiquitous and works well
    for many situations.

    Just my two nickels.
     
    markspace, Sep 8, 2010
    #14
  15. gk

    Tom Anderson Guest

    On Tue, 7 Sep 2010, markspace wrote:

    > On 9/7/2010 3:58 PM, Tom Anderson wrote:
    >
    >> Perhaps coarseness of grain isn't about what the objects are, but what
    >> you *do* with them - whether you lock one at a time, or hundreds;
    >> whether you allow access to one at a time, or hundreds; whether you
    >> send one at a time over the network, or hundreds. Maybe the objects are
    >> the ruler with which you measure the grain.

    >
    > My understanding (and I could be wrong about this) is the grain is about
    > designs and interfaces, not objects per se. Of course, objects
    > implement the design, so you do have objects eventually, but it's more
    > about the intent and the way objects are used.


    Aha.

    > Here's a coarse grained interface for an HTTP Request:
    >
    > public interface HttpRequest {
    > OutputStream handleRequest( Request r )
    > throws HttpException;
    > }
    >
    > That's it.


    Instinctively, i agree. And i think i can fit this into my theory: there
    may be small objects in the request, but the operation we're looking at
    here deals with them en bloc, taking a large aggregate of objects, the
    Request, and producing a large output, in the form of a load of bytes.

    > There's really only one way to use this API. It does everything you
    > want, is almost impossible to configure incorrectly (there's no
    > configuration!) and high level code way up in the design hierarchy will
    > have no problem using this because there's only one way to use it. No
    > matter what happens, it's very unlikely that changes to the
    > implementation will affect the way that high level code uses this
    > interface because it is so simple. This is an advantage for interfaces
    > that are designed to be extended and then used by library code or
    > frameworks or applications like JEE containers, since it's easy to
    > predict what the user is going to do and handle all possibilities
    > correctly.
    >
    > Now fine grained APIs would be more like Swing, where you have a configure
    > this and a configure that for every conceivable option. And sometimes Swing
    > does interact weirdly with its sub-components because, well, there's a lot of
    > ways those components can be used and it's not always clear how they do
    > interact.


    That's very interesting. That's a whole angle i hadn't thought about.
    Coarse grain as a kind of simplicity, which gives robustness.

    tom

    --
    If you're going to print crazy, ridiculous things, you might as well
    make them extra crazy. -- Mark Rein
     
    Tom Anderson, Sep 9, 2010
    #15
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dw

    Fine-grained access control

    dw, May 19, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    469
  2. Guest
    Replies:
    4
    Views:
    574
    Brock Allen
    Aug 3, 2005
  3. Eric S. Johansson

    fine grain logging cotrol

    Eric S. Johansson, Mar 22, 2007, in forum: Python
    Replies:
    15
    Views:
    526
    Eric S. Johansson
    Mar 24, 2007
  4. Douglas Livingstone

    Rails and fine-grained treats

    Douglas Livingstone, May 7, 2005, in forum: Ruby
    Replies:
    0
    Views:
    112
    Douglas Livingstone
    May 7, 2005
  5. Replies:
    3
    Views:
    167
Loading...

Share This Page