• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UML and Constructors

 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was just wondering... do we have to put Constructors as part of Class Diagrams? if so, where? are they considered Operations?
 
Deepak Arora
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepak,
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic