Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

13
Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom COPY http://dataq.lecture .ub.ac.id/

Transcript of Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Page 1: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Object Oriented ProgrammingClass

Lecturer:

Mahendra Data, S.Kom

COPYhttp://dataq.lecture.ub.ac.id/

Page 2: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

About me…

Mahendra Data, S.Kom

E-mail:[email protected]

Blog:http://dataq.lecture.ub.ac.id/http://dataq.wordpress.com/

C++, Delphi, JAVA, C#, Python

COPYhttp://dataq.lecture.ub.ac.id/

Page 3: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Score

• 60% from an assignment, project, etc• 15% from middle semester test (UTS)• 25% from end semester test (UAS)

Any objection?

COPYhttp://dataq.lecture.ub.ac.id/

Page 4: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Object Oriented Programming

Thinking inCOPYhttp://dataq.lecture.ub.ac.id/

Page 5: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

What is OOP?it’s a new way of thinking in programming

Object-oriented programming relates the programming activity of modelling or simulation.

Objects are identified by a correspondence with the objects found in the real world and used to model those operations.

COPYhttp://dataq.lecture.ub.ac.id/

Page 6: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Thinking in OOPHi, I'm an “object” called calculator

I also builded from some other objects

I have some function and unique serial number

I have so many friend like me but with different serial number.

We call it “instance”

So calculator is a “class”

We call it “object

composition”

We call it “Attribute and

Method”

COPYhttp://dataq.lecture.ub.ac.id/

Page 7: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Thinking in OOPI can calculate addition, subtraction , multiplication, division and other mathematics function

Display, button, battery, box, processor are the components that build me.

I have some child, they are scientific calculator, programmer calculator and statistics calculator. They inherit my features but also have several improvement that I didn’t have.

We call it “inheritance”

COPYhttp://dataq.lecture.ub.ac.id/

Page 8: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Thinking in OOPLet me introduce some of my child

Hi, I am scientific calculator

Hi, I am programmer calculator

We call it “polymorphism”

Some of our button is same, but it can behave

in the different way.

COPYhttp://dataq.lecture.ub.ac.id/

Page 9: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Thinking in OOPI bet you didn't how the process inside me.

We call it “encapsulation”

You know what will happen if you press each of my button, right?

We categorize this function as

“public method”

But don’t worry, You can give me command by pressing each of my button.

We categorizethis button as

“public attribute”

COPYhttp://dataq.lecture.ub.ac.id/

Page 10: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Set this as our mindset!Treat a problem like the real object in the real world!

Visualize this object in the virtual world

List the attributes and methods that visible to the user

Attributes and methods that user don’t need to know should be encapsulate!

Make class hierarchy for class that have similar function

It will help you to make the system simple and clean

COPYhttp://dataq.lecture.ub.ac.id/

Page 11: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Let's practice!I have a “tamiya”.

Do you know tamiya?

This is tamiya!

I want to simulate this tamiya in the computer. So I can decide what kind of part that I need to change

if I want to boost the performance.

COPYhttp://dataq.lecture.ub.ac.id/

Page 12: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Let's practice!

Can you help me to build an OOP program design? I need a clean an simple program that can be extend if I need some improvement or I have to simulate the other type of tamiya.

Maybe you start by listing the object that involve in this simulation? And of course after that you need to listing the attributes and methods for each object.

COPYhttp://dataq.lecture.ub.ac.id/

Page 13: Object Oriented Programming Class Lecturer: Mahendra Data, S.Kom.

Group assignment

Its time to learn JAVA programming!!!

Study basic JAVA programming language like print, read input, if, do, for, define a

class and making an instance.

In the next meeting we will have a group quiz! (^.^)

COPYhttp://dataq.lecture.ub.ac.id/