tags:

views:

1040

answers:

3

Except for the context of UML,if A extends B,then B is a subset of A.

But in UML, it's the opposite,say,if A extends B,then A is a subset of B,

why is it so strange?

+1  A: 

To write it in terms of use cases (I believe this is context you meant - if not, correct me), lest think about ordering a meal in your favorite fast food restaurant.

Basic use case is to order a meal, but it can be extended if you present a discount coupon. Every time you go trough this use cale, you get a meal, but only under special circumstances you pay less than usually (or get an extra sandwich).

I found quite a good example here: http://www.agilemodeling.com/essays/useCaseReuse.htm. As you can see enrolment for international student includes additional security check, and is applied only to a subset of enrollments. Hope that will help more.

maciejkow
oh,seems it's a misunderstanding in "extend". For another example,if theory B is based on theory A but covers more,we say theory B (verb) theory A.what's that verb here,seems not "extend",right?sorry English is not my mother language..
Shore
UML's definition of "extend" would mean, that if theory B extended theory A, it would describe some edge case, with additional conditions and conclusions, rather then being more general. However, I can see your point that this is a bit confusing.
maciejkow
@maciejkow,so you mean that verb should be "generalize".I want to know is this somewhat confusing for native English speakers?Or to be more specific,"generalize" and "extend"?Or these two words go in totally different directions?If A extends B,then A is subset of B.But if A generalize B,then B is subset of A,right?
Shore
I can't speak for native English speakers, as it's not my first language either. However, if theory B covers superset of cases covered by theory A, I'd say that B generalizes A.
maciejkow
oh,ic,thank you all the same!
Shore
-1: This is not the UML definition of `<<extend>>`
John Saunders
@John Saunders,why do you say it's not UML definition?then what is it?
Shore
No, I meant that what maciejkow answered was not the UML definition of `<<extend>>`.
John Saunders
I agree that square/rectangle example was inappropriate. If my example with use cases is wrong, could you please explain why?
maciejkow
Ok, I have reread his answer and removed my downvote. Still, @maciejkow, I recommend you remove the first paragraph. Oh, wait, you just did!
John Saunders
Your example was ok, if a little weak. I'd suggest "customer presents coupon" as a better example of an extension. It's a distinct behavior, associated with the primary use case, at a certain point in its flow, but only under some circumstances. "Make the meal large" is really just more of "make the meal".
John Saunders
@John Saunders,but maciejkow's example of square/rectangle helps me a lot to make things clear.
Shore
I've edited my anwser, thanks for better example.
maciejkow
@Shore : yes, it shows something, but square/rectangle would better present relationships between classes than between use cases. Didn't want to confuse anyone.
maciejkow
No. square/rectangle gave you the _wrong_ idea of `<<extend>>`. It has nothing to do with square / rectangle.
John Saunders
@John Saunders,I've concluded that in UML "extend" is similar to "be more specific".Is it also the case in daily life of native English speakers?
Shore
No, in English, "extend" means, "make go further". It does not have to do with specificity. One might say, "Times are hard. We need to make our pay extend further".
John Saunders
Thank you guys,but I'm not confused with difference between use cases and classes,so it's fine.
Shore
@John Saunders,thank you again for your explanation :)
Shore
@Shore: You're welcome.
John Saunders
BTW, definition of "extend": http://en.wiktionary.org/wiki/extend
John Saunders
@John Saunders,the original meaning makes sense,I've found it's the translation of "sense" into my native language that mislead me so far..
Shore
@Shore: great. You'll be able to start writing a dictionary from technical English into your language. Then include a link to it in your profile.
John Saunders
oh,bad news is,I know what it basically means now,but I don't have a fit name for that...
Shore
Check that dictionary link. "Extend" comes from the same root (Latin) word as the Latin word for "to stretch". It's ex + tendere, and tendere is "to stretch". So we can say that a person is "tense" when they're stretched. It's also the Latin word for putting up a tent (stretching the skins over the poles). With that, you may find a similar word or words in your language. After all, everybody stretches something, pulls something tight. The "ex" part usually means "out of" or "away from". Picture a line of people "stretching" away into the distance.
John Saunders
+2  A: 
John Saunders
But in UML "extend" is similar to "specializaton",right?
Shore
Yes, but those terms also different. You use extend in relation to use cases, and specialization in relation to classes.
maciejkow
oh,thank you again.Finally I want to know is "extend" similar to "specializaton",without the context of UML?
Shore
@Shore: re-read the entire post of John Saunders. No, in UML, the term "extend" is not used, except as a stereotype for use cases. In particular, in UML, "extend" has nothing to do with classes.
Martin v. Löwis
Isn't use case a part of UML?why do you say "extend" is not used in UML except for use cases?
Shore
@Shore: sure, use cases are part of UML. I still don't know whether you are referring to use cases, or to classes, or to something else in your question. Maybe the question is phrased in a confusing way.
Martin v. Löwis
He means the only part of UML where `<<extend>>` is used is with use cases diagrams. It is not related to generalization or specialization at all. I'll try to explain better.
John Saunders
I'm referring to the UML as a whole
Shore
Ok, but the only part of UML as a whole that uses the term `<<extend>>` is with Use Case diagrams. Can you say the context in which you saw `<extend>` dependencies? For instance, if you read about them in a book, can you post the paragraph you read it in?
John Saunders
Seems no need to post the paragraph,since all books refer to the term <<extend>> when introducing the concept of use cases in UML,right?
Shore
Use case and use case paradigm are both part of UML,so it doesn't matter if "extend" occurs in use cases or use case paradigms,right?
Shore
You seemed to be confused about extend vs. generalize. I was concerned you may have read a book that said that `<<extend>>` could be used in other places. To repeat, extend is not like generalize. Extend means, perform a behavior conditionally.
John Saunders
Not confused about extend vs. generalize,I just don't know the right word to 100% express myself,but in fact I've more or less figured out,thanks to you guys!
Shore
A: 

