SlideShare a Scribd company logo
IT 405: KPLBO
Materi 4 Kelas dan Objek
Ayi Purbasari, ST., MT.
If-Unpas, 2014
Outline
• The advantages of an object-oriented approach
to software development as compared with the
“traditional” non-OO approach
• How to use classes to specify an object’s data and
behavior
• How to create objects at run time
• How to declare reference variables to refer to
objects symbolically within a program
• How objects keep track of one another in
memory
Software
Software
Data
Function - that operate on (i.e.,
input, output, calculate, store,
retrieve, print, etc.) that data.
Pendekatan pembangunan Software
Pendekatan Functional
Decomposition
OO Approach
(top down) Functional Decomposition
Fungsi
Sub Fungsi
Sub Fungsi
Functional Decomposition
Our primary focus was on the functions that an application was to
perform; data was an afterthought. That is,
• Data was passed around from one function to the next
• Data structure thus had to be understood in many places (i.e., by
many functions)
• throughout an application.
• If an application’s data structure had to change after the application
was deployed, major “ripple effects” often arose throughout the
application.
• it was often very difficult to pinpoint precisely where—that is, in
which specific function(s)—the error might have occurred, because
the data had been passed from function to function so many times.
OO Approach
With OO software development, we focus on designing the application’s data structure first,
and its functions second.
Data is encapsulated inside of objects; thus, data structure has to be
If an object’s data structure has to change after the application has been deployed, there
are virtually no ripple effects; only the internal logic of the affected object must change.
Each object is responsible for ensuring the integrity of its own data. Thus, if data integrity
errors arise within a given object’s data, we can pretty much assume that it was the object
itself that allowed this to happen, and we can therefore focus on that object’s internal
functional logic to isolate the “bug.”
WHAT IS AN OBJECT?
What Is an Object?
(1) something
material that may be
perceived by the
senses; (2) something
mental or physical
toward which
thought, feeling, or
action is directed.
physical
objects
conceptual
objects
What Is an Object?
physical objects
• The students who attend
classes
• The professors who teach the
students
• The classrooms in which class
meetings take place
• The audiovisual equipment in
these classrooms
• The buildings in which the
classrooms are located
• The textbooks students use
conceptual objects
• The courses that students
attend
• The departments that
faculty work for
• The degrees that students
receive
A software object
• bundles state (data)
and behavior
(functions).
State/Data/Attributes
• The student’s name
• His or her student ID number
• The student’s birth date
• His or her address
• The student’s designated major
field of study
• His or her cumulative grade point
average (i.e., the student’s GPA)
• Who the student’s faculty advisor
is
• A list of the courses that the
student is currently enrolled in
this semester (i.e., the student’s
current course load )
Behavior/Operations/Methods
• Enrolling in a course
• Dropping a course
• Designating a major field of
study
• Selecting a faculty advisor
• Telling us his or her GPA
• Telling us whether or not he
or she has taken a particular
course, and if so, when the
course was taken, which
professor taught it, and what
grade the student received
When we talk about software objects specifically, we define an object’s
behaviors, also known as its operations, as both the things that an object
does to access its attribute values (data) and the things that an object
does to modify/maintain its attribute values (data).
What Is a Class?
A class is an abstraction describing
the common features of all objects in
a group of similar objects.
Attribute Type
• name String
• studentId String
• birthDate Date
• address String
• major String
• gpa double
• advisor ???
• courseLoad ???
• transcript ???
Method
• registerForCourse
• dropCourse
• chooseMajor
• changeAdvisor
• printTranscript
A Note Regarding Naming
Conventions
Naming Classes
• uppercase letter, but use
mixed case for the name
overall
• Student, Course, Professor,
and so on.
• multiword phrase, we start
each word with a capital letter,
and concatenate the words
without using spaces, dashes,
or underscores to sepa- rate
them
• CourseCatalog.(This style is
known as Pascal casing).
Attibute and Method Names
• lowercase letter, but to
capitalize the first letter of
any subsequent words in
the name
• Typical attribute names
might thus be name,
studentId, or courseLoad,
• Typical method names
might thus be
registerForCourse and
printTranscript.
Declaring a Class, Java Style
public class Student {
// Attribute declarations typically appear first in a class declaration
...
String name;
String studentId;
Date birthDate;
String address;
String major;
double gpa;
// type? advisor – we'll declare this attribute in earnest later!
// type? courseLoad - ditto
// type? transcript - ditto
// ... followed by method declarations (details omitted – you'll
// learn how to program methods in Java in Chapter 4.)
}
Classes may thus be differentiated
from objects
Class Object
Classes may thus be differentiated
from objects
Class:
• A class defines the
features—attributes,
methods—that every object
belonging to the class must
possess; a class can thus be
thought of as serving as an
object template
Object Oriented:
• An object, on the other
hand, is a unique instance
of a filled-in template for
which attribute values have
been provided, and upon
which methods may be
performed
Instatiation
• The term instantiation is used to refer to the process by
which an object is created in mem- ory at run time based
upon a class definition.
• From a single class definition—for example, Student— we
can create many objects with identical data structures and
behaviors, in the same way that we use a single cookie
cutter to make many cookies all of the same shape.
• Another way to refer to an object, then, is as an instance of
a particular class—for example, “A Student object is an
instance of the Student class.”
• ( We’ll talk about the physical process of instantiating
objects as it occurs in Java in a bit more detail later in this
chapter.)
THANK YOU

More Related Content

What's hot

0-oop java-intro
0-oop java-intro0-oop java-intro
0-oop java-intro
Amr Elghadban (AmrAngry)
 
Introduction of object oriented analysis & design by sarmad baloch
Introduction of object oriented analysis & design by sarmad balochIntroduction of object oriented analysis & design by sarmad baloch
Introduction of object oriented analysis & design by sarmad baloch
Sarmad Baloch
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
Nilesh Dalvi
 
6. Exception Handling
6. Exception Handling6. Exception Handling
6. Exception Handling
Nilesh Dalvi
 
Internationalization
InternationalizationInternationalization
Internationalization
Ravi Kant Sahu
 
2. Basics of Java
2. Basics of Java2. Basics of Java
2. Basics of Java
Nilesh Dalvi
 
7. Multithreading
7. Multithreading7. Multithreading
7. Multithreading
Nilesh Dalvi
 
Oops abap fundamental
Oops abap fundamentalOops abap fundamental
Oops abap fundamental
biswajit2015
 
CSTalks-Quaternary Semantics Recomandation System-24 Aug
CSTalks-Quaternary Semantics Recomandation System-24 AugCSTalks-Quaternary Semantics Recomandation System-24 Aug
CSTalks-Quaternary Semantics Recomandation System-24 Aug
cstalks
 
Ir classification association
Ir classification associationIr classification association
Ir classification association
swapnil shinde
 
Friend function
Friend functionFriend function
Friend function
Heet Patel
 
Email Classification - Why Should it Matter to You?
Email Classification - Why Should it Matter to You?Email Classification - Why Should it Matter to You?
Email Classification - Why Should it Matter to You?
Sherpa Software
 
Object Oriented Analysis And Design
Object Oriented Analysis And DesignObject Oriented Analysis And Design
Object Oriented Analysis And Design
Sahil Mahajan
 

What's hot (13)

0-oop java-intro
0-oop java-intro0-oop java-intro
0-oop java-intro
 
Introduction of object oriented analysis & design by sarmad baloch
Introduction of object oriented analysis & design by sarmad balochIntroduction of object oriented analysis & design by sarmad baloch
Introduction of object oriented analysis & design by sarmad baloch
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
6. Exception Handling
6. Exception Handling6. Exception Handling
6. Exception Handling
 
Internationalization
InternationalizationInternationalization
Internationalization
 
2. Basics of Java
2. Basics of Java2. Basics of Java
2. Basics of Java
 
7. Multithreading
7. Multithreading7. Multithreading
7. Multithreading
 
Oops abap fundamental
Oops abap fundamentalOops abap fundamental
Oops abap fundamental
 
CSTalks-Quaternary Semantics Recomandation System-24 Aug
CSTalks-Quaternary Semantics Recomandation System-24 AugCSTalks-Quaternary Semantics Recomandation System-24 Aug
CSTalks-Quaternary Semantics Recomandation System-24 Aug
 
Ir classification association
Ir classification associationIr classification association
Ir classification association
 
Friend function
Friend functionFriend function
Friend function
 
Email Classification - Why Should it Matter to You?
Email Classification - Why Should it Matter to You?Email Classification - Why Should it Matter to You?
Email Classification - Why Should it Matter to You?
 
Object Oriented Analysis And Design
Object Oriented Analysis And DesignObject Oriented Analysis And Design
Object Oriented Analysis And Design
 

Similar to It 405 materi 3 objek dan kelas

C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
Information Technology Center
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
Information Technology Center
 
Object oriented programming
Object oriented programmingObject oriented programming
O6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdfO6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdf
MohamedRamadan454985
 
Object oriented programming 6 oop with c++
Object oriented programming 6  oop with c++Object oriented programming 6  oop with c++
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
Komal Singh
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Saiful Islam Sany
 
System Concepts for Object Modelling.pptx
System Concepts for Object Modelling.pptxSystem Concepts for Object Modelling.pptx
System Concepts for Object Modelling.pptx
barrettoleisabel
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
AshutoshTrivedi30
 
Oops
OopsOops
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
YashKoli22
 
MetadataTheory: Introduction to Learning Objects (1st of 10)
MetadataTheory: Introduction to Learning Objects (1st of 10)MetadataTheory: Introduction to Learning Objects (1st of 10)
MetadataTheory: Introduction to Learning Objects (1st of 10)
Nikos Palavitsinis, PhD
 
Handout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and DesignHandout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and Design
SAFAD ISMAIL
 
Objects and Classes.pptx
Objects and Classes.pptxObjects and Classes.pptx
Objects and Classes.pptx
BalasundaramSr
 
Objects and Classes.pptx
Objects and Classes.pptxObjects and Classes.pptx
Objects and Classes.pptx
BalasundaramSr
 
Objects and Classes BRIEF.pptx
Objects and Classes BRIEF.pptxObjects and Classes BRIEF.pptx
Objects and Classes BRIEF.pptx
BalasundaramSr
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
LakshyaChauhan21
 
Object oriented Programming in Python.pptx
Object oriented Programming in Python.pptxObject oriented Programming in Python.pptx
Object oriented Programming in Python.pptx
SHAIKIRFAN715544
 

Similar to It 405 materi 3 objek dan kelas (20)

C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
C# by Zaheer Abbas Aghani
C# by Zaheer Abbas AghaniC# by Zaheer Abbas Aghani
C# by Zaheer Abbas Aghani
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
O6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdfO6u CS-315A OOP Lecture (1).pdf
O6u CS-315A OOP Lecture (1).pdf
 
Object oriented programming 6 oop with c++
Object oriented programming 6  oop with c++Object oriented programming 6  oop with c++
Object oriented programming 6 oop with c++
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
System Concepts for Object Modelling.pptx
System Concepts for Object Modelling.pptxSystem Concepts for Object Modelling.pptx
System Concepts for Object Modelling.pptx
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
Oops
OopsOops
Oops
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
 
MetadataTheory: Introduction to Learning Objects (1st of 10)
MetadataTheory: Introduction to Learning Objects (1st of 10)MetadataTheory: Introduction to Learning Objects (1st of 10)
MetadataTheory: Introduction to Learning Objects (1st of 10)
 
