I have created a design using class diagram. However I was asked to give some explanation on the class diagram.
IMO, class diagram is fairly. For example, if a class is labeled as "Cat", am I going to explain, this "Cat" class represents "Cat"?
What is the best way to explain UML class diagram?
saying class Cat represents cats is one thing you can do, which is maybe not very exciting, though. More interesting to explain might be: associations, abstract classes, interfaces, inheritances, etc. is there any design pattern you are using? maybe explain them.
I hope this will help!
Suppose you have to explain this class diagram to your client in lieu your manager will. Just think how you will define all the responsibilities of each class present in that diagram. Give one-liner definition of its properties, methods, parent and child classes etc (go in bit more details when needed as well).
Define what would be the flow and how one class will link to another one.
For example:
Is your class 'cat' has any association with class Animal or interface IAnimal. You can think more of it and go better.
whatever the type of uml diagram, you should always add some explanantions in natural language.
at least explain some key aspects of the solution : this has a reference to this
this inherits from this class and do not need to override this operation.
Related
A question from java interview:
You have to design a system that will manage 3 ducks:
The first one knows how to swim and fly, the second knows to swim and to hunt, the third knows to swim, fly and hunt. Describe the UML class diagram and explain the terms abstract class and interface. End of question.
In my opinion, i would create a "Duck" class with a method swim() in it, and 2 more classes "flyingDuck" and "huntingDuck" will derive from "Duck", and will contain the methods fly() and hunt() respectivly. One more class will be "universalDuck" and it will derive from "huntingDuck" and will contain the method eat(). What do you think ? Is this a good design or it's better to do it with interfaces ?
Why do you want to model a "universalDuck" extending "huntingDuck" by the method eat()? Was this asked for in your Java interview question?
Since the question asked for explanations of the terms abstract class and interface, you are probably expected to use these concepts in your model. For having a duck3 as an instance of a class that inherits both fly() from "flyingDuck" and hunt() from "huntingDuck" you will need to use interfaces for "flyingDuck" and "huntingDuck" because in Java you can only have multiple inheritance from interfaces.
In a UML class diagram I want to show the relationship between two classes where the second class is the type of a class variable in the first.
I've looked here but am still unsure which relationship I should be using.
I think it may be the Dependency relationship but I am unsure.
Which should I be using?
It sounds like a composition(has a) but would need to hear more about your diagram.
I am trying to create a class diagram which shows generalisation and maybe some form of aggregation or composition from this use case diagram. The intended system is to be a site/application similar to facebook social networking.
USE CASE DIAGRAM:
CLASS DIAGRAM:
I am pretty sure something is wrong with the class diagram please could someone help me out, thanks.
There is no direct relation between a class diagram and a use case diagram. One is used to understand requirements and the other to model the system's static structure.
I find the best way to get to the class diagram stage is to produce a derived class diagram taking information (i use nouns and noun phrases) from the Use case specification. Because as #vainolo says there is no direct link between a Use case diagram and a class diagram.
can somebody please explains what is a high level class diagram. As far as I know class diagram shows the association between the classes but what about high level class diagram??
Ok, I knew what this means, a Class Diagram contains many details. A high-level class diagram is a simple class diagram reflecting only initial domain knowledge
What's the context? Class diagrams in themselves are pretty "high-level", in that they only show classes and methods rather than algorithms and other implementation details. It might just be an adjective. Or, you might be looking for something more like a block-level diagram which shows components of a system and how they interact.
I often use the term "high-level", or more usually, "top-level" diagram for the very highest level class diagram I make for a system. Usually this will show as many of the most important packages as will reasonably fit, along with some classes that give the best idea of what functionality the classes in that package provide. From there I can do class diagrams of each package, and so on.
Depending on the type of system and what your supervisor want to see, you may be better off creating a component diagram.
I'm drawing some UML in which a concrete class inherits from an abstract class which defines a pure virtual method. Is it required to show this method in the concrete class as well? It's implied by inheriting from the abstract class.
Nope, you don't need to. in fact, in general, don't put any more in the UML than you must have to clarify what you're saying, unless you're (god forbid) trying to generate code from it.
The best guide I know of for UML is UML Distilled by Martin Fowler.
The funny thing about UML is that it has a pretty loose and varied definition. Most things that are called UML are actually not much more that block diagrams. There is a lot of ambiguity in any UML implementation.
I would say that if you are doing this for a presentation or architectural diagram, you can take care of a lot of the possible ambiguity with 'words'. If you will be generating code from it using some application, you should check the docs of that particular application.
It's implied and in fact, many CASE tools would show you the inherited method as part of the list of the methods of the subclass when clicking on the class at looking at its properties (and some CASE tools even have the option of showing also the inherited methods in the diagram)