F3031 Object Oriented Programming

Slides:



Advertisements
Similar presentations
Object Oriented Programming
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Chapter 1 Object-Oriented System Development
CS-2135 Object Oriented Programming
Pembolehubah dan Pemalar
Object Oriented System Development with VB .NET
The Object Oriented Programming Languages (OOPL). Done by: Tayeb El Alaoui Supervised by: Dr Driss Kettani.
PowerPoint Presentation for Dennis & Haley Wixom, Systems Analysis and Design, 2 nd Edition Copyright 2003 © John Wiley & Sons, Inc. All rights reserved.
Prinsip-prinsip Spesifikasi Rekabentuk
Paradigma Pengaturcaraan
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
C++ fundamentals.
OBJECT ORIENTED PROGRAMMING IN C++ LECTURE
1 INTRODUCTION TO OOP Objective: Know the difference between functional programming and OOP Know basic terminology in OOP Know the importance of OOP Know.
CPT 140 Programming Constructs1 OBJECT ORIENTED TECHNOLOGY Terminology and Basic Concepts.
Java Programming, 2E Introductory Concepts and Techniques Chapter 1 An Introduction to Java and Program Design.
Abstraction, Inheritance, and Polymorphism in Java.
Introduction to Object-oriented programming and software development Lecture 1.
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
An Object-Oriented Approach to Programming Logic and Design
Sadegh Aliakbary Sharif University of Technology Fall 2011.
CONCEPTS OF OBJECT ORIENTED PROGRAMMING. Topics To Be Discussed………………………. Objects Classes Data Abstraction and Encapsulation Inheritance Polymorphism.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 1Winter Quarter C++ Lecture 24.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
1 Programming Paradigms Object Orientated Programming Paradigm (OOP)
Learners Support Publications Object Oriented Programming.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
9-Dec Dec-15  INTRODUCTION.  FEATURES OF OOP.  ORGANIZATION OF DATA & FUNCTION IN OOP.  OOP’S DESIGN.
Salman Marvasti Sharif University of Technology Winter 2015.
Copyright 2006 Oxford Consulting, Ltd1 January Introduction to C++ Programming is taking A problem Find the area of a rectangle A set of data.
Introduction To OOP 1.0 Fundamentals Of Java Programming Language 2.0 Exception Handling 3.0 Classes, Inheritance And Polymorphism © 2011 | PN AZRINA.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Software Construction Lab 05 Abstraction, Inheritance, and Polymorphism in Java.
Java Programming, 3e Concepts and Techniques Chapter 1 Section 56 – An Introduction to Java.
 The Object Oriented concepts was evolved for solving complex problems. Object- oriented software development started in the 1980s. Object-oriented design.
CSCI120 Introduction to Computer Science I using Python 3
Pernyataan Kawalan Java
Object Oriented Programming Development
Object Oriented Programming
Object-Oriented Programming Concepts
Object Oriented Programming F3031
The Object-Oriented Thought Process Chapter 1
Data Abstraction: The Walls
OBJECT ORIENTED PROGRAMMING overview
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
C++.
ASAS PENGATURCARAAN C++
ASAS PENGATURCARAAN F1001 En. Azrol Hisham Bin Mohd Adham
Paradigma Pengaturcaraan
F3031 : OBJECT ORIENTED PROGRAMMING
TOPIK KHAS : PENGGUNAAN VB DENGAN PERISIAN MICROSOFT YANG LAIN (VBA)
Object Oriented Analysis and Design
KOMPONEN ASAS VISUAL BASIC 6.0
Pernyataan if.. Pernyataan switch..
BAB 8 TATASUSUNAN.
TOPIK KHAS : PENGGUNAAN VB DENGAN PERISIAN MICROSOFT YANG LAIN (VBA)
Subprograms and Programmer Defined Data Type
2.0 PENGALAMATAN RANGKAIAN
MENGGUNAKAN OBJEK VISUAL BASIC 6.0
Pembolehubah dan Pemalar
Oleh: Zaihan Abdul Ghani A Sharifah Suhaila Mohd Ramli A103305
POLITEKNIK PORT DICKSON E4161 SISTEM KOMPUTER & APLIKASI
CPS120: Introduction to Computer Science
Kebolehgunaan Semula Perisian
The C++ programming language
Muhamad Shukri Saud PRODUCTION ORGANIZATION
CPS120: Introduction to Computer Science
Object-Oriented Programming
3.4.3 KONFIGURASI DAN UJIAN RANGKAIAN
Presentation transcript:

