0% found this document useful (0 votes)
29 views

Object-Oriented Software Development - Tutorial 1

This document provides an introduction to object-oriented software development and Java programming. It discusses key concepts like objects, classes, inheritance, polymorphism, and the software development lifecycle. It also outlines exercises for students to install Java, create a tax calculation program, and submit their coursework. The goal is for students to learn Java and demonstrate understanding of OOP concepts by building a program to calculate pay after tax deductions.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Object-Oriented Software Development - Tutorial 1

This document provides an introduction to object-oriented software development and Java programming. It discusses key concepts like objects, classes, inheritance, polymorphism, and the software development lifecycle. It also outlines exercises for students to install Java, create a tax calculation program, and submit their coursework. The goal is for students to learn Java and demonstrate understanding of OOP concepts by building a program to calculate pay after tax deductions.
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

Object-Oriented Software

Development

Tutorial 1
Object oriented
• Software systems are set of interacting
parts, objects, that do the work of the
system by sending messages to each other.
• Early oo language: Simula and Smalltalk;
• Then, C++ and Java.
• The portability of Java;
• Applets run on any computer with a Java-
enabled web brower.
2
Software systems lifecycles
• Analysis and modelling;
• System design;
• Implementation;
• Testing and evaluation;
• Maintenance and enhancement.

3
Object
An object is a software component that has:
• Behaviour: an object can do work;
• State: an object can remember aspects of its
work;
• Individuality: an object can be distinguished
from other objects without having to look at
any part of its state – i.e. each object has an
identifier.
4
class
• An object is an instance of a class;
• There may be many objects all based on the
same class;
• Imagine starting Notepad a number of
times. Each time you start an instance of
Notepad is like creating an object of the
class Notepad. Each instance is difference
is different from another.

5
Execution of software
• Executes an object-oriented system creates
and destroys objects;
• Garbage collection – Java takes care of the
recycling of resources;
• Protocol – a set of messages agreed
between objects;
• Properties – a set of attributes

6
Inheritance
• The new, more specific class of objects can
inherit attributes and operations from its
(parent) superclass.

7
Polymorphism
• Polymorphism is a feature of object-oriented
systems that provides great flexibility and
consistency.
• If a programmer were writing a 2D drawing
program they might wish to use a library of
pre-written classes for shapes, each of which
provides a "getArea()" method. The
programmer can then happily send a
"getArea()" message to whichever graphic
object he or she is wanting to work with,
secure in the knowledge that whichever
object is chosen it will return a calculation of
the area of the shape. 8
Polymorphism
• In the following sample of a Java program,
both lines look very similar and both objects
are being sent the same message.
• areaOfShape1 = shape1.getArea();
• areaOfShape2 = shape2.getArea();
• However, the actual methods executed might
be different, if shape1 is based on a Circle
class and shape2 on a Square class.

9
Object technology concept
• Abstraction;
• Classes and objects;
• Encapsulation;
• Comments in Java code – beginning with //;
• State;
• Attributes – feature of an object;
• Operations – action an object of the class
performs.
10
Object technology concept cont.
• Controlling state change;
• Inheritance;
• Class inheritance;
• Overriding methods;
• Messages;
• Messages with arguments.

11
Tutorial problem 1
What features of the Java programming
language, and the way it is implemented,
make it easier to produce programs that are
portable?

12
Tutorial Problem 2
The decision to make the language portable
has led to compromises in other areas.
What are these compromises, and how
important are they for the software
developers?

13
Tutorial Problem 3
Describe briefly the software development
process.

14
Tutorial Problem 4
Explain why Java is believed to be an
appropriate language for writing web-based
software.

15
Workshop I
Install the following software:
• jdk 1.3;
• Java docs;
• snjrt20.exe – java runtime program;
• Textpad.

16
Set up path and classpath
• Modify autoexec.bat for Windows ME;

• For Win 2000 or Win XP,


• My computer Properties Advanced
Environment VariablesEdit Variable
name: path Add ;c:\jdk1.3\bin at the end
• Then, new Variable name: classpathc:\
jdk1.3\javacode
17
CMT4120 Vincent Wong 18
Course work
Objectives:
1. show the tax code;
2. Calculate (weekly, monthly or annually)
Pay after income tax deduction.
The Java program can be an applet or an
application.
Deadline: 16 August, 2002.

19
Tax code
Each individual will be given a tax code which will
indicate the amount of tax free earnings an
individual is entitled to per year;
The letter at the beginning of the tax code indicates
the status of the individual e.g. married, single.
e.g. L4535 = £4535 tax free pay (personal
allowance) per year for a single person.

20
Marking Scheme
• No marks if the program cannot run, for
whatever reason.
• A working program meeting the
specification requirements fully and
working correctly will be awarded a pass
mark, i.e. 40 marks.

21
Marking Scheme
Please state clearly any assumptions you
make.
Documentation (up to 15 marks);
Structure (up to 15 marks);
Display and user interface (up to 15 marks);
Comment on the Learning Experience (up to
15 marks).
22
What to submit and where
Place all you coursework files in a folder and submit
as ONE zipped file. This file should contain all
the classes your program defines, and all textual
documentation.
1. Hand in a paper printout of your program and a
floppy disk with the zipped file.
2. Send your zipped file by email to your tutor.
Ask for email acknowledgement of receiving the
zipped file.
23

You might also like