• 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
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Modelling Inner classes (static/non-static)

 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Can we model Inner classes in UML?If yes, how and why you would do it?
I usually use non-static inner classes to avoid Threading issues.It also helps to group variables together and instantiating at the one go.Never attempted to use static Inner classes, though, except for some fun
However,I am curious to know how to model these inner classes in UML.For instance, can we take care of threading issues while modelling.It would be great, if it is possible.
It would be helpful, if someone in the group could indicate an online resource/example on the subject.

Regards,
Sandeep Desai
[email protected]

  1. Sun Certified Java Programmer Scored 93 per cent
  2. Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java Scored 56 out of 59
  3. IBM Enterprise Connectivity with J2EE Scored 72 per cent
  4. Enterprise Development on the Oracle Internet Platform Scored 44 out of 56

  5. [This message has been edited by Desai Sandeep (edited April 23, 2001).]
 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refresh!!
Any patterns for static/non-static inner classes.
-- Sandeep
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How? ---> UML puritans may scowl at us but if the idea is to communicate then probably a class rectangle can simply be nested inside (inner) another class rectangle (outer)... I might be stretching UML here a little bit! The class may also have a streotype "<<static>>".
Why? ---> For one, in Java, inner classes lend themselves easily to the Observer pattern. The inner class may implement the listener interface and so on...
Please let us know if you find a good resource.

Originally posted by Desai Sandeep:
Hi,
Can we model Inner classes in UML?If yes, how and why you would do it?
[This message has been edited by Desai Sandeep (edited April 23, 2001).]


 
Desai Sandeep
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I am correct, Observer Pattern is meant for sending indirect (asynchronous) messages.The Event Listener Model is based on this pattern.
However, I am not sure if the same could be applied for modelling inner classes (static or non-static).Are there any specific patterns for this?
Thanks in advance,
Sandeep
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
In order to represent an inner class in UML you will need a composite object.
See http://www.rational.com/media/uml/resources/media/ad970805_UML11_Notation2.pdf
for more more information.
I hope this helps,
Paul
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Lambkin:
In order to represent an inner class in UML you will need a composite object.


That would be one possibility (though it would rather be a composite *class*, wouldn't it?). See also http://www.informatik.fh-luebeck.de/~st/UML/UML1.1/notation5.html#figure19
The other would be to recognize that an inner class is just like a toplevel class with a many to one association to the outer class:
<pre>
Outer ----- Outer$Inner
1
</pre>
If you use that relationship very often, it might be reasonable to create a custom stereotype.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Desai Sandeep:
If I am correct, Observer Pattern is meant for sending indirect (asynchronous) messages.The Event Listener Model is based on this pattern.


No, the canonical Observer pattern works totally synchronously.
The purpose of the Observer pattern is to inverse the depency between client and server when you have an unknown number of servers:
Typically, a client depends on the servers it sends a message to:
<pre>
Client- - - ->Server
*
</pre>
When using the Observer pattern, the client no longer directly depends on the server, but the server depends on the client and an interface declared by the client:
<pre>
Client----> /ClientObserver/
^ * A
| |
|
+ - - - - - - Server
registers at
<
</pre>
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Desai Sandeep:
I usually use non-static inner classes to avoid Threading issues.


How does that work?
 
Don't listen to Steve. Just read this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic