STUDI PEMBANGUNAN FRAMEWORK BERORIENTASI OBJEK STUDI KASUS PEMBANGUNAN FRAMEWORK PENJADWALAN
TESIS Karya tulis sebagai salah satu syarat untuk memperoleh gelar Magister dari Institut Teknologi Bandung
Oleh
NUR AFIF NIM: 23506030 (Program Studi Rekayasa Perangkat Lunak)
INSTITUT TEKNOLOGI BANDUNG 2009
i
ABSTRAK STUDI PEMBANGUNAN FRAMEWORK BERORIENTASI OBJEK STUDI KASUS PEMBANGUNAN FRAMEWORK PENJADWALAN Oleh Nur Afif NIM: 23506030 Sebuah framework dapat diartikan sebagai aplikasi “setengah jadi” yang dapat digunaulang dan dapat dikhususkan untuk menghasilkan bermacam-macam aplikasi dalam sebuah domain tertentu Tesis ini mengajukan sebuah metode yang dapat digunakan untuk mengembangkan sebuah framework berorietasi objek. Metode yang diajukan yaitu menggabungkan rekayasa domain (domain engineering) dan pengembangan framework dituntun hot-spot (hot-spot driven). Rekayasa domain ditujukan untuk pembangunan keluarga sistem (family of system) dalam suatu domain karena itu framework cocok dikembangkan dengan rekayasa domain. Tesis ini juga mengemukakan studi kakas-kakas yang digunakan dalam rekayasa domain seperti pemodelan fitur (feature modelling) dan bahasa spesifik domain (DSL – Domain Specific Language). Metode yang diajukan juga menggunakan pengembangan framework dituntun hot-spot untuk mengedintifikasi hot-spot dan frozen spot pada framework dengan menggunakan kakas-kakas seperti kartu hot-spot dan prinsipprinsip konstruksi framework (FCP – Framework Construction Principle). Studi kasus yang diambil dalam tesis ini untuk menerapkan metode yang diajukan adalah domain penjadwalan (scheduling). Penjadwalan diambil sebagai contoh kasus karena penjadwalan adalah cabang ilmu yang telah terdefinisi dengan bagus dan memiliki banyak literatur sehingga lebih mudah untuk memahami domainnya. Selain itu penjadwalan juga memiliki titik-titik keberagaman sehingga cocok untuk diaplikasikan kedalam framework. Sebuah framework harus dirancang dan diimplementasikan untuk digunakan sefleksibel mungkin. Karena itu implementasi framework memerlukan teknik-teknik khusus. Tesis ini juga mengemukakan teknik-teknik implementasi untuk framework.seperti metaprogramming dan bytecode manipulation. Kontribusi tesis ini adalah mengajukan metode pengembangan framework berorientasi objek dengan menggabungkan metode dan kakas seperti yang tersebut diatas, sehingga pembangunan framework untuk sebuah domain menjadi lebih mudah dan terstruktur. Kata kunci : gunaulang, rekayasa domain, hot-spot, frozen-spot, penjadwalan, fleksibilitas. i
ABSTRACT STUDY OF OBJECT-ORIENTED FRAMEWORK DEVELOPMENT CASE STUDY SCHEDULING FRAMEWORK DEVELOPMENT By Nur Afif NIM: 23506030 A framework can be defined as a “semi-complete” appication which can be reuse and specialized to produce many application in a specific domain. This thesis propose a method that can be used to developing an object oriented framework. This method combines domain engineering and hot-spot driven framework development. Domain engineering is aimed to develop family of system in a domain, which is also suitable to developing framework. This thesis also presents study about tools used in domain engineering such as feature modeling and domain specific language (DSL). The proposed method also using hot-spot driven framework development to identify hot-spots and frozen-spots of the framework by using tools such as hot-spot card and framework construction principle (FCP). Chosen case study for implementing the proposed method is scheduling domain. Scheduling was chosen because scheduling is a well-defined science and has many literature so is relatively easy to understands the domain. Scheduling also has many variety spots which is suitable to be implements as framework. A framework must be designed and implemented to use as flexible as possible. So to implements a framework, special techniques is needed. This thesis also presents implementation techniques for framework such as metaprogramming and bytecode manipulation. Contribution of this thesis is to propose a method for developing an objectoriented framework by combining methods and tools as mentioned above so we can develop object-oriented framewok for a domain, easier and in a structured way. Keyword: reuse, domain engineering, hot-spot, frozen-spot, scheduling,flexibility.
ii
HALAMAN PENGESAHAN STUDI PEMBANGUNAN FRAMEWORK BERORIENTASI OBJEK STUDI KASUS PEMBANGUNAN FRAMEWORK PENJADWALAN
Oleh
Nur Afif NIM: 23506030 (Program Studi Rekayasa Perangkat Lunak) Institut Teknologi Bandung
Menyetujui Pembimbing Tanggal …………………………..
Dr. Ing. M. Sukrisno Mardiyanto NIP. 130 938 170
iii
PEDOMAN PENGGUNAAN TESIS Tesis S2 yang tidak dipublikasikan terdaftar dan tersedia di Perpustakaan Institut Teknologi Bandung, dan terbuka untuk umum dengan ketentuan bahwa hak cipta ada pada pengarang dengan mengikuti aturan HaKI yang berlaku di Institut Teknologi Bandung. Referensi kepustakaan diperkenankan dicatat, tetapi pengutipan atau peringkasan hanya dapat dilakukan seizin pengarang dan harus disertai dengan kebiasaan ilmiah untuk menyebutkan sumbernya. Memperbanyak atau menerbitkan sebagian atau seluruh tesis haruslah seizin Dekan Sekolah Pasca Sarjana, Institut Teknologi Bandung.
iv
Untuk Bapak dan Mama juga Chica dan Zhilmi dan juga untuk Jannia “the one among all zeroes”
v
KATA PENGANTAR Bismillahirahmanirrahim, pertama-tama penulis mengucapkan puji syukur kehadirat ALLAH SWT atas limpahan rahmat dan karunia-NYA sehingga penulis dapat menyelesaikan tesis ini, dan juga penulis mengucapkan sholawat dan salam kepada Nabi Muhammad SAW yang telah membawa cahaya kedalam seluruh alam semesta. Penulis sangat berterima kasih atas bimbingan, saran, kritik, serta nasehatnya kepada Dr. Ing. M. Sukrisno Mardiyanto selaku pembimbing dalam pengerjaan tesis ini. Penulis juga mengucapkan terima kasih kepada Dr. Ir. Bambang Hariyanto, ST., MT. atas segala saran dan kritiknya, juga kepada Yani Widyani, S.T., M.T. selaku penguji proposal, seminar dan pra-sidang atas masukan-masukannya. Serta kepada Achmad Imam K. S.T., M.Sc., Ph.D. dan Bugi Wibowo, S.T., M.T. atas kesediannya sebagai penguji dalam sidang tesis ini dan atas masukanmasukannya. Penulis juga mengucapkan terima kasih Ir. Hira Laksmiwati, M.Sc selaku wali akademik dan juga rekan-rekan S2 RPL 2006 yang telah memberikan dorongan dan semagat dalam pengerjaan tesis ini.
vi
DAFTAR ISI ABSTRAK .............................................................................................................. i ABSTRACT ........................................................................................................... ii HALAMAN PENGESAHAN............................................................................... iii PEDOMAN PENGGUNAAN TESIS .................................................................. iv KATA PENGANTAR .......................................................................................... vi DAFTAR ISI ......................................................................................................... vii DAFTAR LAMPIRAN ......................................................................................... ix DAFTAR GAMBAR ............................................................................................. x DAFTAR TABEL ............................................................................................... xiv DAFTAR SINGKATAN .................................................................................... xvi DAFTAR ISTILAH ............................................................................................xvii Bab I Pendahuluan ................................................................................................. 1 I.1 Latar Belakang ....................................................................................... 1 I.2 Rumusan Masalah .................................................................................. 2 I.3 Tujuan Tesis ........................................................................................... 2 I.4 Ruang Lingkup dan Batasan .................................................................. 3 I.5 Metodologi ............................................................................................. 3 Bab II Landasan Teori ............................................................................................. 4 II.1 Rekayasa Domain ................................................................................. 4 II.1.1 Analisis Domain ......................................................................... 5 II.1.2 Perancangan Domain .................................................................. 6 II.1.3 Implementasi Domain ................................................................ 7 II.2 Pemodelan Fitur .................................................................................... 7 II.2.1 Model Fitur ................................................................................. 9 II.2.2 Diagram Fitur ........................................................................... 10 II.2.3 Kesamaan Dan Keberagaman ................................................... 13 II.3 Framework Berorientasi Objek (Object Oriented Framework) ....................................................................................... 14 II.3.1 Prinsip-prinsip Konstruksi Framework .................................... 16 II.3.2 Pengembangan Framework Dengan Hot Spot Driven ............. 19
vii
II.4 Deskripsi Sistem Penjadwalan ........................................................... 22 II.4.1 Teori Penjadwalan .................................................................... 22 II.4.2 Notasi-notasi Penjadwalan ....................................................... 24 Bab III Usulan Metode Dan Rekayasa Domain Penjadwalan .............................. 27 III.1 Usulan Metode Pengembangan Framework .................................... 27 III.2 Rekayasa Domain Penjadwalan ...................................................... 29 III.2.1 Analisis Domain .................................................................. 29 III.2.2 Perancangan Domain ........................................................... 40 III.2.2.1 Identifikasi Hot-spot ............................................. 40 III.2.2.2 Perancangan Framework....................................... 45 III.2.2.2.1 Perancangan Frozen-Spot .................... 46 III.2.2.2.2 Perancangan Hot-Spot.......................... 48 III.2.2.3 DSL Penjadwalan .................................................. 59 III.3 Teknik Implementasi ........................................................................ 62 III.3.1 XML dan XML Schema ...................................................... 62 III.3.2 Metaprogramming ............................................................... 63 III.3.3 Bytecode manipulation ........................................................ 64 Bab IV Implementasi Domain .............................................................................. 66 IV.1 Lingkungan Implementasi................................................................ 66 IV.2 Implementasi Frozen-spot dan Hot-spot .......................................... 66 IV.3 Implementasi DSL .......................................................................... 72 IV.4 Implementasi Komponen-komponen Implementer ......................... 74 Bab V Penutup ...................................................................................................... 77 IV.1 Kesimpulan ...................................................................................... 77 IV.2 Saran................................................................................................. 78 DAFTAR PUSTAKA ........................................................................................... 79
viii
DAFTAR LAMPIRAN Lampiran A ........................................................................................................... 80 Lampiran B .........................................................................................................121 Lampiran C .........................................................................................................137
ix
DAFTAR GAMBAR
Gambar II.1 Rekayasa Domain [1] ......................................................................... 5 Gambar II.2 Pemodelan Fitur [3] ............................................................................ 9 Gambar II.3 Diagram Fitur ................................................................................... 11 Gambar II.4 Diagram Fitur dengan fitur mandatory............................................. 12 Gambar II.5 Diagram Fitur dengan fitur optional................................................. 12 Gambar II.6 Diagram Fitur dengan fitur alternatif................................................ 13 Gambar II.7 Diagram Fitur dengan fitur or .......................................................... 13 Gambar II.8 Arsitektur Framework [4]................................................................. 16 Gambar II.9 Konsep Template-Hook [5] .............................................................. 17 Gambar II.10 Diagram Kelas FCP [5] .................................................................. 18 Gambar II.11 Proses Pengembangan Hot-Spot Driven [4] ................................... 20 Gambar II.12 Kartu Hot-Spot [4] .......................................................................... 21 Gambar III.1 Usulan metode pembangunan framework ....................................... 27 Gambar III.2 Diagram fitur Job ............................................................................ 30 Gambar III.3 Diagram fitur Alpha ........................................................................ 33 Gambar III.4 Diagram fitur Beta........................................................................... 34 Gambar III.5 Diagram fitur Gamma ..................................................................... 35 Gambar III.6 Diagram fitur Algoritma.................................................................. 38 Gambar III.7 Diagram fitur Sequencer ................................................................. 39 Gambar III.8 Kartu hot-spot Job ........................................................................... 41 Gambar III.9 Kartu hot-spot Operation................................................................. 41 Gambar III.10 Kartu hot-spot Alpha ..................................................................... 42 Gambar III.11 Kartu hot-spot Beta ....................................................................... 42 Gambar III.12 Kartu hot-spot Gamma .................................................................. 43 Gambar III.13 Kartu hot-spot Precedence ............................................................ 43 Gambar III.14 Kartu hot-spot Batch ..................................................................... 44 Gambar III.15 Kartu hot-spot Batch Element ....................................................... 44 Gambar III.16 Kartu hot-spot Algoritma .............................................................. 45 Gambar III.17 Kartu hot-spot Sequencer .............................................................. 45
x
Gambar III.18 Diagram Kelas Frozen-Spot .......................................................... 47 Gambar III.19 Diagram Sequence Frozen-Spot .................................................... 49 Gambar III.20 Diagram Kelas Job ........................................................................ 51 Gambar III.21 Diagram Kelas Operation .............................................................. 52 Gambar III.22 Diagram Kelas Alpha .................................................................... 52 Gambar III.23 Diagram Kelas Beta ...................................................................... 53 Gambar III.24 Diagram Kelas Gamma ................................................................. 54 Gambar III.25 Diagram Kelas Precedence............................................................ 55 Gambar III.26 Diagram Kelas Batch .................................................................... 56 Gambar III.27 Diagram Kelas Batch Element ...................................................... 57 Gambar III.28 Diagram Kelas Algoritma ............................................................. 58 Gambar III.29 Diagram Kelas Sequencer ............................................................. 58 Gambar III.30 DSL Penjadwalan .......................................................................... 62 Gambar IV.1 Header XML schema penjadwalan................................................. 72 Gambar IV.2 Elemen XML schema scheduling............................................. 72 Gambar IV.3 Implementasi XML elemen scheduling ................................... 73 Gambar IV.4 Elemen XML schema job ............................................................. 73 Gambar IV.5 Implementasi XML elemen job .................................................... 74 Gambar A.1 Interface Job ..................................................................................... 80 Gambar A.2 Interface MonoOperationJob ........................................................... 80 Gambar A.3 Implementasi Interface MonoOperationJob..................................... 81 Gambar A.4 Interface MultiOperationJob ............................................................ 81 Gambar A.5 Implementasi Interface MultiOperationJob ..................................... 81 Gambar A.6 Interface Operation........................................................................... 82 Gambar A.7 Implementasi Interface Operation .................................................... 83 Gambar A.8 Penggunaan Kelas DefaultOperation ............................................... 83 Gambar A.9 Interface Alpha ................................................................................. 84 Gambar A.10 Implementasi Interface Alpha ........................................................ 85 Gambar A.11 Interface Beta ................................................................................. 86 Gambar A.12 Implementasi Interface Beta .......................................................... 86 Gambar A.13 Interface Precedence ...................................................................... 87 Gambar A.14 Implementasi Interface Precedence................................................ 87
xi
Gambar A.15 Interface Batch ............................................................................... 88 Gambar A.16 Implementasi Interface Batch ........................................................ 89 Gambar A.17 Interface BatchElement .................................................................. 90 Gambar A.18 Implementasi Interface BatchElement ........................................... 90 Gambar A.19 Penggunaan DefaultBatchElement ................................................. 90 Gambar A.20 Interface Gamma ............................................................................ 91 Gambar A.21 Implementasi Interface Gamma ..................................................... 92 Gambar A.22 Interface Algortihm ........................................................................ 94 Gambar A.23 Implementasi Interface Algortihm ................................................. 94 Gambar A.24 Interface Sequencer ........................................................................ 95 Gambar A.25 Implementasi Interface Sequencer ................................................. 96 Gambar A.26 Elemen DSL Job Dengan Kelas ..................................................... 97 Gambar A.26 Elemen DSL Job Tanpa Kelas........................................................ 97 Gambar A.27 Elemen DSL Operation Dengan Kelas ........................................... 98 Gambar A.28 Elemen DSL Operation Tanpa Kelas ............................................. 98 Gambar A.29 Elemen DSL Alpha Dengan Kelas ................................................. 99 Gambar A.30 Elemen DSL Alpha Tanpa Kelas ................................................. 100 Gambar A.31 Elemen DSL Beta Dengan Kelas ................................................. 101 Gambar A.32 Elemen DSL Beta Tanpa Kelas .................................................... 101 Gambar A.33 Elemen DSL Precedence Dengan Kelas ...................................... 102 Gambar A.34 Elemen DSL Precedence Tanpa Kelas ......................................... 102 Gambar A.35 Elemen DSL Batch Dengan Kelas ............................................... 104 Gambar A.36 Elemen DSL Batch Tanpa Kelas .................................................. 104 Gambar A.37 Elemen DSL BatchElement Dengan Kelas .................................. 105 Gambar A.38 Elemen DSL BatchElement Tanpa Kelas .................................... 105 Gambar A.39 Elemen DSL Gamma Dengan Kelas ............................................ 106 Gambar A.40 Elemen DSL Gamma Tanpa Kelas .............................................. 107 Gambar A.41 Elemen DSL Algortihm Dengan Kelas ........................................ 109 Gambar A.42 Elemen DSL Algortihm Tanpa Kelas .......................................... 109 Gambar A.43 Elemen DSL Sequencer Tanpa Kelas .......................................... 110 Gambar A.44 Elemen DSL Sequencer Tanpa Kelas .......................................... 110 Gambar A.45 Kelas Context ............................................................................... 111
xii
Gambar A.46 Penggunaan Kelas Context........................................................... 112 Gambar A.47 Diagram kelas sistem penjadwalan .............................................. 113 Gambar A.49 Implementasi Kelas CustomJob ................................................... 115 Gambar A.50 Implementasi Kelas CustomSequencer ........................................ 116 Gambar A.51 Implementasi Kelas CustomAlgortihm ........................................ 117 Gambar A.52 DSL framework ............................................................................ 118 Gambar A.53 DSL framework bagian Job .......................................................... 119 Gambar A.54 DSL framework bagian Gamma ................................................... 119 Gambar A.55 DSL framework bagian Algortihm ............................................... 119 Gambar A.56 DSL framework bagian Sequencer ............................................... 120 Gambar A.57 Contoh Penggunaan Framework .................................................. 120 Gambar C.1 Source code kelas DSLParser ......................................................... 141 Gambar C.1 Source code kelas Weaver .............................................................. 148
xiii
DAFTAR TABEL
Tabel II.1 Tabel notasi diagram fitur [1]............................................................... 10 Tabel II.2 Framework Construction Principles [5] .............................................. 17 Tabel II.3 Derajat fleksibilitas Hot-Spot [4] ......................................................... 21 Tabel III.1 Tabel Fitur Job .................................................................................... 29 Tabel III.2 Tabel fitur Model Penjadwalan Alpha ................................................ 32 Tabel III.3 Tabel fitur Model Penjadwalan Beta .................................................. 36 Tabel III.4 Tabel fitur Model Penjadwalan Gamma ............................................. 36 Tabel III.5 Tabel fitur Algoritma Penjadwalan ..................................................... 37 Tabel III.6 Tabel fitur Sequencer .......................................................................... 40 Tabel IV.1 Kelas-kelas implementasi framework ................................................. 67 Tabel IV.2 Tabel komponen-komponen implementer framework ........................ 74 Tabel A.1 Daftar method pada hot-spot Job.......................................................... 81 Tabel A.2 Daftar method pada hot-spot Operation ............................................... 83 Tabel A.3 Daftar method pada hot-spot Alpha ..................................................... 85 Tabel A.4 Daftar method pada hot-spot Beta ........................................................ 86 Tabel A.5 Daftar method pada hot-spot Precedence ............................................. 88 Tabel A.6 Daftar method pada hot-spot Bacth ...................................................... 89 Tabel A.7 Daftar method pada hot-spot Bacth Element ....................................... 90 Tabel A.8 Daftar method pada hot-spot Gamma .................................................. 92 Tabel A.9 Daftar method pada hot-spot Algorithm .............................................. 95 Tabel A.10 Daftar method pada hot-spot Sequencer ............................................ 96 Tabel A.11 Daftar elemen DSL Job ...................................................................... 97 Tabel A.12 Daftar elemen DSL Operation ........................................................... 98 Tabel A.13 Daftar elemen DSL Alpha................................................................ 100 Tabel A.14 Daftar elemen DSL Beta .................................................................. 101 Tabel A.15 Daftar elemen DSL Precedence ....................................................... 103 Tabel A.16 Daftar elemen DSL Batch ................................................................ 105 Tabel A.17 Daftar elemen DSL Batch ................................................................ 106 Tabel A.18 Daftar elemen DSL Gamma ............................................................. 107
xiv
Tabel A.19 Daftar elemen DSL Algortihm ......................................................... 109 Tabel A.20 Daftar elemen DSL Sequencer ......................................................... 111
xv
DAFTAR SINGKATAN
SINGKATAN
Deskripsi
Pemakaian pertama pada halaman
CRC
Class-Responsibility-
19
Collaboration DE
Domain Engineering
DOM
Document Object Model
DSL
Domain Specific Language
FCP
Framework Construction
3 63 3 16
Principle IDE
Integrated Development
66
Environment JVM
Java Virtual Machine
64
OOAD
Object-Oriented Analysis and
19
Design SAX
Simple API for XML
63
UML
Unified Modeling Language
19
W3C
World Wide Web Consortium
63
XML
Extensible Markup Language
3
xvi
DAFTAR ISTILAH
Bahasa Asing/Inggris
Bahasa Indonesia
Pemakaian pertama pada halaman
Application engineering
Rekayasa aplikasi
5
Bytecode manipulation
Manipulasi bytecode
3
Design pattern
Pola rancangan
3
Domain analysis
Analisis domain
4
Domain design
Perancangan domain
4
Domain engineering
Rekayasa domain
3
Domain implementation
Implementasi domain
4
Domain specific language
Bahasa spesifik domain
3
Feature diagram
Diagram fitur
8
Feature model
Model fitur
6
Feature modeling
Pemodelan fitur
3
Framework construction principle
Prinsip konstruksi
Hook method
Metode hook
16
Hot-spot card
Kartu hot-spot
21
Hot-spot driven
Dituntun hot-spot
19
Template method
Metode template
16
Variation point
Titik variasi
14
16
framework
xvii