F3031 Object Oriented Programming CHAPTER 1 INTRODUCTION TO OBJECT ORIENTED PROGRAMMING (OOP) By: PN. NOR ANISAH BINTI MOHD SAAD

CHAPTER 1.0 : INTRODUCTION TO OOP Define OOP History of OOP Advantages of using OOP Basic Terminologies of OOP Abstraction and Encapsulation Structured and OOP Approach 2 3 4 5 6

Define OBJECT 1 An object can be considered as a "thing" that can perform a set of activities (behaviours). For example, a "Student" object can tell you its name or its address.

Define OBJECT An object is a "black box" which receives and sends messages. A black box actually contains code and data Messages define the interface to the object. Everything an object can do is represented by its message interface. So you shouldn't have to know anything about what is in the black box in order to use it.

Define OBJECT ORIENTED PROGRAMMING 1 In object-oriented programming, objects interact with each other by messages (specific codes). The only thing that an object knows about another object is the object's interface. Each object's data and method is hidden from other objects. In other words, the interface encapsulates the object's code and data.

Define OOP 1 A type of programming where the programmer can define data types and types of operation (function), which will be performed on the data structure. Data Types of operation Data Type Matric No. Marks Integer Float Sorting students Calculate marks

Define OOP (cont.) 1 Object-oriented programming is a method used to write programs where data and behaviours are packaged together in one class. Object is a member of a class. Object Oriented Programming is programming which is oriented around objects, thus taking advantage of Encapsulation, Polymorphism, and Inheritance to increase code reuse and decrease code maintenance.

Define OOP (cont.) 1 A language or technique is object-oriented if it directly supports: Abstraction - providing some form of classes and objects. Inheritance - providing the ability to build new abstractions out of existing ones. Runtime polymorphism - providing some form of runtime binding.

HISTORY of oop Early 1960s SIMULA was the first object language. 2 Early 1960s SIMULA was the first object language. developed by Kristen Nygaard and Ole-Johan Dahl in Norway. It was designed for the purpose of creating simulations (ships) Kristen Nygaard Ole-Johan Dahl

HISTORY of oop 2 1970s Alan Kay – idea to integrated the SIMULA into personal computer Joint venture with Xerox Parc – created the first personal computer called Dynabook Smalltalk was the object-oriented language developed for programming the Dynabook It was a simulation and graphics-oriented programming language. Alan Kay

HISTORY of oop 2 1980s Bjorn Stroustrup integrated object-oriented programming into the C language The resulting language was called C++ and it became the first object-oriented language to be widely used commercially Bjorn Stroustrup

HISTORY of oop 2 1990s a group at Sun led by James Gosling developed a simpler version of C++ called Java Java programming meant to be a programming language for video-on-demand applications No +ve response - re-oriented its focus and marketed Java as a language for programming Internet applications The language has gained widespread popularity as the Internet has boomed James Gosling

Advantages of using oop 3 Code extensibility Ability to add codes, which are already existing and consistent with needs. Code reusability Existing code can be tested first before it is inherited from previous module. This will save cost and time needed to develop software. With this method, it will help to increase programmer’s productivity. Represent real world Using object-oriented concept, it will assist the programmer in creating a module because data used represents real situations. Data security The use of encapsulation concept has made data to be protected from misuse by an unauthorized person.

Basic terminologies of OOP 4 Object Class Encapsulation Data Abstraction Inheritance Polymorphism 1 2 3 4 5 6

Basic terminologies of OOP (cont.) 4 Object 1 Object is the term used to explain many things. Example: student, chair and circle. An Object consists of data and method. Properties of an object are called data. In the real world, characteristics of an object can be divided into two types: Data that can be seen such as a human with two hands. Data that cannot be seen such as a human with a name. Method is a set of function that manipulates data, such as method DetermineStatus() can determine exam result for object student.