Handout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and DesignHandout on Object orienetd Analysis and Design
Handout on Object orienetd Analysis and Design
 
Objects and Classes.pptx
Objects and Classes.pptxObjects and Classes.pptx
Objects and Classes.pptx
 
Objects and Classes.pptx
Objects and Classes.pptxObjects and Classes.pptx
Objects and Classes.pptx
 
Objects and Classes BRIEF.pptx
Objects and Classes BRIEF.pptxObjects and Classes BRIEF.pptx
Objects and Classes BRIEF.pptx
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
Object oriented Programming in Python.pptx
Object oriented Programming in Python.pptxObject oriented Programming in Python.pptx
Object oriented Programming in Python.pptx
 

More from Ayi Purbasari

Clonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpressClonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpress
Ayi Purbasari
 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
Ayi Purbasari
 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
Ayi Purbasari
 
It 405 materi 4 objek dan kelas ii
It 405 materi 4   objek dan kelas iiIt 405 materi 4   objek dan kelas ii
It 405 materi 4 objek dan kelas ii
Ayi Purbasari
 
It 405 materi 2 java dasar
It 405 materi 2   java dasarIt 405 materi 2   java dasar
It 405 materi 2 java dasar
Ayi Purbasari
 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
Ayi Purbasari
 
Using uml to model immune system
Using uml to model immune systemUsing uml to model immune system
Using uml to model immune system
Ayi Purbasari
 
Pascapositivisme
Pascapositivisme Pascapositivisme
Pascapositivisme
Ayi Purbasari
 

More from Ayi Purbasari (8)

Clonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpressClonal Selection Algorithm Parallelization with MPJExpress
Clonal Selection Algorithm Parallelization with MPJExpress
 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
 
It 405 materi 4 objek dan kelas ii
It 405 materi 4   objek dan kelas iiIt 405 materi 4   objek dan kelas ii
It 405 materi 4 objek dan kelas ii
 
It 405 materi 2 java dasar
It 405 materi 2   java dasarIt 405 materi 2   java dasar
It 405 materi 2 java dasar
 
It 405 materi 1 pengantar
It 405 materi 1   pengantarIt 405 materi 1   pengantar
It 405 materi 1 pengantar
 
Using uml to model immune system
Using uml to model immune systemUsing uml to model immune system
Using uml to model immune system
 
Pascapositivisme
Pascapositivisme Pascapositivisme
Pascapositivisme
 

Recently uploaded

Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 

Recently uploaded (20)

Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 

