1

I am currently learning for the OCUP UML Fundamental exam. While reading the book i found something strange about operations.

The semantics of an operation:

[visibility] name (parameter list)[:type][{property strings}]

now there are the following examples:

- getPoistion(return x: int, return y: int)
- enlarge(byFactor: Real) : GeomFigure
- +addPhone(phone:String)
- deposit(in amount, Amount): Amount
- #release(): contractStatus
- "create"create()  

The last one i think is odd. Can someone explain me why this is allowed? Since the only semantics that is allowed before the name is a visibility modifier.

Kind regards,

Wim

2 Answers2

-1

Where exactly have you found this example? It really looks like incorrect and definitely does not comply to the formal expression stated above.

These are the examples frm the last version of UML spec and all are perfectly fine:

  9.6.5 Examples Normal Operations: 
    display ()
    -hide ()
    +createWindow (location: Coordinates, container: Container [0..1]): Window
    +toString (): String 
    A template Operation: f <T:Class>(x : T)  
    A binding of that template Operation. f << T -> Window >>(x : Window) 
    NOTE. Parameters may be suppressed; .

If you have taken the example from an informal source, it is clearly an error. I would forget about it. :)

Aleks
  • 5,674
  • 1
  • 28
  • 54
  • Thank you for your reply, I found the example in the UML 2 Certification Guide. It is the book of OCUP. It is on page 41. - "create"create() – user1126171 Jun 05 '14 at 12:18
  • @Aleks not an error, I found the book online by Google for "enlarge(byFactor: Real) : GeomFigure". See my answer for more. Voting -1 as your answer is only opinion based and misleading – xmojmr Jun 07 '14 at 04:38
  • @user1126171, I'm sure it's an error in this book, as that't not the formal source. It's clearly not aligned with the formal expression from the same source (which fits the one from UML spec). – Aleks Jun 07 '14 at 08:16
  • @xmojmr, "opinion bsed and misleading"? What are you talking about? I found the topic in the most competent source on UML, the ONLY conpetent and formal source, its specification. Your examples simply have nothing to do with that was asked. It's about the wrong syntax and not about the meaning of the create-message! Please read both the question and my answer very carefully. – Aleks Jun 07 '14 at 08:19
  • @user1126171, another idea - maybe they actually wanted to use the stereotype to indicate the creational method, and for some reason replaced << with ". It should read - <> create() in that case. This is perfectly valid. – Aleks Jun 07 '14 at 11:34
  • @Aleks your answer "Where exactly have you found this example? It really looks like incorrect.. it is clearly an error. I would forget about it" is only opinion based. You did not read the original book and did not help the PO to understand its meaning. Please read the chapter in the original book - not only few words that PO picked out. Your answer is completely uninformed and only opinion based. PO did not ask about what OTHER books say. PO ask what the book (s)he reads for the OCUP UML Fundamental exam says. You did not answer it at all – xmojmr Jun 07 '14 at 17:33
  • @Aleks you can find the corresponding chapter of your "Where exactly have you found this.." at the beginning of my answer (or by using Google, PO provided enough information for you to answer your own question using the medicine SO recommends so frequently) – xmojmr Jun 07 '14 at 17:38
  • @xmojmr, simply said, I do not agree. I firmly stand behind my conclusion that the line form OCUP book is wrong and I backed that up with the corresponding extract from the UML OFFICIAL SPECIFICATION. If that's "opinion based" for you, I would not discuss it any more, but let user1126171 to make his/her own decision. He was wondering about this line, he could not understand it - I demistified the whole thing very clear, using even the more relevant source from the OCUP itself. I do not even see the space for discussion, it's a simple printing error, obvious even without UML spec. – Aleks Jun 07 '14 at 17:45
  • @Aleks **1** your modified "<> create()" also does not match the pattern PO quotes. **2** You did not read the relevant chapter from the book "UML 2 Certification Guide Fundamentals & Intermediate Exams, Tim Weilkiens, Bernd Oestereich", you simply judge the book by its cover. Are you sufficiently professional UML expert to admit it? **3** I don't see how your answer "blah, the book they told you to read is worthless" is helpful to the PO. BTW Ivar Jacobson wrote the book's foreword. What book did You write? (just rhetorical question) – xmojmr Jun 07 '14 at 18:01
  • @xmojmr, I never said the book is worthless, only that the line is wrong. The fact that I. Jacobson wrote a foreword does not garantee that the book is free of errors. I read that book myself and passed this exam 7 years ago. Again, let's leave the man read the answers and decide. This discussion is not helping him. – Aleks Jun 07 '14 at 18:08
