Understanding Object Oriented Programming

0% found this document useful (0 votes)
18 views18 pages
Object-oriented programming (OOP) is a programming paradigm that uses objects and their interactions to design applications and programs. OOP uses classes which define data structures consis…

Uploaded by

teguhs
  • Introduction to Object Oriented Programming
  • Why Use OOP?
  • Concept of Class and Object
  • Programming Examples and Implementation
  • Access Control Modifiers
  • Conclusion

Object Oriented Programming

TeguhSutanto
Si | STIKOM Surabaya
teguh@[Link]|+628563076813|[Link]

GOAL
[Link] can understand the Object Oriented Programming concepts [Link] can make a program in accordance with the rules of Object Oriented Programming

Object-oriented programming (OOP) is a programming paradigm using "objects" data structures consisting of data fields and methods together with their interactions to design applications and computer programs

Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data

Why OOP?
1. Object-oriented systems can be easily upgraded from small to large scale. 2. It is easy to partition the work in a project based on objects. 3. Object-oriented programming offers a new and powerful model for writing computer software. 4. It reduces software maintenance and developing costs. 5. Changes in user requirements or later developments have always been a major problem. 6. Object-orientation or object oriented programming (OOP) should help one in developing high quality software easily.

Concept of Class and Object


Class refers to a blueprint. It defines the variables and methods the objects support Object is an instance of a class. Each object has a class which defines its data and behavior

Concept of Class and Object

Classes reflect concepts, objects reflect instances that embody those concepts
object class
girl

Jodie

Daria

Jane

Brittany

Class:A class can have three kinds of members:

Attribute/Field/Data

Method

Field Declaration
a type name followed by the field name, and optionally an initialization clause primitive data type vs. Object reference
o

boolean, char, byte, short, int, long, float, double

field declarations can be preceded by different modifiers


o o o

access control modifiers static final

Acces Control Modifier


[Link]: private members are accessible only in the class itself [Link]: package members are accessible in classes in the same package and the class itself [Link]: protected members are accessible in classes in the same package, in subclasses of the class, and in the class itself [Link]: public members are accessible anywhere the class is accessible

com
Person
name: String address: String # age: int +getName(): String
X

MainMenu
X

Employee

HRD

[Link]

public class Pencil { public String color = red; public int length; public float diameter; private float price; public static long nextID = 0; public void setPrice (float newPrice) { price = newPrice; } }

[Link] public class CreatePencil {

public static void main (String args[]){ Pencil p1 = new Pencil(); [Link] = 0.5f; }

}
%> javac [Link] %> javac [Link] [Link]: price has private access in Pencil [Link] = 0.5f; ^

Object Oriented 
Programming 
TeguhSutanto  
Si | STIKOM Surabaya 
teguh@stikom.edu|+628563076813|http://teguhsutanto.blogspo
GOAL 
1.Students can 
understand the 
Object Oriented 
Programming 
concepts  
2.Students can make a 
program in 
accordance
Object-oriented programming (OOP)  
is a programming paradigm using "objects" 
– data structures consisting of data fields
Object-oriented programming (OOP) is a 
programming language model organized 
around "objects" rather than "actions" and 
dat
Why OOP? 
1.Object-oriented systems can be easily upgraded from 
small to large scale. 
2.It is easy to partition the work in
Concept of Class and Object 
• “Class” refers to a blueprint. It defines the 
variables and methods the objects support 
 
•
Concept of Class and 
Object
Classes reflect concepts, objects 
reflect instances that embody those 
concepts 
Daria 
Jane 
Brittany 
Jodie 
girl 
class

You might also like