Agenda
Komunikasi Antar Modul
Modul Kohesi
Modul Kopling
kekuatan
tingkat
MATERI BELAJAR
MATERI BELAJAR
Cakupan variabel :
bagian dalam sebuah program
tempat variabel didefinisikan dan dapat
direferensikan.
1.Global data
- digunakan : semua modul dlm 1
program
- Jangkauan : semua program
- Lifetime : selama eksekusi program
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
Status
parameter
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
MATERI BELAJAR
Modul Kohesi
- Modul : melakukan satu fungsi, terdiri dari 1
entry, 1 exit dan nama modul yang
mencerminkan fungsinya.
- Kohesi : tolak ukur kekuatan internal dalam
modul .
- Semakin dekat element dalam modul maka
semakin tinggi tingkat kohesi.
- Modul dengan kohesi tinggi adalah modul
yang baik.
MATERI BELAJAR
Modul Kohesi
MATERI BELAJAR
Functional Cohesion
- Functional Cohesion terjadi ketika semua
element berkontribusi mengerjakan suatu
tugas khusus.
Calculate_sales_tax
IF product is sales tax exempt THEN
sales__tax = 0
ELSE
IF product_price < $ 50.00 THEN
sales_tax = product_price * 0.25
ELSE
IF product_price < $100.00 THEN
sales_tax = product_price * 0.35
ELSE
sales_tax = product_price * 0.5
ENDIF
ENDIF
ENDIF
END
MATERI BELAJAR
Sequential Cohesion
- Sequential Cohesion terjadi ketika sebuah
modul terdiri dari elemen elemen yang
tergantung pada proses elemen
sebelumnya
Process_purchases
set total_purchases to zero
prompt and get number_of_purchases
DO loop_index = 1 to number_of_purchases
prompt and get pruchase
add purchase to total_purchases
ENDDO
sales_tax = total_purchases*sales_tax_percent
amount_due = total_purchases + sales_tax
END
MATERI BELAJAR
Communicational Cohesion
- Communicational Cohesion terjadi ketika
sebuah modul dikelompokan bersama
karena menggunakan data yang sama.
validate_product_record
IF transaction_type NOT=0 THEN
error_flag = true
error_message = invalid transaction type
print_error_report
ENDIF
IF customer_number is NOT= numeric THEN
error_flag = true
error_message = invalid customer number
print_error_report
ENDIF
IF product_no = blanks OR produc_no has leading blanks THEN
error_flag = true
error_message = invalid product no
print_error_report
ENDIF
END
MATERI BELAJAR
Procedural Cohesion
- Procedural Cohesion terjadi ketika elemenelement dalam sebuah modul saling terkait
karena dijalankan berdasarkan prosedur.
Contoh : Mainline
Read_student_record_and_total_student_ages
set number_of_records to zero
set total_age to zero
read student record
DOWHILE more records exist
add age to total_age
add 1 to number_of_records
ENDDO
print number_of_records, total_age
END
MATERI BELAJAR
Temporal Cohesion
- Temporal Cohesion terjadi ketika elemen
elemen dalam sebuah modul dikelompokan
bersama karena terkait dengan waktu.
Initialisation
Open transaction file
Issue Prompt enter todays date DDMMYY
Read todays_date
Set transaction_count to zero
Read transaction record
IF not EOF
increment transaction_count
ENDIF
Open report file
Print_page_headings
Set report_total to zero
END
MATERI BELAJAR
Logical Cohesion
- Logical Cohesion terjadi ketika elemen
elemen dalam sebuah modul dikelompokan
bersama berdasarkan pada aktivity tertentu.
Read_all_files(file_code)
CASE of file_code
1
: Read customer transaction record
IF not EOF
increment customer_transaction_count
ENDIF
2
: Read customer master record
IF NOT EOF
increment customer_master_count
ENDIF
3
: Read product master record
IF NOT EOF
increment product_master_count
ENDIF
ENDCASE
END
MATERI BELAJAR
Coincidental Cohesion
- Coincidental Cohesion terjadi ketika elemen
elemen dalam sebuah modul
dikelompokan bersama hanya karena
dalam satu modul. Tidak ada hubungan
yang berarti
File_processing
open employee updates file
read employee record
print_page_heading
open employee master file
set page_count to one
set error_flag to false
END
MATERI BELAJAR
Modul Coupling
MATERI BELAJAR
Modul Coupling
MATERI BELAJAR
Data Coupling
- Data Coupling terjadi ketika sebuah modul
mengirimkan variabel non global ke modul
lain.
Module A
Elementary data
item
Module B
MATERI BELAJAR
Data Coupling
Contoh:
A. Process_customer_record
calculate_sales_tax(total_price, sales_tax)
B. Calculate_sales_tax
IF total_price > 5000 THEN
sales_tax = total_price * 0.25
Else
If total_price > 4000 THEN
sales_tax = total_price * 0.2
Else
sales_tax = total_price * 0.15
ENDIF
ENDIF
END
MATERI BELAJAR
Stamp Coupling
- Stamp Coupling terjadi ketika sebuah modul
mengirimkan struktur data non global ke
modul lain.
Module A
Data Structure
Module B
MATERI BELAJAR
Stamp Coupling
Contoh:
Process_transaction_record
.
process_male_student (current_record)
END
Proses_male_student (current_record)
increment male_student_count (current_record)
If student_age > 21 THEN
increment_mature_male_count
ENDIF
.
.
END
MATERI BELAJAR
Control Coupling
- Control Coupling terjadi ketika sebuah
modul mengirimkan variabel kontrol untuk
mengontrol logika modul lain
Module A
Flag
Module B
MATERI BELAJAR
Control Coupling
Contoh:
Process_input_code
read input_code
choose_appropriate_action (input_code)
END
Choose_appropriate_action (input_code)
CASE OF input_code
1 : read employee record
2 : print_page_heading
3 : open employee master file
4 : set page_count to zero
5 : error_message =Employee number not numeric
ENDCASE
END
MATERI BELAJAR
External Coupling
- External Coupling terjadi ketika dua atau
lebih modul mengakses variabel global
yang sama.
Global Data
variabel
Module A
Module B
MATERI BELAJAR
External Coupling
Contoh:
Calculate_sales_tax
IF product is sales exempt THEN
sales_tax = 0
ELSE
IF product_price < $50 THEN
sales_tax = sales_price * 0.25
.
ENDIF
ENDIF
Calculate_amount_due
END
MATERI BELAJAR
Common Coupling
- Common Coupling terjadi ketika dua atau
lebih modul mengakses struktur data global
yang sama.
Global Data
Structure
Module A
Module B
MATERI BELAJAR
Common Coupling
Contoh:
Read_customer_record
read customer record
IF EOF THEN
set EOF_flag to true
ENDIF
END
Validate_customer_record
IF customer_number is NOT numeric THEN
error_message = invalid customer number
print_error_report
ENDIF
.
END
MATERI BELAJAR
Q & A