-1

The chapter 2.2.11 OPERATIONS, page 49, in the book http://issuu.com/maurosergio/docs/uml_2_certification_guide_-_fundamental_and_interm that you are quoting also says

..Notation and Semantics..The syntax for operations..the notation should look like this..

The notation does not define/restrict semantic meaning of operations. It specifies general useful syntax.

The "create" message has in UML special behavioral meaning (don't know where is it explained in the book you are reading). For example look here http://www.uml-diagrams.org/sequence-diagrams.html, see <<create>> stereotype in the diagram and create message later in the text.

Also see "Object Creation Message" chapter here http://www.uml-diagrams.org/uml-object-oriented-concepts.html#message

Kirill Fakhroutdinov's online book www.uml-diagrams.org is very good UML reference compiled by the author from official sources (UML specs) and also from other background non-UML sources and from some "common sense".

Browsing through this book might be easier way to prepare for the exam, or at least consider it as alternative reading. Many "visual" examples included


and welcome to Stack Overflow and also read https://stackoverflow.com/help/someone-answers

Community
  • 1
  • 1
xmojmr
  • 8,073
  • 5
  • 31
  • 54
  • This does not answer the Q at all. The original problem is in the confusing syntax of the method representaiton and not on the meaning on the create message in UML (-1). – Aleks Jun 07 '14 at 08:20
  • @Aleks the original problem is that PO incorrectly interpreted what is written in the original book and omitted important aspect. PO's question "Since the only semantics that is allowed before the name is a visibility modifier" is wrong as the sentence quoted from the book does not claim that at all. PO picked up strange part out of the context. Please read the original chapter in the book.. – xmojmr Jun 07 '14 at 17:29
  • the question was clear. It's not about the INTERPRETATION, but understanding a simple CITATION from a book. Even if the citation was posted incorrectly, it does not change anything, my answer stands still (the line is wrong). Your answer, on the other side, does not directly tackle the problem, but rather spin around it, giving some explanations totally out of focus. You even use examples from informal sources and call my answer, backed up with the only reliable source - "opinion based". – Aleks Jun 07 '14 at 17:51
  • @Aleks I admit I did not read the full book, I did not pass the OCUP UML exam. IMO the ```"create"create()``` is valid example of very important kind of UML operation that should not be forgotten. It's syntax (the way it is written down in the text form) is secondary, not so important. It's semantics (what it means) is primary, and explained as sending a creation message. IMO the notation syntax given in the book is only a tool not a target (this is how I read the book), IMO the XMI (binary UML interchange format - what really matters) does not rely on the operation text form (IMO) – xmojmr Jun 07 '14 at 18:49
  • Of course it's important, I've never said anything different. But the question is not about the method, but about the syntax. Read it again, you will see that user1126171 was wondering purely about the syntax, being confused by the unclear line. He never asked what a crational method does. – Aleks Jun 07 '14 at 19:08
  • @Aleks if YOU READ the question "..The **semantics** of an operation: [visibility]...Since **the only semantics** that is allowed before the name is a visibility modifier.." it claims something about semantics and is puzzled with syntax. The original semantic restriction that PO claims IS NOT present in the quoted book. So IMO the PO is puzzled primarily by the difference between semantics and syntax of the ```"create"create()```. So the question IS NOT about syntax. The question is about "..While reading the book i found something strange about operations.." – xmojmr Jun 07 '14 at 19:28
  • @Aleks this is how I read the end-user's requirement. What the customer really needs to get solved. How do YOU read what is the original problem that needs to be solved? BTW the original problem is that PO wants to pass the OCUP UML exam and needs to clearly understand things – xmojmr Jun 07 '14 at 19:31