Book a Demo

Author Topic: How create object (in class diagram) as singlton?  (Read 5220 times)

Yanshof

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
How create object (in class diagram) as singlton?
« on: June 15, 2008, 03:20:08 am »
I create some uml design using diagram class.
I don't know what to do ( or how to do it ) to show that some of my classes is singleton.

I mean that i don't know how to show in in Sparx Systems application.
When i used other uml application i knew how to show it with no problem.

Someone can help me ?  :-[

thanks.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How create object (in class diagram) as singlt
« Reply #1 on: June 16, 2008, 08:45:33 am »
I don't know if EA will do this for all cases.

If you use patterns you might be able to get close. Look up Initial Code in the EA index.

Not quite, but perhaps it will help.

I don't remember if this has been asked for in a feature request. I've not seen anything similar for some time. Why not make such a request yourself? You can use the Feature Request link near the bottom of any forum page. Paste in the URL of this thread so the Sparxians can participate in any discussion. Perhaps they'll offer some ideas.

Also, if you hear back from them directly please post back to this thread and share it with us.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How create object (in class diagram) as singlt
« Reply #2 on: June 16, 2008, 08:45:54 am »
Depends on what you want to see.

I know there is a singleton pattern available as part of the GoF pattern set available for Java, C# and language free at http://www.sparxsystems.com/resources/developers/uml_patterns.html.

Other than that, you could just stereotype it.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: How create object (in class diagram) as singlt
« Reply #3 on: June 16, 2008, 09:43:29 am »
The UML specification has nothing to say on the subject of singletons. I think every programming language has a number of different ways of implementing singleton classes - so if you want implementation detail in your model in order to forward engineer to source code (i.e. you are creating a PSM), the answer depends on your language and your chosen implementation method - reverse engineer a singleton to see the UML notation. If you don't want such details in your model (i.e. you are creating a PIM), then I'd go with Simon's suggestion of a «singleton» stereotype. But remember: singletons are evil.
« Last Edit: June 16, 2008, 04:40:30 pm by KP »
The Sparx Team
[email protected]