UML diagrams are used so that programmers can quickly see the
the idea of the classes they will write before they write them out. These diagrams are also used as a
the communicating tool between programmers and other stakeholders such as sponsors of projects, the
clients who wish to buy softw...
CSI21M1 Java Programming Notes, prepared by Mr. S. Nyika, Semester I, 2019
Lecture 2: UML Diagrams and Writing Java Applications
Objectives:
At the end of this lecture, students will be able to:
• use Unified Modeling Language to design a class
• write a Java class
• write a Java application
• use Camel Casing when writing Class name, variable identifiers and methods
• use appropriate conventions such as correct indentations in code blocks
• understand the need to use conventions in coding
• how to save a Java file
Notes:
Class Programmers design classes using Unified Modeling Language diagrams and after that they
write the source code of the class using the knowledge they have about Java classes as seen in lecture 1.
Suppose the class programmers needed to design a Student class, they would proceed and use a class
diagram which is a UML diagram. UML diagrams are used so that programmers can quickly see the
idea of the classes they will write before they write them out. These diagrams are also used as a
communicating tool between programmers and other stackholders such as sponsors of projects, the
clients who wish buy a software and other programmers like the client programmers who will create
objects from the class they write. There are a total of seven basic UML diagrams. These are:
• Class diagram
• Object diagram
• Component diagram
• Use case diagram
• Interaction diagram
• Statechart diagram
• Activitiy diagram
Class Diagram
Class diagrams basically represent the Object Oriented view of the system which is static in nature. It is
generally used for development purposes.
Use case diagram
A use case diagram are a set of use cases, actors and their relationship. They represent the use case
view of the system.
Page 1 of 5
, CSI21M1 Java Programming Notes, prepared by Mr. S. Nyika, Semester I, 2019
The Student class example
The UML class diagram
This diagram was written using a program called Dia Diagrams under Linux Operating System.The –
sign here shows that the fields are private and the + sign shows that the methods are public. Private and
public are called access specifiers. After the class diagram has been drawn, the class programmers now
write the source code of the class in an IDE of choice such as NetBeans as shown below:
The Student Class Source Code:
Page 2 of 5
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying this summary from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller keanuperumal. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy this summary for R50,00. You're not tied to anything after your purchase.