Introduction to Object Oriented Programming Java.

Slides:



Advertisements
Similar presentations
Understand and appreciate Object Oriented Programming (OOP) Objects are self-contained modules or subroutines that contain data as well as the functions.
Advertisements

General OO Concepts Objectives For Today: Discuss the benefits of OO Programming Inheritance and Aggregation Abstract Classes Encapsulation Introduce Visual.
Polymorphism. 3 Fundamental Properties of OO 1. Encapsulation 2. Polymorphism 3. Inheritance These are the 3 building blocks of object-oriented design.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Object Oriented Programming in Java. Object Oriented Programming Concepts in Java Object oriented Programming is a paradigm or organizing principle for.
IMS1805 Systems Analysis Topic 3: Doing Analysis (continued from previous weeks)
Solutions to Review Questions. 4.1 Define object, class and instance. The UML Glossary gives these definitions: Object: an instance of a class. Class:
OBJECT-ORIENTED PROGRAMMING. What is an “object”? Abstract entity that contains data and actions Attributes (characteristics) and methods (functions)
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Objects First with Java A Practical Introduction using BlueJ
Basic OOP Concepts and Terms
Object-oriented Programming Concepts
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
CO320 Introduction to Object- Oriented Programming Michael Kölling 3.0.
5.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
BACS 287 Basics of Object-Oriented Programming 1.
Object Oriented Programming
Object Oriented Software Development
UFCEUS-20-2 : Web Programming Lecture 5 : Object Oriented PHP (1)
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
Object Orientation An Object oriented approach views systems and programs as a collection of interacting objects. An object is a thing in a computer system.
Introduction to Object-oriented programming and software development Lecture 1.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Welcome to OBJECT ORIENTED PROGRAMMIN Date: 10/09/2014 Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
5.0 Objects First with Java A Practical Introduction using BlueJ Introduction to Computer Science I Instructor: Allyson Anderson.
Introduction To System Analysis and Design
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
1 CSC 222: Object-Oriented Programming Spring 2013 Course goals:  To know and use basic Java programming constructs for object- oriented problem solving.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
Lecture 12 March 16, The Scope of a Variable What if there are two variables with the same name? –A local or block-local variable can have the same.
CS2110: SW Development Methods Inheritance in OO and in Java Part 2: Topics: Forms of inheritance Interfaces in Java.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Object Oriented Programming
OO in Context Lecture 13: Dolores Zage. Confused about OO Not alone, there is much confusion about OO many programs are claimed to be OO but are not really.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Introduction to Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Welcome to OBJECT ORIENTED PROGRAMMING Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
6.0 Objects First with Java A Practical Introduction using BlueJ David J. Barnes Michael Kölling.
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
CSC 222: Object-Oriented Programming
CSC 222: Object-Oriented Programming
CompSci 280 S Introduction to Software Development
What is an Object Objects are key to understanding object-oriented technology. An object can be considered a "thing" that can perform a set of related.
Object Oriented Programming
Sachin Malhotra Saurabh Choudhary
Objects First with Java A Practical Introduction using BlueJ
CHAPTER 5 GENERAL OOP CONCEPTS.
Reference: COS240 Syllabus
Programming in Java Sachin Malhotra, Chairperson, PGDM-IT, IMS Ghaziabad Saurabh Chaudhary, Dean, Academics, IMS Ghaziabad.
The Object-Oriented Thought Process Chapter 1
CSC 222: Object-Oriented Programming
Week 4 Object-Oriented Programming (1): Inheritance
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
C++.
Subprograms and Programmer Defined Data Type
IFS410: Advanced Analysis and Design
MSIS 670 Object-Oriented Software Engineering
Objects First with Java A Practical Introduction using BlueJ
Object-Oriented Programming
Basic OOP Concepts and Terms
Objects First with Java A Practical Introduction using BlueJ
Object-Oriented PHP (1)
Agenda Software development (SD) & Software development methodologies (SDM) Orthogonal views of the software OOSD Methodology Why an Object Orientation?
Presentation transcript:

Introduction to Object Oriented Programming Java

Resources If you are new to programming in Java, there is an online book which is serves as a good introduction: ●Thinking in Java 3 rd edition This can be found at:

Development Environment  You can use the command line and notepad to edit and compile java programs.  You can also use jedit  BlueJ is a tool which will help you format code, compile and test your programs.

OOP Introduction  Introduced in the 60s as a proposed solution to the sprawl of software  Allowed designers to describe the system entities in plain language and design functions and attributes for each entity.  The interaction or interfaces between the entities can also be designed easily.

An OO Approach class Student{ /* attributes */ String name; int age; int courseNumber; int fees; boolean enrolled; /* Methods */ public getName(){... } public int getAge() {...} public int getFees() {...} } class StudentRecords{ /* attributes */ Student [] database; Course [] allCourses; /* Methods */ public void enrollStudent(Student s) {... } public void disenrollStudent (Student s) {... } public int getTotalStudents() {... } }

Advantages of OO Programming  The software is modular and reusable i.e. we could reuse our code for Student in an examRecords system  It is extendable, and maintainable  i.e. if we decided to store students mobile phone numbers, it'd just be a small change to the Student class.

OO Programming Vocabulary ● class ● object ● method/attribute ● inheritance ● encapsulation ● abstraction ● polymorphism

Class A class is a definition of a well defined entity, containing attributes and methods. This is a real world entity class Employees { }

Object  An object is an instance of a class.  e.g. Employee e1 = new Employee();  e1 is now an object of type Employee.

Method  A method is simply a well defined function within a class.  Example methods in Employee...  getSalary();  getDOB();  add();  remove();

Attribute ● An attribute is an instance variable which represents some data within a class. For example, all employees have a name and a salary. so... ● class Student{ String name; float salary;..etc. }

Inheritance ● Inheritance allows you to define classes which inherit the behaviour and attributes of other classes. ● For example, you may have one Employee class, but 3 different types of employees (permanent staff, part time staff and managers). Rather than write 3 entirely separate classes you can inherit the standard employee characteristics from a base class.

Inheritance Example Employee PermanentPartTimeManager forthnightSalary weeklySalary monthlySalary

Advantages of this approach  Less code, therefore easier to maintain  Reusable Employee class

Encapsulation ● We've seen how to specify the behaviour of an object, the idea of encapsulation is to hide the details of how something is achieved. ● e.g. If you are using a class that someone else has written, you want to be able to call a method (Save File for example) without knowing what is going on in the background.

Abstraction ● Abstraction a principle used to enable inheritance. ● Using abstraction you develop general classes that are appropriate to the problem, and then for specific problems inherit from these general classes. ● e.g. an Employee class models the typical behaviours of employees, but for parttime staff you'll need more specific methods.

Polymorphism ● Polymorphism is a type of encapsulation that is aimed at decoupling software systems. ● Polymorphism literally means “many forms“, and its idea is to allow subclasses to have their own specific implementations of methods. e.g. calculateSalary is a different process for our three types of employee.