Department of Computer
Science
COS 101 - Java
s
Term 3
Lecture 1
University of the Western Cape
Outline
Rules of engagement
• Software Development Life Cycle
• Your First Java Program
• Errors
• Java editors
• Python vs Java
•
Rules of engagement
Programs or application is a set of instructions to execute a task.
• Programs must be in the form that the computer understands –
machine language
• Programming languages are used to create programs.
• Programming languages have their own vocabulary, called syntax.
• Programs must be semantically correct.
• The person who writes a program is called the programmer.
• The person who interacts with the program is called the user.
•
Software Development Life Cycle (SDLC)
ISO/IEC/IEEE 12207:2017 also provides
processes that can be employed for
defining, controlling, and improving
software life cycle processes within an
organization or a project.
• https://www.iso.org/standard/63712.html
•
Planning and Requirement Analysis
Important and fundamental stage.
• Collect relevant information from the customer.
• Normaly done by senior software engineers, to avoid mistakes and
ambiguities.
• Analysis of product feasibility.
• Software Requirement Specification document deliverable.
• Reviewed by the customer.
• Handoff to the development team.
•
Designing the Product Architecture
•
SRS used by product architects.
•
Design Document Specification (DDS).
•
DDS is reviewed by all the important stakeholders.
•
Upon review of DDS, the best design approach is selected.
Building or Developing the Product
Product development stage.
• Code is developed from the DDS.
• Correct tools are chosen for development.
•
Testing the Product
•
Testing is involved in all the stages of SDLC
•
Subset of stages.
•
Report product defects, fix and retest. (Wash, Rinse, Repeat)
•
Minimum Viable Product (MVP) or
•
The quality standards defined in the SRS are met.
Deployment and Maintenance
Deployed in the production environment,
• User acceptance testing (UAT)
• After the deployment of a product, the product is maintained.
•
SDLC Models
Waterfall Model
• Iterative Model
• Spiral Model
• V-Model
• Big Bang Model
• Agile Model,
• RAD Model,
• Rapid Application Development and
• Prototyping Models.
•
Awe to the world of Java
1:/** A program to display the message
2: * “Awe World!" on standard output.
3:*/
4:public class aweWorld {
5: public static void main(String[] args) {
6:
System.out.println(“Awe World!");
7: }
8:} // end of class aweWorld
programName : aweWord.java
Homework:
1. Create your own Java program,
that will display your name and
surname.
2. Alter your program to display your
name and surname on a separate
line.
Basic Java Program Structure
optional-package-declaration
optional-imports
public class program-name {
optional-variable-declarations-and-subroutines
public static void main(String[] args) {
statements
}
optional-variable-declarations-and-subroutines
}
Errors, errors and more errors
Expect errors, if not…you have compiled
If (errors){
while(!noErrors){
fix errors;
fix errors;
}else{
noErrors <- FALSE;
success;
}
}
• Types of errors
•
Syntax error
– Runtime errors
– Logic errors
–
Syntax Errors Example
Runtime Error Example
Logic Error Example
Program name – firstFixProgram.java
import java.util.*;
public class firstErrorFixProgram
{
public void main(String args)
{
System.out.println("Hello out there.")
System.out("I will add two numbers for you.");
System.out.println("Enter two whole numbers on a line:");
int n1 = 30;
int n2 = 23.0
System.out.println("The sum of those two numbers is);
System.out.println(n1 + “n2”);
}
Java Editors
Python vs Java
An overview of Java
Java was originally created by Oracle in 1995, and is a high-level, class-based, objectoriented programming language. One of the main focuses when designing Java was to
have as few implementation dependencies as possible. It’s a general-purpose language,
used frequently for desktop computing, mobile computing, games, and numerical
computing.
An overview of Python
Created by Guido van Rossum in 1991, Python is an interpreted high-level generalpurpose programming language. It was designed with a philosophy of making code
easier to read than alternative languages, with the use of significant indentation. It is
commonly used for data analytics and machine learning but has a wide range of uses.
Summary
•
•
Programs or application is a set of instructions to execute a task.
Programs must be in the form that the computer understands –
machine language
•
Programming languages have their own vocabulary, called syntax.
•
Programs must be semantically correct.
Summary continued
Summary continued
optional-package-declaration
optional-imports
public class program-name {
optional-variable-declarations-and-subroutines
public static void main(String[] args) {
statements
}
optional-variable-declarations-and-subroutines
}
The End
University of the Western Cape