This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes UML and Constructors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "UML and Constructors" Watch "UML and Constructors" New topic

UML and Constructors

Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
i was just wondering... do we have to put Constructors as part of Class Diagrams? if so, where? are they considered Operations?

SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
Deepak Arora

Joined: Jul 10, 2001
Posts: 26
if you See Larman diagrams, you will note that he has used message create() to instantiate a new object in the interaction diagram , actually every language has its own way of creating a new object, (e.g java instantiate with new operator) & UML can not provide any language dependent notation of creating new object therefore there is no notion of constroctor in UML(correct me UML gurus if i am mistaken)
Paul Michael
Ranch Hand

Joined: Jul 02, 2001
Posts: 697
thanks for the input Deepak! it's all coming back now.. i guess you're right! i remember using create in place of Constructors before and yep we got it from a book by Craig Larman. thanks again Deepak!
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
That's correct!create() is a language-independent way to create a new instance of a class in UML.The message should be passed actually be passed to a class, but UML allows it to be passed to an instance.
The create() of UML gets translated to language-dependent syntax of OO language(for example, new operator in Java)
-- Sandeep
[This message has been edited by Desai Sandeep (edited July 11, 2001).]

<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
It is sorta covered in the JavaRanch Style Guide.
subject: UML and Constructors
Similar Threads
another question on constructors
Can constructor throw exception?
Constructors are not inhertied - True
OOP 4: Lookup
Why I can't call the parent class constructor?