It 405 materi 3 objek dan kelas

  • 1. IT 405: KPLBO Materi 4 Kelas dan Objek Ayi Purbasari, ST., MT. If-Unpas, 2014
  • 2. Outline • The advantages of an object-oriented approach to software development as compared with the “traditional” non-OO approach • How to use classes to specify an object’s data and behavior • How to create objects at run time • How to declare reference variables to refer to objects symbolically within a program • How objects keep track of one another in memory
  • 3. Software Software Data Function - that operate on (i.e., input, output, calculate, store, retrieve, print, etc.) that data.
  • 4. Pendekatan pembangunan Software Pendekatan Functional Decomposition OO Approach
  • 5. (top down) Functional Decomposition Fungsi Sub Fungsi Sub Fungsi
  • 6. Functional Decomposition Our primary focus was on the functions that an application was to perform; data was an afterthought. That is, • Data was passed around from one function to the next • Data structure thus had to be understood in many places (i.e., by many functions) • throughout an application. • If an application’s data structure had to change after the application was deployed, major “ripple effects” often arose throughout the application. • it was often very difficult to pinpoint precisely where—that is, in which specific function(s)—the error might have occurred, because the data had been passed from function to function so many times.
  • 7. OO Approach With OO software development, we focus on designing the application’s data structure first, and its functions second. Data is encapsulated inside of objects; thus, data structure has to be If an object’s data structure has to change after the application has been deployed, there are virtually no ripple effects; only the internal logic of the affected object must change. Each object is responsible for ensuring the integrity of its own data. Thus, if data integrity errors arise within a given object’s data, we can pretty much assume that it was the object itself that allowed this to happen, and we can therefore focus on that object’s internal functional logic to isolate the “bug.”
  • 8. WHAT IS AN OBJECT?
  • 9. What Is an Object? (1) something material that may be perceived by the senses; (2) something mental or physical toward which thought, feeling, or action is directed. physical objects conceptual objects
  • 10. What Is an Object? physical objects • The students who attend classes • The professors who teach the students • The classrooms in which class meetings take place • The audiovisual equipment in these classrooms • The buildings in which the classrooms are located • The textbooks students use conceptual objects • The courses that students attend • The departments that faculty work for • The degrees that students receive
  • 11. A software object • bundles state (data) and behavior (functions).
  • 12. State/Data/Attributes • The student’s name • His or her student ID number • The student’s birth date • His or her address • The student’s designated major field of study • His or her cumulative grade point average (i.e., the student’s GPA) • Who the student’s faculty advisor is • A list of the courses that the student is currently enrolled in this semester (i.e., the student’s current course load ) Behavior/Operations/Methods • Enrolling in a course • Dropping a course • Designating a major field of study • Selecting a faculty advisor • Telling us his or her GPA • Telling us whether or not he or she has taken a particular course, and if so, when the course was taken, which professor taught it, and what grade the student received
  • 13. When we talk about software objects specifically, we define an object’s behaviors, also known as its operations, as both the things that an object does to access its attribute values (data) and the things that an object does to modify/maintain its attribute values (data).
  • 14. What Is a Class? A class is an abstraction describing the common features of all objects in a group of similar objects.
  • 15. Attribute Type • name String • studentId String • birthDate Date • address String • major String • gpa double • advisor ??? • courseLoad ??? • transcript ??? Method • registerForCourse • dropCourse • chooseMajor • changeAdvisor • printTranscript
  • 16. A Note Regarding Naming Conventions Naming Classes • uppercase letter, but use mixed case for the name overall • Student, Course, Professor, and so on. • multiword phrase, we start each word with a capital letter, and concatenate the words without using spaces, dashes, or underscores to sepa- rate them • CourseCatalog.(This style is known as Pascal casing). Attibute and Method Names • lowercase letter, but to capitalize the first letter of any subsequent words in the name • Typical attribute names might thus be name, studentId, or courseLoad, • Typical method names might thus be registerForCourse and printTranscript.
  • 17. Declaring a Class, Java Style public class Student { // Attribute declarations typically appear first in a class declaration ... String name; String studentId; Date birthDate; String address; String major; double gpa; // type? advisor – we'll declare this attribute in earnest later! // type? courseLoad - ditto // type? transcript - ditto // ... followed by method declarations (details omitted – you'll // learn how to program methods in Java in Chapter 4.) }
  • 18. Classes may thus be differentiated from objects Class Object
  • 19. Classes may thus be differentiated from objects Class: • A class defines the features—attributes, methods—that every object belonging to the class must possess; a class can thus be thought of as serving as an object template Object Oriented: • An object, on the other hand, is a unique instance of a filled-in template for which attribute values have been provided, and upon which methods may be performed
  • 20. Instatiation • The term instantiation is used to refer to the process by which an object is created in mem- ory at run time based upon a class definition. • From a single class definition—for example, Student— we can create many objects with identical data structures and behaviors, in the same way that we use a single cookie cutter to make many cookies all of the same shape. • Another way to refer to an object, then, is as an instance of a particular class—for example, “A Student object is an instance of the Student class.” • ( We’ll talk about the physical process of instantiating objects as it occurs in Java in a bit more detail later in this chapter.)