Basic terminologies of OOP (cont.) 4 Class 2 A set of objects that have similar attributes (data) and methods. Attributes and methods of a class can be used by each object from that class. class Student { String name, address, status; int icno, sid; double marks; char DetermineStatus() { if marks >= 40 status = “Pass”; else status = “Fail”; } data method Class

Basic terminologies of OOP (cont.) 4 Encapsulation 3 Encapsulation is a process of tying together all data and methods that form a class and control the access to data by hiding its information. It enables access to object just by using methods of that object. It is one of the security features in OOP. Attributes and methods of a class can be used by each object from that class. Class Student Name, Student ID, Address, IC No Calculate_result() Determine_grade() Print_result()

Basic terminologies of OOP (cont.) 4 Data Abstraction 4 Data abstraction is a process to delete all unnecessary attributes and remain the necessary attributes to describe an object Attributes and methods of a class can be used by each object from that class. Figure 1.2: Describe data abstraction concept in OOP for object Box. width length depth Object Box Data abstraction Class Box Characteristics Behaviors Length, width, depth Calculate_Volume() Calculate_Area()

Basic terminologies of OOP (cont.) 4 Inheritance 5 Create a new class from an existing class together with new attributes and behaviours. The new class will have the same ability as the base class. Use the concept of code reusability. Class A Class B Class E Class D Class C Base class for B Derived class from class A Base class for class C, D and E Derived class from class B

Basic terminologies of OOP (cont.) 4 Polymorphism 6 Polymorphism is a process of giving the same message to two or more different objects and produce different behaviours depending on how the objects receive the message. It is said to be “One interface, many methods”. Contoh: Method: Keluarkan wang anda dari bank: Objek: Pelajar 1 : Menggunakan mesin ATM yang disediakan oleh pihak bank di mana akaun dibuka Pelajar 2 : Menggunakan mesin ATM (MEPS) dari bank lain

Structured and oop approach 6 Pengaturcaraan Berstruktur OOP 1 Berasaskan Fungsi Yang didefinisikan Pengaturcara Memecahkan satu program yang besar pada beberapa fungsi. Setiap fungsi akan melaksanakan tugas yang lebih spesifik Contoh: void main( ){ ……….. Peribadi (nama,umur); } void Peribadi(char *a, int b) { //Definisi fungsi DataPeribadi } Teknik Pengaturcaraan Berasaskan Objek Penggunaan konsep pengkapsulan yang menggabungkan data dan fungsi dalam satu komponen (kelas) class Individu{ ……….. // data void DataPeribadi( ) }; main( ){ Individu a; /*Objek a capai data dan method dari kelas Individu*/ }

Structured and oop approach (cont.) 6 2 Kod aturcara tidak boleh digunakan berulangkali Setiap fungsi ditugaskan untuk satu tugas yang spesifik. Kita mesti menerima fungsi itu sebagaimana ia ditulis. Untuk mengubahsuainya, kod itu haruslah disalin semula dan diubah untuk memenuhi keperluan. Contoh: Kita telah merekacipta satu radio untuk kegunaan rumah. Teknologi yang digunakan itu boleh digunakan untuk mencipta radio kereta ataupun radio yang digunakan di tepi pantai. Membenarkan penggunaan kod yang berulang kali Ia boleh dilakukan melalui teknik pewarisan. Teknik ini membolehkan objek untuk mewarisi ciri-ciri (fungsi dan data) objek lain.   Contoh: Kita menggunakan radio kegunaan rumah yang telah dicipta untuk digunakan pada kereta dan di pantai

Structured and oop approach (cont.) 6 3 Fungsi Memanipulasikan Data Data (cth: nama, umur) akan dihantar ke fungsi-fungsi tertentu (cth: cetak, papar, tambah, dan padam) untuk dimanipulasikan. Fungsi yang akan memanipulasikan data tidak ditetapkan terlebih dahulu. Menggunakan Pengkapsulan Untuk Bertindak Ke atas Data Pengkapsulan digunakan untuk mempakej data bersama fungsi yang akan bertindak ke atas data. Ia mengenalpasti fungsi yang akan dilaksanakan ke atas setiap objek. Kelas akan mengawal sebarang operasi keatas data dan fungsi yang berada didalamnya. 4 Tiada Kawalan Capaian Data Fungsi main ( ) boleh capai semua data dan fungsi yang terdapat pada program Kekangan Dalam Mencapai Data Wujudnya kawalan capaian terhadap data di dalam kelas. Contohnya katakunci private dan protected. Untuk mencapai private data ia mesti dilakukan melalui method ataupun mekanisma pengkapsulan. 5 Tidak menyokong polimorfisma Setiap data mesti diisytiharkan terlebih dahulu sebelum operasi ke atasnya dilaksanakan. Penggunaan Polimorfisma (polymorphism) Polimorfisma membolehkan satu fungsi dilaksanakan dengan pelbagai kaedah.