UML doesn't use the term "to extend/extension". Instead, it uses the term "to generalize/generalization"; people also often refer to it as "to inherit/inheritance".

If B is a generalization of A (i.e. A inherits from B), then A is a subset of B. This should become clear from the "is-a" relationship: if every A is a B, then A is clearly a subset of B. In your terminology, if A extends B, A is a subset of B.

A type is a predicate: for every object, you can determine whether it belongs to the predicate. Extending the predicate means to make it more restrictive.

Martin v. Löwis
Term extend is used in the context of use case diagrams.
maciejkow
As you said:Extending the predicate means to make it more restrictive.So "extend" is similar to "specialize",right?
Shore
I don't think this is meant by the OP. Why would use use the word "subset" when referring to use cases? See also http://stackoverflow.com/questions/1182967/a-logical-doubt-about-extend-and-generalize from the same author.
Martin v. Löwis
@Shore: People often use the term "extend" when they mean "specialize", correct - in particular in Java, where "extends" is the name of the keyword.
Martin v. Löwis
Oh,thank you.Seems I'm mislead by the translation.I'll delete the other post.
Shore
The OP explicitly used stereotype syntax (`<extend>`) so I assume he meant that he had seen that available as one kind of dependency. He thought it might be related to generalization (he's not a native English speaker).
John Saunders
@John Saunders,you mean in fact "extend" is not one kind of dependency in UML?If so ,why?I'm now basically thinking of "extend" as opposite of "generalize",is that right?
Shore
That is not right. Extend is a dependency, but it can only be used between two use cases. It cannot be used between two classes.
John Saunders
Not all dependencies (dependency stereotypes, formally) are valid between every two elements. For instance, there's the `<<deploy>>` dependency which is part of a Deployment diagram, and indicates where a particular artifact is deployed.
John Saunders
@Martin: -1, since the OP is talking about extend in use cases, and you're back to generalization.
John Saunders
@John: No, the OP is "referring to the UML as a whole". I don't think he is aware that <<extend>> is a stereotype that cannot be used with classes (in fact, in the title, he didn't use double brackets, so he may not be referring to the stereotype in the first place).
Martin v. Löwis
@Martin v. Löwis,what's OP short for,original post?
Shore
@Shore: "Original Poster". This is an abbreviation carried over from Usenet.
Martin v. Löwis
@Martin v. Löwis,got it:)
Shore