Vous êtes sur la page 1sur 7

Structured/Procedural vs Object Oriented

Reff :
Lloseng, OOSE, Chapter 2 Review of Object
Orientation
Differences
Procedural paradigm:
• Software is organized around the notion of procedures
• Procedural abstraction
—Works as long as the data is simple
• Adding data abstractions
—Groups together the pieces of data that describe
some entity
—Helps reduce the system’s complexity.
- Such as Records and structures

Object oriented paradigm:


• Organizing procedural abstractions in the context of data
abstractions
© Lethbridge/Laganière 2005 Chapter 2: Review of Object Orientation 2
Object Oriented paradigm
An approach to the solution of problems in which all
computations are performed in the context of objects.

• The objects are instances of classes, which:


—are data abstractions
—contain procedural abstractions that operate on the
objects

• A running program can be seen as a collection of objects


collaborating to perform a given task

© Lethbridge/Laganière 2005 Chapter 2: Review of Object Orientation 3


A View of the Two paradigms

OBJECT Oriented
Procedural/Structured Oriented
© Lethbridge/Laganière 2005 Chapter 2: Review of Object Orientation 4
Procedural/Structured Oriented OBJECT Oriented
Berangkat dari pengamatan terhadap Sama
proses bisnis (bagaimana transaksi
bisnis dilakukan) atau pengamatan
terhadap cara kerja sistem hardware.
Fokus pada “pemrosesan data”, Fokus pada “object”,
procedure/fungsi apa saja yang (class) object apa saja yang dibutuhkan
dibutuhkan di dalam sistem di dalam sistem
Data terpisah dari prosedur/fungsi Prosedur/fungsi “disatukan” dengan
data yang diolah
Memperhatikan aliran data dari Memperhatikan interaksi antar object
“sumber data”, ke suatu “pemrosesan dalam class-class yang berbeda untuk
data”, kemudian ke “penyimpanan berkolaborasi mendukung kebutuhan
data” atau pemberian informasi ke (use case) pengguna (actor)
“pemakai informasi”
Pemodelan : Flowchart, DFD, ERD, Pemodelan : UML (Activity Diagram,
dsb Use Case Diagram, Class Diagram,dll)

© Lethbridge/Laganière 2005 Chapter 2: Review of Object Orientation 5


Procedural/Structured Oriented OBJECT Oriented
Aplikasi dikembangkan dengan bahasa Aplikasi dikembangkan dengan bahasa
pemrograman procedural : Pascal, C, pemrograman OO : C++, Java, C#,
Cobol, PHP versi awal, dsb PHP 5, dsb
Tingkat akses data : Data di sebuah class dapat ditandai :
- global (oleh seluruh file program) public : Any class can access
- file (hanya file program tsb) protected : Only code in the
- procedure (hanya di procedure tsb) package,
or subclasses can access
(blank) : Only code in the package can
access
private : Only code written in the
class can access
Prosedur/fungsi dapat diakses dari Mirip dengan data, dapat ditandai :
seluruh file program public, protected, (blank), private

© Lethbridge/Laganière 2005 Chapter 2: Review of Object Orientation 6


Bahasa Procedural (Mis : Pascal) Bahasa OO (Mis : Java)
program ExProcedure; public class ExMethod {
var a, b, min: integer;
public static int findMin(int n1, int n2)
procedure findMin(x, y: integer; var {
m: integer); int min;
begin if (n1 > n2) min = n2; else min = n1;
if x < y then m:= x else m:= y; return min;
end; }

begin {main} public static void main(String[] args) {


a:=11; int a = 11;
b:=6; int b = 6;
findMin(a, b, min); int c = findMin(a, b);
writeln(' Minimum: ', min); System.out.println("Minimum Value =
end. " + c);
}
}

© Lethbridge/Laganière 2005 Chapter 2: Review of Object Orientation 7

Vous aimerez peut-être aussi