I use StarUML to drawl my UML diagrams on PC. Free download. Easy to install.
Showing posts with label Class diagram. Show all posts
Showing posts with label Class diagram. Show all posts
Tuesday, May 29, 2012
Sunday, May 27, 2012
What is a Sequence Diagram?
A sequence diagram is a UML (Unified Modelling Language) diagram. It is used to show the interactions between objects in the sequence they occur.
Here is a class diagram of the objects in the system...
Where a class diagram shows the details of each class & the relationships between them; a sequence diagram shows the sequential interactions between these objects.
Lifelines
Each object has a lifeline. This is a dashed line. The solid areas denote when an object is active in a process.
"UML basics: The sequence diagram" ( http://ibm.co/Lk8yqN )
err....here's a cat:
Here is a class diagram of the objects in the system...
The sequence diagram below, models the interactions required to get the 'Message' from the SpecialPower object.
Where a class diagram shows the details of each class & the relationships between them; a sequence diagram shows the sequential interactions between these objects.
Lifelines
Each object has a lifeline. This is a dashed line. The solid areas denote when an object is active in a process.
Numbering
Notice that each interaction in the sequence diagram is numbered according to the sequential flow of execution.
Void
In design documentation, where no value is returned from an interaction, the word 'void' is often used. A 'void' return is often seen as the result of instantiating an object. This is because a constructor cannot return a value. As well as that, you could expect to see 'void' as the return from a sub procedure.
"UML basics: The sequence diagram" ( http://ibm.co/Lk8yqN )
err....here's a cat:
What is a Constant? Final keyword
DOWNLOAD THE CODE: FinalValuePkg
We can store a value in a constant. Very similar to a variable except that a constant has a constant value. That is, the stored value is never changed as a result of processing.
Constants are used where a value should never be changed such as a maximum, minimum, number of hours in a day, days in a week, etc.
A constant begins with the keyword final. Just as with a variable, a type & identifier must be given.
CIRCLE_WIDTH and CIRCLE_HEIGHT are defined using uppercase and have each been assigned a value.
"Java Syntax: Declaring and Using Constants in Java" ( http://bit.ly/JmgF5S )
Here's a cat:
We can store a value in a constant. Very similar to a variable except that a constant has a constant value. That is, the stored value is never changed as a result of processing.
Constants are used where a value should never be changed such as a maximum, minimum, number of hours in a day, days in a week, etc.
A constant begins with the keyword final. Just as with a variable, a type & identifier must be given.
The compiler will not allow any processing statements to change the values of these constants.
UML Class Diagram Notation
The UML Class Diagram notation for a constant (final) is as below:
CIRCLE_WIDTH and CIRCLE_HEIGHT are defined using uppercase and have each been assigned a value.
"Java Syntax: Declaring and Using Constants in Java" ( http://bit.ly/JmgF5S )
Here's a cat:
Monday, May 21, 2012
Unified Modelling Language - UML
"Unified Modeling Language - Wikipedia, the free encyclopedia" ( http://bit.ly/Lk7zXy )
"UML basics: The class diagram" ( http://ibm.co/Jwpxv3 )
"UML basics: The sequence diagram" ( http://ibm.co/Lk8yqN )
"Activity diagram - Wikipedia, the free encyclopedia" ( http://bit.ly/Jwq4Nu )
Friday, May 18, 2012
The 'static' keyword
Download the code
Static variables & methods are associated with the class rather than an instance of an object of that class.
Usually, the data contained within an object, belongs only to that instance.
If you want all instances of a class to share some data, use a static variable. A static variable belongs to the class, rather than an instance the class (object).
The example below uses a static variable to keep count of the number of Widget objects that have been created.
The Widget class contains a single static variable called _numberOfWidgets. No matter how many instances of Widget are created, there will be a single value associated with the _numberOfWidgets variable.
A static method is provided to set the value of _numberOfWidgets and a static method is provided to get the value of _numberOfWidgets. In this example, the constructor calls the set method and in turn, the set method increments the value.
In the TestWidgetClass below, a number of Widget instances are created. Note that the call to the get_numberOfWidgets method is made by referencing the class directly, rather than by instance of the class.
And the output is:
"Understanding Instance and Class Members (The Java™ Tutorials > Learning the Java Language > Classes and Objects)" ( http://bit.ly/KmbYd7 )
In a UML class diagram, Static variables & methods are represented with an underline.
Here's a cat to keep you calm:
Labels:
cat,
Class diagram,
Method,
Reserved keywords,
Static,
UML,
Variables
Monday, March 19, 2012
What is a Class? What is an object?
A class is a definition of all state/attributes & behavior belonging to an entity. The following figure is a UML class diagram for an entity called Player. The middle compartment lists each state/attribute of Player and the bottom compartment lists each behaviour of Player.
UML class diagrams are used to design classes. This design is then used to inform the code. It's like a blueprint for building a house.
Objects are created from classes - many objects may be created from a single class - in the same way as one blueprint can build many houses. The following figure is a UML object diagram showing the Player class along with 3 Player objects.
Notice that while each object has a strength and agility attribute, the values for these attributes are unique from object to object. From this diagram, we can see the state of each object.
The behaviours are not listed in the object diagram because all objects share the same behaviours.
"What Is a Class? (The Java™ Tutorials > Learning the Java Language > Object-Oriented Programming Concepts)" ( http://bit.ly/FUAjmF )
UML class diagrams are used to design classes. This design is then used to inform the code. It's like a blueprint for building a house.
Objects are created from classes - many objects may be created from a single class - in the same way as one blueprint can build many houses. The following figure is a UML object diagram showing the Player class along with 3 Player objects.
Notice that while each object has a strength and agility attribute, the values for these attributes are unique from object to object. From this diagram, we can see the state of each object.
The behaviours are not listed in the object diagram because all objects share the same behaviours.
"What Is a Class? (The Java™ Tutorials > Learning the Java Language > Object-Oriented Programming Concepts)" ( http://bit.ly/FUAjmF )
Subscribe to:
Posts (Atom)













