Presentation on theme: "BAHASA PEMROGRAMAN 2 OBJECT ORIENTED PROGRAMMING Using C++"— Presentation transcript:
BAHASA PEMROGRAMAN 2 OBJECT ORIENTED PROGRAMMING Using C++
Tentang saya Wahyu S. J. Saputra, S.Kom S1 Teknik Informatika UPN “Veteran” Jatim 2004 - 2009 Email: firstname.lastname@example.org_informaticsrescue@yahoo.co.id Tugas: email@example.com@gmail.com
Tujuan Umum Mahasiswa memahami paradigma pemrograman berorientasi objek dalam lingkungan bahasa C++. Khusus Mahasiswa memahami konsep class dan object. Mahasiswa memahami konsep constructor dan destructor. Mahasiswa memahami konsep polymorphism. Mahasiswa memahami konsep inheritance.
Buku Referensi Object Oriented Programming with C++, E. Balagurusamy, Tata McGraw-Hill, 1995. Internet. Bahan Kuliah : map ke server LAN \\172.16.34.209\kuliah
Satuan Acara Perkuliahan 1. Kontrak Kuliah + Pengenalan Dasar OOP 2. Class dan Object 1 3. Class dan Object 2 4. Class dan Object 3 5. Constructors dan Destructors 1 6. Constructors dan Destructors 2 7. Demo Program/ Quiz 8. UTS 9. Polymorphism/ Overloading 10. Inheritance 1 11. Inheritance 2 12. Pointer dan Virtual Function 13. OO Development + Quiz 14. Demo Program 1 Kelompok 1 – 5. 15. Demo Program 2 Kelompok 6 – 10. 16. UAS
CATATAN Toleransi keterlambatan hadir adalah 30 menit. Mahasiswa harus berpakaian rapi dengan baju berkerah dan bersepatu. Tidak ada toleransi untuk kecurangan selama ujian tulis. Ujian/ tugas susulan akan diberikan dengan menunjukkan surat keterangan yang jelas.
Case Studies 1. FRS Online 2. SIM Nilai Praktikum 3. Penjualan Voucher HP 4. Tarif Jasa Parkir 5. SIM Gaji Pegawai 6. Billing Warnet 7. Pendaftaran Mahasiswa Baru 8. SIM Hewan di Kebun Binatang 9. Penjualan Sepeda Motor 10. Rental VCD
Introduction to Object Oriented Programming Concepts
Edsger Dijkstra The machines have become several orders of magnitude more powerful! As long as there were no machines, programming was no problem at all; When we had a few weak computers, programming became a mild problem, and Now we have gigantic computers, programming has become an equally gigantic problem.
SOFTWARE CRISIS 60% projects had schedule overruns, 50% projects had cost overruns, 45% projects could not be used, 29% projects was never delivered, and 19% projects had to be reworked to be used. *USA contractors surveyed
Object-oriented programming addresses those problem by strongly emphasizing modularity in software. Modul is a component of a larger system, and operate within that system independently from the operations of the other components.
SOFTWARE EVOLUTION Layers of software technology Object Oriented Programming Procedure Programming Assembly Language Machine Language 1, 0
A LOOK AT PROCEDURE- ORIENTED PROGRAMMING Main Program Function 1 Function 8Function 6 Function 4Function 5 Function 3Function 2 Function 7
Global Data Function 1 Local Data Function 1 Local Data Function 1 Local Data Some characteristics: Emphasis is on doing things (algorithms) Large programs are devided into smaller programs known as function/ subrutin Most of the function share global data Data move openly around the system from function to function
OOP PARADIGM DATA FUNCTIONS OBJECT A DATA FUNCTIONS OBJECT C DATA FUNCTIONS OBJECT B
BASIC CONCEPTS OF OOP OBJECTS CLASSES DATA ABSTRACTION ENCAPSULATION INHERITANCE POLYMORPHISM DYNAMIC BINDING MESSAGE PASSING
Some of OOP’s striking features: Emphasis is on data rather than procedure. Programs are divided into objects. Data structures are designed such that they characterize the objects. Functions are tied together in the data structures. Data is hidden and can not be accessed by external functions.
CLASSES Is the user defined data types A collection of objects of similar type Example: Object mango, apple, and orange is member of class fruit Object TF, TI, TK, TP is member of class Jurusan Object jip, sedan, bus, truk is member of class mobil
OBJECTS Is the variables of program Have a life cycle. They can be created and destroyed. Interacts by sending message to one another Contains data and code/ function to manipulate the data
Representing notations: Object: STUDENT DATA: Name Date-of-Birth Marks …. FUNCTIONS: Total Average Display …. STUDENT Name Date-of-Birth Marks Total Average Display
DATA ABSTRACTION The act of representing essential features without including the background details or explanations. Defined as list of attributes and functions. Known as Abstract Data Types (ADT).
ENCAPSULATION Wrapping up of data and functions into a single unit (called class). The data is not accessible to the outside world and only functions which are wrapped in the class can access it. Insulation of the data from direct access by the program is called data hiding
INHERITANCE Is the process by which objects of one class acquire the properties of objects of another class. Supports the concepts of hierarchical classification. Provides the idea of reusability. Example: the bird robin is a part of the class flying bird which is again a part of the class bird.
POLYMORPHISM The ability to take more than one form. An operation may exhibit different behaviour in different instances depends upon the data types used in the operation. Example: addition operation If two numbers, will generate a sum If two strings, will generate a concatenation Extensively used in implementing inheritance
DYNAMIC BINDING The code asociated with a given procedure call is not known until the time of the call at run time. Associated with polymorphism and inheritance. Example: (above diagram) Unique to each object and so the draw procedure will be redefined in each class that defines the object. At run-time, the code matching the object under current reference will be called.
MESSAGE PASSING Object oriented program consist of a set of objects communicate with each. Steps: Creating classes that define objects and their behaviour. Creating objects from class definitions. Establishing communication among objects. Objects communicate with one another by sending and receiving information. Message passing involves: object’s name, function’s name (message) and information
BENEFITS OF OOP Through inheritance, we can eliminate redundant code and extend the use of existing classes. The principle of data hiding helps the programmer to build secure programs. Can be easily upgraded from small to large systems. Software complexity can be easily managed.