INM205 Object Oriented Programming in JAVA Dr. Michael Casey Department of Computing.
-
Upload
dwight-austin -
Category
Documents
-
view
217 -
download
0
Transcript of INM205 Object Oriented Programming in JAVA Dr. Michael Casey Department of Computing.
INM205Object Oriented Programming in
JAVA
Dr. Michael Casey
Department of Computing
INM205 SyllabusWeek Date Content Chapters
1 29/09 JAVA and object concepts: classes, instances and invocation 1
2 06/10 Anatomy of objects: types, expressions and scope. Assignment 1
2-3
3 13/10 ? Polymorphism: Shapes and Simple Graphics 4
4 20/10 ? Control structures: conditional behaviour 5
5 27/10 Iteration: Assignment 2 6
6 03/11 READING WEEK, NO LECTURE 9,10,11,12
7 10/11 Interfaces, Inheritance 9,10,11,12
8 17/11 Collections, Exceptions and Streams 13,16
9 24/11 Graphical User Interface (The SWING Library) 13,15
10 01/12 Developing Applications 1
11 08/12 Developing Applications 2
12 15/12 Exam Prep.
What this module is about
• Object-oriented programming languages • what they are • why they are the way they are • how to use them
• Java used as language to illustrate ideas
• software design not the main topic: • see Object-Oriented Analysis & Design (term 2)
What is a Computer ?
• Central processing unit
• Memory
• Peripherals
• Executes very simple instructions
• Executes instructions very rapidly
• General purpose device
• Programs describe specific actions
Computer Architecture
Computer Architecture
What is a Program ?
CPU
Data Bus
Inst
ruct
ion
s21 40 16 100 ...
What is a Program ?
CPU
Data Bus
Inst
ruct
ion
s21 40 16 100 ...
Machine Code: specific to a machine (e.g. CPU)
What is a Program ?
21 40 16 100 ...iload intRatebipush 100if_icmpgt intError
Assembly Language: specific to a machine
What is a Program ?
21 40 16 100 ...iload intRatebipush 100if_icmpgt intError
Assembly Language: specific to a machine
if (intRate>100)...
What is a Program ?
High-level Language: General Purpose (Not machine specific)
if (intRate>100)...
iload intRatebipush 100if_icmpgt intError
The JAVA Programming Language
• Clean Object-Oriented implementation
• Safe (for beginners)
• Platform independent “write once, run anywhere”
• Virtual Machine
• Rich library
• Widely-Used for Internet / Business / Academic
Classes and Objects
• class – a set of objects that support a specified set of operations
(methods). Analogy: a type of machine, with buttons, levers, displays, etc.
• object – an instance of a class: some data, usually hidden from
the rest of the program, and manipulated by the specified methods. Analogy: a particular machine of that type.
Car Class
Class
Car Class
Instance
Car Class
InstanceFields
Car Class
Two Instances
Car Class
Two Instances
One Class
Car Class
JamesBond car object instanceJamesBond car instance fields
Student LabClass Class
Two Classes
•LabClass•Student
Dependency
Student LabClass Class
identifierstudent1
Student LabClass Class
instance fields
Student LabClass Class
Methods
Shape Classes
Four Classes
Shape Classes
One instance
Shape Classes
Instance Methods
Shape Classes
Methods
Output (Canvas)
BlueJ and JAVA
BlueJ and JAVA
UML Class Diagram
BlueJ and JAVA
Object Instances
BlueJ and JAVA
Source Code Editor
JAVA Programming Flow Chart
JAVA Programming Flow Chart
JAVA Programming Flow Chart
JAVA Programming Flow Chart
JAVA Programming Flow Chart
JAVA Programming Flow Chart
JAVA Programming Flow Chart
Summary• What is a Computer ?
• CPU, Memory, Storage, I/O
• What is a Program ?• machine code, assembly language, high level language
• Objects• model things in the world• classes vs. object instances• instance fields, methods
• The JAVA Programming Flowchart• editing, compiling, running (interpreter)