nav

       HOME    BINUS EVENT   HOW TO   KBP   THOUGHTS

About



Tuesday, June 2, 2015

Laporan Community Service Bimbel - 4

Nama: Helena Natanael
NIM: 1801380333
Hari/Tanggal: Kamis, 28 Mei 2015, Shift 2 (13.05 - 13.50)
Lokasi: SD Negeri Panunggangan 11, Jl. Kyai Maja, Kota Tangerang 15143.



Pada shift ini, kami masih membimbing murid-murid dalam mengerjakan soal hingga pukul 13.15, lalu mulai membahas 10 soal yang diberikan secara bergantian. Kami memberikan cara-cara cepat yang masih logis untuk membantu murid mengerjakan soal-soal matematika. Lalu kami memberikan hadiah berupa botol minum kepada 3 murid yang tercepat mengumpulkan jawaban, dengan syarat harus menuliskan cara dan jawabannya benar. 3 murid tersebut adalah Kareem, Syifa, dan Alvin.
Setelah itu kami membagikan snack astor untuk seluruh murid di kelas, sekaligus untuk perpisahan. Murid-murid menanyakan kapan kami kembali, mereka berkata ingin diajar kami lagi setelah mereka Ujian Akhir Semester. Kami hanya dapat berkata kami belum tahu kapan akan bertemu mereka lagi. Mereka terlihat cukup kehilangan dan mereka bertanya terus menerus kapan bisa bertemu kami lagi. Setelah berbagi snack astor, kami kembali membereskan kelas dan bersih-bersih.

Setelah itu kami berpamitan dengan Pak Wanta serta meminta berfoto dengan Pak Wanta untuk dokumentasi. Tidak lupa kami mengucapkan terima kasih banyak atas bantuannya dan mendoakan yang terbaik untuk kemajuan SD Negeri Panunggangan 11. Selesailah kegiatan Community Service kami selama 4 shift.



Kesan yang didapat setelah melakukan Kegiatan Community Service Bimbel:

-Daerah mewah Alam Sutera ternyata berdampingan dengan daerah kumuh. Hal ini memprihatinkan karena terdapat kesenjangan sosial pada satu wilayah yang sama. Kita harus membantu agar kehidupan masyarakat di daerah kumuh juga sejahtera.

-Jangan berpikiran negatif. Awalnya saya merasa tidak bisa mengajar anak-anak SD dan cukup kuatir bertemu mereka dan ditolak oleh mereka, ternyata sekarang saya malah sedih harus berpisah dengan mereka, karena mereka sudah dekat dengan saya dan menerima saya sebagai salah satu mentor mereka.

-Salah seorang anggota kelompok kami bercerita bahwa seorang murid yang ia lupa namanya bertanya kepada dia, "kak, kalian berlima itu sahabat ya?" Hal tersebut sungguh menyentuh hati saya. Saya tidak menyangka kedekatan antar anggota kelompok ini dirasakan juga oleh murid-murid. Mereka melihat keakraban kami dan kerjasama kami, Saya memang merasa nyaman bersama teman-teman saya di kelompok CB ini. Saya harap dengan mereka melihat keakraban kami, mereka mendapat contoh bagaimana berkoordinasi dengan teman-teman sebayanya dengan baik.

-Niat belajar murid-murid ini sangat tinggi, padahal waktu belajar sudah selesai namun mereka bilang "ah jamnya telat 15 menit itu kak, ayo kita lanjut belajar" padahal jam di kelas menunjukkan waktu yang tepat. Lalu mereka juga sudah belajar untuk semakin berani bertanya kepada kami jika ada yang mereka tidak mengerti. Saya harap mereka juga akan semakin berani bertanya kepada semua guru dan mentor, tidak hanya kepada kami.

-Jika semester mendatang saya mendapatkan kelas Character Building lagi dan terdapat pilihan bimbel, saya tertarik untuk kembali mengajar di SD Negeri Panunggangan 11 ini.

Laporan Community Service Bimbel - 3

Nama: Helena Natanael
NIM: 1801380333
Hari/Tanggal: Kamis, 28 Mei 2015, Shift 1 (12.20 - 13.05)
Lokasi: SD Negeri Panunggangan 11, Jl. Kyai Maja, Kota Tangerang 15143.



Pada kesempatan ini, kami semua sudah menyiapkan 10 soal dari rumah, dan sudah memfotokopinya untuk dibagikan ke 35 murid. 4 soal berkaitan dengan pecahan, 1 soal mengenai perkalian dalam soal cerita, 1 soal mengenai skala,  1 soal menggambar bangun ruang, 1 soal menghitung volume bangun ruang, 1 soal menggambar bidang, dan 1 soal menghitung luas bidang.

Kali ini kami masuk kelas setelah jam pulang, kami memberi waktu istirahat 20 menit untuk murid-murid sebelum mulai masuk kelas lagi. Murid-murid sangat antusias dengan kami, ketika bertemu kami di parkiran, mereka memanggil nama kami dan salim kepada kami. Saya juga sangat senang bertemu mereka dan mengetahui bahwa mereka tidak terbebani dengan model mengajar kami yang mungkin berbeda dengan gurunya. Karena kami masuk setelah jam pulang, kami tidak ingat waktu sehingga 1 shift mencapai 45 menit.

Pada metode pengajaran kami sesi ini, setelah membagikan soal, kami berlima menyebar ke meja-meja dan membantu bila murid kesulitan dalam mengerjakan soal. Sebagian besar murid masih bingung dengan mengubah bentuk pecahan biasa ke persen, penjumlahan desimal, dan skala. Untuk bangun ruang dan bangun datar mereka sudah mulai terbiasa mengerjakan sehingga dapat menjawab dengan benar.

wah ada yang bersantai di pintu ketika saya menjelaskan..... hahaha

Laporan Community Service Bimbel - 2

Nama: Helena Natanael
NIM: 1801380333
Hari/Tanggal: Selasa, 26 Mei 2015, Shift 2 (11.20 - 12.00)
Lokasi: SD Negeri Panunggangan 11, Jl. Kyai Maja, Kota Tangerang 15143.




Pada shift ke-2 ini, kami memberikan soal-soal yang berkaitan dengan volume bangun ruang yang telah kami ajarkan pada shift sebelumnya. Kami mencoba mengasah keberanian murid-murid dengan mempersilahkan yang mau mencoba mengerjakan untuk maju ke depan, mengerjakan soal langsung di papan tulis. Dari beberapa murid yang berani dan aktif, ada 2 diantaranya yang menonjol, saya sampai hapal namanya, yaitu Kareem dan Syifa. Kedua murid ini termasuk cepat menangkap pelajaran dan aktif di kelas. Berani bercanda dengan saya, namun masih menjaga sopan santun, mereka memanggil saya "Kak Helen". Saya menjadi sadar sekarang kenapa dosen senang dengan murid yang aktif dan cepat mengerti pelajaran, hahahaha. Setelah mempersilahkan mereka maju, kami membahas bersama soal bangun ruang tersebut dengan murid murid. Lalu, kami pun memberikan sebuah soal mengenai volume kubus yang harus dikerjakan semua murid di selembar kertas dan dikumpulkan sebelum pulang. Ada yang belum tahu rumus kubus, mungkin dia belum hapal, lalu ada juga yang masih bingung perkaliannya.



Setelah semua murid mengumpulkan, kami dan murid-murid bersama-sama membereskan kelas dan menyapu. Murid-murid diajarkan untuk menjaga kebersihan dan hal ini sangat baik diajarkan sejak di bangku sekolah dasar. Setelah bersih-bersih, murid-murid salim kepada kami, dan kami semua pun pulang. Setelah kegiatan bimbel ini, kami sekelompok masih ada kelas, sehingga sambil menunggu kelas kami makan dan mengecek hasil pekerjaan murid-murid. Sebagian besar sudah benar, dari 35 murid ada 5 orang yang salah jawabannya, 4 dari 5 orang tersebut kurang teliti dalam perkalian, dan 1 lainnya salah rumus. Hal ini membuat kami memutuskan untuk lebih memperhatikan 5 murid ini pada sesi selanjutnya dan kami memutuskan untuk melakukan review terhadap perkalian dan pembagian, agar murid-murid tidak salah lagi dalam melakukan perkalian dan pembagian. Kedua hal ini kami rasa sangat fundamental untuk pelajaran matematika di jenjang berikutnya.

Saya dan Kareem



Suasana kelas ketika kami sedang bersih-bersih

Laporan Community Service Bimbel - 1

Nama: Helena Natanael
NIM: 1801380333
Hari/Tanggal: Selasa, 26 Mei 2015, Shift 1 (10.45 - 11.20)
Lokasi: SD Negeri Panunggangan 11, Jl. Kyai Maja, Kota Tangerang 15143.



Pada semester lalu, saya dan teman-teman ditugaskan untuk menjadi duta kebersihan. Hal tersebut cukup mudah sehingga ketika semester ini dosen saya menyarankan kelas kami untuk mengadakan Bimbel, saya ragu untuk menjalankannya. Meski untuk Character Building pada semester ini tidak diwajibkan untuk community servicenya dan boleh memilih sendiri, namun dosen kami menganjurkan kami untuk tetap melakukan kegiatan community service dan melakukan bimbel karena lebih berdampak kepada masyarakat dibanding duta kebersihan.

Saya dan kelompok saya melakukan survei tempat pada minggu sebelumnya, setelah berkeliling Alam Sutera dan sekitarnya, kami memilih untuk mengadakan bimbel di SD Negeri Panunggangan 11, sekitar 1 km di luar Alam Sutera, tepatnya di Jl. Kyai Maja. Kami segera mengurus surat pengantar yang dibutuhkan oleh sekolah untuk mengadakan bimbel di sekolah tersebut. Ibu kepala sekolah menerima kami dengan sangat ramah dan sangat kooperatif, tidak menyulitkan kegiatan kami sama sekali. Untuk kegiatan mengajar kami, kami dibimbing oleh Pak Wanta, salah satu perwakilan guru dari SD Negeri Panunggangan 11. Kami dan pihak sekolah bersepakat bahwa kegiatan bimbel akan berlangsung selama 2x, masing-masing 2 shift pelajaran (1 shift pelajaran di SD tersebut adalah 35 menit). Awalnya kami ingin mengadakan selama 4 kali, namun hal tersebut cukup mengalami masalah karena bentrok dengan jadwal kelas kami dan jadwal Ujian Akhir Semester di SD tersebut.



Pada hari Selasa, 26 Mei 2015, kami datang ke SD pukul 10.00 untuk briefing dengan Pak Wanta. Pak Wanta menawarkan kami mengajar pelajaran matematika, IPA, atau bahasa Inggris, dan kami sekelompok memilih matematika. Kami harusnya mengajar setelah murid pulang sekolah, namun kebetulan ada guru yang berhalangan hadir sehingga pada pukul 10.45, kami masuk ke kelas untuk mengisi jam kosong tersebut. Kami masuk kelas dengan agak canggung dan memperkenalkan diri. Awalnya kelas juga masih agak diam dan masih "jaga image" terhadap kami. Namun setelah kami memberikan beberapa catatan berkaitan dengan Bangun Ruang (sifat-sifat bangun ruang), murid-murid di kelas mulai terbuka terhadap kami dan bercanda dengan kami. Pada shift ini kami mengajarkan sifat-sifat bangun ruang dan rumus volumenya (tabung, kubus, kerucut, limas).




Monday, April 6, 2015

Penjumlahan i++ + i++ + ++i + ++i


Pada bulan Oktober 2014 lalu, saya mendapat tugas dari dosen algoritma saya untuk penghitungan pre-increment dan post-increment. Lalu ketika saya browsing, masih banyak kebingungan dan keambiguan mengenai logika pre-increment dan post-increment di website-website maupun forum. Untuk pengertian secara harafiah, sudah benar, bahwa pre-increment menambahkan nilai sebelum melakukan proses sementara post-increment menambahkan nilai sesudah proses. Hal yang serupa juga berlaku pada pre-decrement dan post-decrement. Akan tetapi, saya cukup beruntung diajar oleh seorang dosen algoritma yang bisa dibilang ahli dalam programming DAN banyak maunya... nyebelin sih tapi saya sadar tugas itu berguna untuk menganalisa seberapa jauh pengertian mahasiswanya. Sayang sekali soal yang cukup menarik ini hampir tidak dapat saya temukan jawabannya di internet. Mungkin ada, di halaman terakhir google.. atau diantara halaman-halaman google... pokoknya jawabannya tidak saya temukan sejauh saya menelusuri halaman -halaman pencarian google berdasarkan batas kesabaran saya.. dan semua mahasiswa juga bingung, sampai akhirnya dosen kami pun "berbaik hati" menjelaskan di kelas.

Untuk compiler, kami menggunakan visual studio c++, dan menggunakan bahasa c. Untuk compiler lain mungkin akan berbeda hasilnya.

Soal:

#include<stdio.h>

int main(){
int i=1;

printf("%d", ++i + i++ + i++ + i++ + ++i + ++i + i++);
getchar();
return 0;
}


ketika dijalankan, hasilnya adalah 28. Pertanyaannya, darimanakah nilai i bisa menjadi 28???

Kalau saya search di internet, katanya sebenernya multi-increment seperti ini ga boleh dilakukan karena pada tiap compiler hasilnya bisa berbeda. Lalu ada juga pemikiran karena incrementnya ada 7 buah, jadi 28 itu berasal dari 7x4, jadi tiap nilai i dikali dengan 4. Banyak sekali teori dan hipotesa berlalu-lalang antar mahasiswa kelas algo saya. Mungkin benar, mungkin salah. Namun, untuk logika dalam compiler visual studio yang dijelaskan oleh dosen saya, kira-kira seperti ini cara pengerjaannya:

1. kumpulkan semua i++ ke kiri. total, ada 4 i++. Ingat, i++ adalah bentuk post-increment. Untuk ++i akan kita hitung kemudian, tinggalkan dulu saja ++i nya. Lalu agar tidak bingung, saya tetapkan: nilai eksplisit adalah nilai yang seharusnya berdasarkan definisinya, sedangkan nilai implisit adalah nilai yang menyimpang berdasarkan definisinya.


2. ada 2 nilai pada i, nilai implisit dan nilai eksplisit. Karena i adalah post increment, yaitu melakukan proses barulah menambahkan nilai, dan proses di sini adalah printf, jadi nilai eksplisit dari post-increment harusnya TIDAK BERUBAH dari nilai awal. Yang akan tercetak adalah nilai awal i itu sendiri, yaitu 1. Jadi, nilai eksplisitnya adalah 1 + 1 + 1 + 1 = 4. Kalau nilai awal i adalah 2, berarti nilai eksplisitnya 2 + 2 + 2 + 2 = 8.


diketahui : int i = 1
 
printf("%d", ++i  +  i++  +  i++  +  i++  +  ++i  +  ++i  +  i++);
                            1         1        1                           1        

nilai eksplisit post-increment i = 1 + 1 + 1 + 1 = 4                


Untuk nilai implisit, nilainya bertambah selalu tanpa memperhatikan itu adalah post-increment, jadi tiap menemukan i++, nilai i akan bertambah. Karena nilai awal i adalah 1, jadi nilai implisit i++ adalah 2 → 3 → 4 → 5. Tapi ini nilai implisit, jadi tidak dijumlah ya, yang diambil nilai akhirnya saja sebanyak jumlah i++, sehingga nilai implisit akhir adalah 5. Kalau jumlah i++ nya ada 7 dan nilai awal i adalah 1, berarti nilai implisit i adalah 2 → 3 → 4 → 5 → 6 → 7 → 8, nilai implisit i yang kita pegang adalah 8.


printf("%d", ++i  +  i++  +  i++  +  i++  +  ++i  +  ++i + i++);
                           1→2   2→3    3→4                     4→5        

nilai eksplisit post-increment i = 4 
nilai implisit post-increment i = 5    


3. Nah sekarang kita sudah punya nilai implisit i++ dan nilai eksplisit i++, mari berlanjut ke nilai implisit dan eksplisit ++i. Berbeda dari i++, ++i akan menggunakan nilai awal i dari hasil nilai implisit i++. Jadi nilai awal pada ++i dari soal ini adalah 5, bukan 1. 

Lalu sekarang kita masuk ke pre-increment dimana definisinya adalah melakukan pertambahan nilai sebelum melakukan proses, dan proses yang dimaksud pada soal ini adalah printf. Jadi nilai eksplisit di sini seharusnya SELALU BERTAMBAH TIAP MENEMUKAN ++i.

Mari kita lihat. ++i pada soal di atas, ada 3 buah. Berarti untuk nilai eksplisit ++i, mulai dari 5, menjadi 6 → 7 → 8. Nilai eksplisit akhir ++i adalah 8.

ingat: nilai implisit post-increment i = 5


printf("%d", ++i  +  i++  +  i++  +  i++  +  ++i  +  ++i + i++);
                 5→6                                  6→7   7→8       

nilai eksplisit pre-increment i = 8  



Lalu untuk nilai implisit, karena ++i ada 3 buah, maka memakai nilai eksplisit ++i dikali 3. Jadi nilai implisit ++i adalah 3 x 8 = 24.



ingat:
- nilai implisit post-increment i = 5
- nilai eksplisit pre-increment i = 8  


printf("%d", ++i  +  i++  +  i++  +  i++  +  ++i  +  ++i + i++);
                   8                                       8         8      

nilai implisit pre-increment i = 8 + 8 + 8 = 24  


4. Nilai akhir yang ditunjukkan oleh compiler berasal dari nilai eksplisit i++ ditambah nilai implisit ++i, yaitu 4 + 24, maka hasilnya 28. Nah kalau kamu masih belum begitu mengerti, coba ubah nilai int i=1 menjadi int i=2, jika kamu memakai visual studio c++, harusnya jawabannya adalah 35, berasal dari 8 + 27.


Kira-kira begitu hal yang dapat saya share kali ini, semoga tidak membuat kamu pusing dan bisa bermanfaat jika bertemu dosen sejenis dosen saya :)


Friday, April 3, 2015

Expect the Unexpected?

Oke, sepertinya hal ini harusnya tidak pernah ada dalam pikiran gw. Apalagi sampe gw tulis kayak gini. Tapi, gw sangat ingin menuliskan apa yang ada di otak gw ini. Dan untuk menulis uneg-uneg kayak gini di blog gw yang satu lagi, agaknya hanya membuat followers gw bingung wkwkw karena sebagian besar dari mereka gak ngerti bahasa indonesia. So, gw tulis di sini aja.


Semester 1 berjalan dengan cukup baik. Target gw dapet A di kalkulus dan programming bisa tercapai. IP harapan gw pun tercapai juga, meski gw tau papa gw expect lebih lagi, however I'm glad that he supports what I already choose, padahal jurusan pilihan gw ini gak ada dalam "darah" ortu gw, mereka keduanya bukan IT. Dan mereka udah peringatin dari awal, kalau gw harus hati-hati dalam ambil jurusan karena seem like they will not let me to re-sign up buat pindah jurusan just in case gw salah jurusan. I know that it's just a waste of money kalau gw sampe pindah jurusan, apalagi kampus gw bukan termasuk kampus murah. Memang, brand berpengaruh ke harga, dan branding kampus gw memang udah oke, jadi untuk harga segitu, well, I won't complain.


Gw masuk IT dengan mata bersinar dan full-spirit, ngerasa it will be so much fun to code and to get great result just by coding it. Tapi gw gak sadar bahwa coding yang "sebenernya", gak semudah html. Coding yang "sebenernya",  gak semenarik css dan php. Gw terlarut dalam euforia bahwa gw gak akan bertemu lagi sama yang namanya kimia dan biologi. Duo hapal-hapalan yang menghancurkan nilai rapot gw semasa SMA. Untuk biologi masih mendingan lah, gw masih bisa mengerti walaupun gw sangat mabok dalam hapalinnya. Tapi buat kimia.... white flag abis. Gw ga tau kenapa reaksi itu bisa terjadi, kenapa A hanya bisa bereaksi sama B tapi ga bereaksi sama C. Kenapa rantai C makin banyak, menunjukkan makin oktan suatu bensin dan makin bagus buat dipake? Kenapa Na dan Cl kalau dipisah adalah duo mematikan tapi kalau digabung bisa jadi garam dapur buat pelezat masakan. Hal-hal itu menarik, tapi ga masuk akal. Belum ada penjelasan yang bisa bikin gw mengerti sepenuhnya sama kimia.

Lalu, gw juga kemakan sama gengsi. Gw merasa rugi udah cape cape belajar IPA dan disiksa selama 2 tahun di SMA gw, ujung-ujungnya cuma masuk ekonomi. Di mana temen-temen gw yang cewe pun pada masuk teknik. Jadi... gw masuk teknik informatika. Cukup reasonable karena gw ada ketertarikan di web programming yang udah gw pelajari secara otodidak.

Gw masuk IT juga karena memikirkan pergaulan gw. Gw ga sanggup bergaul sama manusia ips. Sebagian besar manusia ips, menurut gw, gak mementingkan esensi belajar. Mereka dateng ke kampus cuma buat tebar pesona dan hang out, having a good time. Kalo males, mereka cabut. Sementara gw, kalo ke kampus ya jelas tujuannya buat belajar, itu nomer satunya, lalu hang out bareng temen ya prioritas ke sekian dan ga boleh mengganggu belajar. Gw merasa bakal terbawa arus kalau gw selama 4 tahun berada dalam lingkungan buruk kayak gitu. Atau, mungkin gw bakal tetap rajin belajar, namun gw bakal dicap geek dan jadi kurang diterima dalam pergaulan mereka. And that feel really sucks. I've experienced it.


Semua hal itu mengerucutkan pilihan kuliah gw untuk masuk IT.



Di semester 1, gw di nina-bobokan sama nilai nilai oke dan kemampuan gw dalam menangkap pelajaran. Kebetulan juga gw sangat beruntung, punya temen jenius yang sangat baik juga mau ngajarin gw, nge-handle banjir pertanyaan gw, dan membukakan logika gw. Dan di semester 2 ini, walaupun gw masih cukup pede dalam pelajaran, itu karena gw masih keep-in-touch sama temen jenius gw. Gw jadi mulai mikir apa jadinya gw tanpa dia, akankah gw masih bisa meraih nilai bagus? Gw merasa gw udah terlalu ketergantungan sama dia. Dan gak mandiri. Gw mau mulai menjauh dari dia, nyoba mengerti dan usaha sendiri, tapi agaknya hal itu belum bisa terjadi dalam waktu dekat.

Lalu ada dosen gw juga yang ngasih tugas sedikit di luar kemampuan muridnya, well, that's good to encourage us, tapi di sinilah gw melihat, dan merasa, IT bukan masa depan yang gw mau. Gw muak berkutat sama bahasa bahasa coding yang dapat berubah seiring waktu dan berubah seiring tren. Gw pada dasarnya adalah pemalas. Ya, gw malas untuk terus terusan menyesuaikan diri. Gw mau pada suatu titik di masa depan, gw diminta melakukan hal yang gw udah bisa dan ahli di situ, bukannya diminta belajar hal baru. Tapi kalau diterapin dalam kehidupan gw, malas gw ini bisa dibilang pendorong gw untuk rajin. Aneh ya? Gw juga ga ngerti kenapa bisa gitu. Gw malas sama SP. Makanya gw rajin belajar, biar liburan nanti bisa main cookie run sampe mual atau bisa buang buang waktu dengan jadi BC, bukannya belajar. Trus gw malas baca teori di rumah, mendingan kerjain yang lain yang ga bisa dikerjain di kampus, misalnya nonton tv atau ngebuka laptop, makanya pas di kampus gw mau bener bener dengerin penjelasan dosen.


Gw sangat berharap pandangan gw bahwa IT bukan masa depan yang gw mau, bakal berubah secepatnya. Mungkin gw hanya frustasi melihat bahasa baru yang gw ga ngerti cara pakenya dan diharuskan belajar demi nilai pelajaran A, dan ambisi jadi mentor. Dan gw juga berharap gw gak salah jurusan. Masih terlalu dini buat merasa salah jurusan. Kalaupun gw salah jurusan, gw bakal tetap tuntasin kuliah di jurusan ini sih.... meski pada akhirnya mungkin nanti gw ga bekerja di bidang IT.


Gw merasa jurusan di kuliah agak ga adil. Kalau kayak akun, ekonomi, mat, fisika, biologi gitu, udah dipelajarin dari SMA. Mahasiswa di jurusan itu, asal sekolah di sekolah tepat, bakal dapet ilmu dasar yang oke buat di kuliah, Tapi kalo IT? SMA biasa cuma ngajarin penggunaan microsoft office yang gunanya cuma buat bikin laporan/tugas. Bukan bener bener IT nya. Mungkin SMK baru ngajarin IT yang sebenernya. Tapi gw rasa itu juga timpang. Seandainya gw tahu lebih awal mengenai IT yang sebenernya, mungkin, mungkin aja, gw ikut kemauan ortu gw. Dan kalau skrg gw cerita ke ortu gw, gw gak mau bikin mereka merasa "tuh kan mama/papa udah bilang, makanya hrsnya kamu masuk jurusan xx aja". Lalu gw ngerasa ga ada temen yg tepat buat gw ceritain ini.... dan gw terkadang ngerasa lelah sama pikiran gw sendiri, di mana cuma saat tidur doang gw bisa nemu ketenangan. Ckckckc.


Monday, March 16, 2015

Run For Leprosy 2015


Run for Leprosy adalah acara pertama kali di Indonesia yang di dedikasikan secara khusus untuk rekan-rekan yang mengalami atau yang pernah mengalami kusta. Acara ini bertujuan untuk meningkatkan awareness masyarakat terhadap penyakit kusta. Awareness disini berupa pemberian dukungan baik moril maupun materil dan penghapusan stigma negatif serta diskriminasi yang sering dialami oleh rekan-rekan yang pernah atau sedang mengalami kusta. Hasil dari donasi acara ini 100% akan di berikan dan di gunakan untuk program pembinaan komunitas kusta dengan cakupan skala yang lebih besar lagi. Promotor acara ini adalah Bina Nusantara (Binus) University, Alam Sutera dan Teach for Indonesia (TFI). Kegiatan berlangsung 15 Maret 2015 dengan start line dan finish line di Kampus Binus University @ Alam Sutera. Jarak lari yang ditempuh oleh peserta Run for Leprosy terbagi menjadi dua, yaitu: 5k dan 10k dan berlangsung dari pukul 06.00 – 08.00.


Foto-foto keseruan #RunForLeprosy di Instagram:



Kesan dan Pesan sebagai Pelari:

Acara Run for Leprosy ini adalah kedua kalinya saya ikut kegiatan lari sejauh 5 km. Sebelumnya saya pernah mengikuti saat saya masih SMA, dan mengambil lokasi di Monas-Bundaran HI saat car free day Jakarta. Perbedaannya sangat terasa, untuk Run For Leprosy yang berlokasi di Alam Sutera, lebih nyaman dibanding lokasi saya dulu, udaranya lebih segar dan ruas jalannya lebih luas. Saya rasa Alam Sutera adalah tempat yang tepat untuk mengadakan event-event sejenis ini, karena memang Alam Sutera didesain untuk pengguna sepeda dan pejalan kaki. Saya mendaftar acara ini bersama teman-teman saya yang mencapai 13 orang, dan kami berlari bersama sama meski sempat terpisah di rute lari dikarenakan banyaknya peserta lari yang ikut. Saya menyelesaikan lari saya dalam waktu 1 jam 10 menit.

 


Saya sangat terkesan dengan charity event ini, meski harus mengeluarkan sejumlah uang, namun itu saya anggap sebagai donasi bagi kelanjutan komunitas penanggulangan kusta. Untuk jalannya kegiatan, saya sangat terkesan dengan para volunteer seusia saya yang sangat gigih dalam bertugas dan menyemangati kami para pelari. Lalu untuk pelayanan di water station, para volunteer sangat sigap sehingga kami tidak tertahan di water station. Saya juga kagum dengan rundown acara yang jelas, tidak seperti beberapa acara sejenis yang pernah saya ikuti, Run For Leprosy tidak ngaret dan selesai tepat waktu seperti di guide book yang saya dapat dari racepack.

Pesan saya untuk acara sejenis selanjutnya, mohon untuk ketersediaan baju lebih dipastikan lagi, karena saya dan teman-teman saya sudah mendaftar early bird, namun beberapa teman saya yang memesan baju ukuran XL malah tidak mendapatkannya, saya melihat mereka merasa tidak nyaman dengan baju ukuran L yang terpaksa mereka pakai. Hal ini cukup aneh karena saya pikir, kami sebagai pendaftar early bird yang sudah dicatat sejak lama sebelum event dimulai, harusnya sudah dipesankan baju sesuai yang kami pesan. Lain halnya apabila kami baru mendaftar di hari-hari terakhir sebelum pendaftaran ditutup.

Lalu, selama acara lari berlangsung, kami sebagai pelari tidak bisa sepenuhnya menggunakan badan jalan, karena kendaraan masih dapat melintas, dan para volunteer memperingatkan kami selalu untuk berada di pinggir jalan, jangan ke badan jalan. Untuk acara sejenis ini yang sebelumnya saya ikuti, seluruh badan jalan ditutup, hanya untuk pelari dan tidak boleh kendaraan masuk. Jadi saya cukup kecewa melihat kendaraan masih diperbolehkan melintas, bukankah sudah ada poster bertuliskan jalanan akan ditutup pukul 05.00-09.00 di beberapa titik masuk Alam Sutera? tetapi mengapa hal tersebut tidak diindahkan?







Pengetahuan tentang kusta:

Penyakit kusta atau lepra (leprosy) disebabkan oleh bakteri Mycobacterium Leprae, ditemukan oleh G.A. Hansen. Penyakit ini menyebabkan hilangnya fungsi saraf di anggota tubuh, membuat anggota tubuh tidak dapat berfungsi dengan baik, terkelupas, membusuk, bahkan dalam kasus yang parah dapat lepas dari tubuh. Penyakit ini berlangsung dalam jangka panjang. Diduga penyebarannya karena kontak dengan orang yang menderita kusta juga, sistem imun yang buruk, dan gizi serta lingkungan hidup yang buruk.


Komitmen baik terhadap kusta: 

1. Mengurangi makanan fast food, dan meningkatkan konsumsi makanan sehat agar sistem imun tubuh kuat.
2. Tidak mengucilkan penderita kusta, melainkan mendukungnya dan menyemangatinya.
3. Turut mensosialisasikan kepada keluarga, kerabat dan teman mengenai penyakit kusta.


Saran mengenai sosialisasi yang baik terhadap penyakit kusta:

1. Memberikan pengetahuan kepada masyarakat bahwa penderita penyakit ini sebaiknya tidak dikucilkan tetapi disemangati, melalui seminar di sekolah-sekolah. Saya rasa untuk masyarakat dewasa sekarang sudah terlanjur menempel stigma buruk terhadap kusta, sehingga untuk memutus stigma buruk tersebut harus dimulai dari generasi muda yang masih bersekolah.
2. Mengadakan acara charity sejenis seperti Run For Leprosy, hal ini jauh lebih baik dibanding hanya meminta donasi dengan membuka stand di mall seperti beberapa organisasi tertentu yang selama ini saya lihat. Dengan adanya acara charity, peserta tidak merasa seperti "dipaksa menyumbang", melainkan juga mendapatkan pengalaman menyenangkan bersama orang-orang terdekat.

Thursday, January 29, 2015

Assignment #13

Source:
Concepts of Programming Languages, Robert W. Sebesta.
Chapter 13: Concurrency, page 625-628

By:
Name : Helena Natanael
NIM  : 1801380333




Review Question:

6. Describe the logical architecture of a vector processor.
Vector processor have groups of registers that store the operands of a vector operation in which the same instruction is executed on the whole group of operands simultaneously. Originally, the kinds of programs that could most benefit from this architecture were in scientific computation, an area of computing that is often the target of multiprocessor machines.

7. What is the difference between physical and logical concurrency?
Physical concurrency is a multiple independent processors (multiple threads of control). While logical concurrency is the appearance of physical concurrency is presented by time-sharing one processor (software can be designed as if there were multiple threads of control)

8. What is a thread of control in a program?
A thread of control in a program is the sequence of program points reached as control flows through the program.

9. Why are coroutines called quasi-concurrent?
They are called quasi-concurrent because they have a single thread of control.

10. What is a multithreaded program?

A multi-threaded program is a program designed to have more than one thread of control.


Problem Sets:

6. Suppose two tasks, A and B, must use the shared variable Buf_Size. Task A adds 2 to Buf_Size, and task B subtracts 1 from it. Assume that such arithmetic operations are done by the three-step process of fetching the current value, performing the arithmetic, and putting the new value back. In the absence of competition synchronization, what sequences of events are possible and what values result from these operations? Assume that the initial value of Buf_Size is 6.
The add and subtract operations are not atomic and could be interrupted in mid-operation when the other task could then run. If A runs to completion, then B runs to completion, Buf_Size has the value 7 (6 + 2 – 1). Similarly if B runs to completion then A runs to completion. If A or B get interrupted in the middle of adding or subtracting, then whichever task finishes last will determine the value in Buf_Size. If A runs but is interrupted after it fetches Buf_Size but before it stores the modified value (allowing B to fetch Buf_Size), or if B runs first and is interrupted after the fetch but before the store, allowing A to fetch Buf_Size, then if A finishes last Buf_Size will have value 8, and if B finishes last Buf_Size will have value 5.

7. Compare the Java competition synchronization mechanism with that of Ada.
Java methods (but not constructors) can be specified to be synchronized. A synchronized method called through a specific object must complete its execu- tion before any other synchronized method can run on that object. Competition synchronization on an object is implemented by specifying that the methods that access shared data are synchronized.
The competition synchronization mechanism of the Ada Language is intended to provide a facility for tasks to synchronize their actions. Accept and select statements are the two main features of the language that deal with the issue of synchronization This paper points out one major problem that arises in connection with these features and proposes a possible solution to it.

8. Compare the Java cooperation synchronization mechanism with that of Ada.
In Java, cooperation synchronization  is implemented with the wait, notify, and notify. All methods, all of which are defined in Object, the root class of all Java classes. Every object has a wait list of all of the threads that have called wait on the object. While in Ada, cooperation synchronization is required between two tasks that when the second task must wait for the first task to finish executing before it may proceed.

9. What happens if a monitor procedure calls another procedure in the same monitor?
Implementation of a monitor can be made to guarantee synchronized access by allowing only one access at a time. Calls to monitor procedures are implicitly blocked and stored in a queue if the monitor is busy at the time of the call.

10. Explain the relative safety of cooperation synchronization using semaphores and using Ada’s when clauses in tasks.
We need to take steps to make sure that different threads don't interact in negative ways. If one thread is operating on some data or structure, we don't want another thread to simultaneously operate on that same data/structure and corrupt the results; when Thread A writes to a variable that Thread B accesses, we need to make sure that Thread B will actually see the value written by Thread A; we don't want one thread to hog, take or lock for too long a resource that other threads need in order to make progress.

Tuesday, January 20, 2015

Assignment #12

Source:
Concepts of Programming Languages, Robert W. Sebesta.
Chapter 12: Support for Object-Oriented Programming, page 570-572

By:
Name : Helena Natanael
NIM  : 1801380333




Review Question:

6. Describe a situation where dynamic binding is a great advantage over its absence.
Consider the following situation:
There is a base class, A, that defines a method draw that draws some figure associated with the base class. A second class, B, is defined as a subclass of A. Objects of this new class also need a draw method that is like that provided by A but a bit different because the subclass objects are slightly different. So, the subclass overrides the inherited draw method. If a client of A and B has a variable that is a reference to class A’s objects, that reference also could point at class B’s objects, making it a polymorphic reference. If the method draw, which is defined in both classes, is called through the polymorphic reference, the run-time system must determine, during execution, which method should be called, A’s or B’s.

7. What is a virtual method?
A virtual method is a declared class method that allows overriding by a method with the same derived class signature. Virtual methods are tools used to implement the polymorphism feature of an object-oriented language, such as C#. When a virtual object instance method is invoked, the method to be called is determined based on the object's runtime type, which is usually that of the most derived class.

8. What is an abstract method? What is an abstract class?
An abstract method is a method which all descendant classes should have. An abstract class is a class which has abstract method.

9. Describe briefly the eight design issues used in this chapter for object-oriented
languages.

  • What non-objects are in the language?
  • Are Subclasses Subtypes? If so, derived objects can be legally used wherever a parent object could be used.
  • Type Checking and Polymorphism
  • Single and Multiple Inheritance. Inherit from 1 (or more than 1) parent.
  • Object Allocation and Deallocation.  Are objects allocated from heap or stack.
  • Dynamic and Static Binding. When are messages bound to methods, before or during run-time?
  • Nested Classes. Can a class be nested inside another class?
  • Initialization of Objects. Are objects initialized when created? Implicit or explicit?

10. What is a nesting class?

A nesting class is a class defined inside another class


Problem Sets:

6. Compare the multiple inheritance of C++ with that provided by interfaces in Java.
C++ inheritance is implementation inheritance. That is, a class inheriting from two of more superclasses actually inherits the code from those classes. Java’s interface mechanism is an interface inheritance. That is, a class implementing two or more interfaces simply inherits (and must provide its own implementations for) the methods of the interface.

7. What is one programming situation where multiple inheritance has a significant advantage over interfaces?
A situation when there are two classes derived from a common parent and they have a child.

8. Explain the two problems with abstract data types that are ameliorated by inheritance.
The problems solved are reusability of code and “extensibility”. Reusability because one won’t have to copy/paste his code from one data type to another, allowing for a greater readability. Extensibility because a method can accept a certain class as an argument, and get a child class of this one. This will allow the user to have a wider set of functionality, but the method will still be able to know that the entities it relies on are present.

9. Describe the categories of changes that a subclass can make to its parent class.
Subclasses can add things (variables, methods). Subclass in C++ can effectively remove a method using "private" inheritance. Inherited methods can be overridden.

10. Explain one disadvantage of inheritance.
Disadvantage of using inheritance is that the two classes (base and inherited class) get tightly coupled.
This means one cannot be used independent of each other.

Friday, January 16, 2015

Assignment #11

Source:
Concepts of Programming Languages, Robert W. Sebesta.
Chapter 11: Abstract Data Types and Encapsulation Constructs, page 519-521

By:
Name : Helena Natanael
NIM  : 1801380333




Review Question:

6. Explain how information hiding is provided in an Ada package.
There are two approaches to hiding the representation from clients in the package specification. The first one is to include two sections in the package specification, the second one is in which entities are visible to clients and one that hides its contents.

7. To what is the private part of an Ada package specification visible?
The private part of an Ada package specification is visible to the compiler but not to the client programs.

8. What is the difference between private and limited private types in Ada?
Private types have built-in operations for assignment and comparison. Limited private types don’t have built-in operations.

9. What is in an Ada package specification? What about a body package?
Body package, is an Ada package which provides the implementation of most, if not all, of the entities named in the associated package specification.

10. What is the use of the Ada with clause?

The ‘with’ clause in Ada makes the names defined in external packages visible.



Problem Sets:

6. Discuss the advantages of C# properties, relative to writing accessor methods in C++ or Java.
The advantage of C# Properties relative to writing accessor are:
- Read-only access can be provided, by having a getter method but no corresponding setter method.
- Constraints can be included in setters. For example, if the data value should be restricted to a particular range, the setter can enforce that.
- The actual implementation of the data member can be changed without affecting the clients if getters and setters are the only access.

7. Explain the dangers of C’s approach to encapsulation.
There are two problems with this approach. First, the documentation of the dependence of the client program on the library (and its header file) is lost. Second, the author of the library could change the header file and the implementation file, but the client could attempt to use the new implementation file (not realizing it had changed) but with the old header file, which the user had copied into his or her client program.

8. Why didn’t C++ eliminate the problems discussed in Problem 7? 
Because in C++ these kinds of problems can be handled by allowing nonmember functions to be “friends” of a class. Friend functions have access to the private entities of the class where they are declared to be friends.

9. What are the advantages and disadvantages of the Objective-C approach to syntactically distinguishing class methods from instance methods?
Instance methods use an instance of a class, whereas a class method can be used with just the class name. A class is like the blueprint of a house: You only have one blueprint and (usually) you can't do that much with the blueprint alone. An instance (or an object) is the actual house that you build based on the blueprint: You can build lots of houses from the same blueprint. You can then paint the walls a different color in each of the houses, just as you can independently change the properties of each instance of a class without affecting the other instances.

10. In what ways are the method calls in C++ more or less readable than
those of Objective-C?
In Objective C, all method calls are essentially virtual. This makes it a bit easier on the programmer, but it comes at a possible performance decrease. Hence sometimes methods call in C++ can be more or less readable than those of Objective-C.

Monday, January 12, 2015

Assignment #10

Source:
Concepts of Programming Languages, Robert W. Sebesta.
Chapter 10: Implementing Subprograms, page 467-470

By:
Name : Helena Natanael
NIM  : 1801380333




Review Question:

6. What is the difference between an activation record and an activation record instance?
The format, or layout, of the noncode part of a subprogram is called an activation record, because the data it describes are relevant only during the activation, or execution of the subprogram. The form of an activation record is static. An activation record instance is a concrete example of an activation record, a collection of data in the form of an activation record.

7. Why are the return address, dynamic link, and parameters placed in the bottom of the activation record?
Because the return address, dynamic link, and parameters are placed in the activation record instance by the caller, these entries must appear first. The return address usually consists of a pointer to the instruction following the call in the code segment of the calling program unit. The dynamic link is a pointer to the base of the activation record instance of the caller. In static- scoped languages, this link is used to provide traceback information when a run-time error occurs. In dynamic-scoped languages, the dynamic link is used to access nonlocal variables. The actual parameters in the activation record are the values or addresses provided by the caller.

8. What kind of machines often use registers to pass parameters?
In many compilers for RISC machines, parameters are passed in registers. This is because RISC machines normally have many more registers than CISC machines. In the remainder of this chapter, however, we assume that parameters are passed in the stack. It is straightforward to modify this approach for parameters being passed in registers.

9. What are the two steps in locating a nonlocal variable in a static-scoped language with stack-dynamic local variables and nested subprograms?
The first step of the access process is to find the instance of the activation record in the stack in which the variable was allocated. The second part is to use the local_offset of the variable (within the activation record instance) to access it.

10. Define static chain, static_depth, nesting_depth, and chain_offset.
  • A static chain is a chain of static links that connect certain activation record instances in the stack. During the execution of a subprogram P, the static link of its activation record instance points to an activation record instance of P’s static parent program unit.
  • A static_depth is a static scope that indicates how deeply it is nested in the outermost scope. A program unit that is not nested inside any other unit has a static_depth of 0. If subprogram A is defined in a nonnested program unit, its static_depth is 1. If subprogram A contains the definition of a nested subprogram B, then B’s static_depth is 2.
  • A nesting_depth or chain_offset is the difference between the static_depth of the subprogram containing the reference to X and the static_depth of the subprogram containing the declaration for X.



Problem Sets:

6. Although local variables in Java methods are dynamically allocated at the beginning of each activation, under what circumstances could the value of a local variable in a particular activation retain the value of the previous activation?
Each activation allocates variables in exactly the same order. Variables are not initialized to any value unless the program contains an initialization statement for the variable – they simply have whatever value is stored in the location they are allocated. If a procedure finishes executing, returns, and is immediately reinvoked, a variable would be assigned the same stack location it had on the previous invocation, and would have the last value from that previous invocation.

7. It is stated in this chapter that when nonlocal variables are accessed in a dynamic-scoped language using the dynamic chain, variable names must be stored in the activation records with the values. If this were actually done, every nonlocal access would require a sequence of costly string comparisons on names. Design an alternative to these string comparisons that would be faster.
Using approach that uses an auxiliary data structure called a display. Or, to write variable names as integers. These integers act like an array. So when the activation happens, the comparisons will be faster.

8. Pascal allows gotos with nonlocal targets. How could such statements be handled if static chains were used for nonlocal variable access?
Hint:
Consider the way the correct activation record instance of the static parent of a newly enacted procedure is found (see Section 10.4.2).
Based on the hint statement, the target of every goto in a program could be represented as an address and a nesting_depth, where the nesting_depth is the difference between the nesting level of the procedure that contains the goto and that of the procedure containing the target. Then, when a goto is executed, the static chain is followed by the number of links indicated in the nesting_depth of the goto target. The stack top pointer is reset to the top of the activation record at the end of the chain.

9. The static-chain method could be expanded slightly by using two static links in each activation record instance where the second points to the static grandparent activation record instance. How would this approach affect the time required for subprogram linkage and nonlocal references?
Including two static links would reduce the access time to nonlocals that are defined in scopes two steps away to be equal to that for nonlocals that are one step away. Overall, because most nonlocal references are relatively close, this could significantly increase the execution efficiency of many programs.

10. Design a skeletal program and a calling sequence that results in an activation record instance in which the static and dynamic links point to different activation-recorded instances in the run-time stack.
\verb+   + X : Integer;\\
\verb+   +procedure Bigsub is\\
\verb+   +\verb+   +     A, B, C : Integer;\\
\verb+   +\verb+   +     procedure Sub1 is\\
\verb+   +\verb+   +\verb+   +   A, D : Integer;\\
\verb+   +\verb+   +\verb+   +   begin — of Sub1\\
\verb+   +\verb+   +\verb+   +   A := B + C; $\longleftarrow$ 1\\
\verb+   +\verb+   +\verb+   +     …\\
\verb+   +   end; — of Sub1\\
\verb+   +   procedure Sub2(X : Integer) is\\
\verb+   +\verb+   +       B, E : Integer;\\
\verb+   +\verb+   +       procedure Sub3 is\\
\verb+   +\verb+   +\verb+   +       C, E : Integer;\\
\verb+   +\verb+   +\verb+   +       begin — of Sub3\\
\verb+   +\verb+   +\verb+   +       …\\
\verb+   +\verb+   +\verb+   +       Sub1;\\
\verb+   +\verb+   +\verb+   +       …\\
\verb+   +\verb+   +\verb+   +       E := B + A; $\longleftarrow$ 2\\
\verb+   +\verb+   +       end; — of Sub3\\
\verb+   +\verb+   +       begin — of Sub2\\
\verb+   +\verb+   +    …\\
\verb+   +\verb+   +       Sub3;\\
\verb+   +\verb+   +       …\\
\verb+   +\verb+   +       A := D + E; $\longleftarrow$ 3\\
\verb+   +   end; — of Sub2\\
\verb+   +   begin — of Bigsub\\
\verb+   +\verb+   +     …\\
\verb+   +\verb+   +     Sub2(7);\\
\verb+   +\verb+   +     …\\
\verb+   + end; — of Bigsub\\
begin — of Main\_2\\
\verb+   + …\\
\verb+   + Bigsub;\\
\verb+   + …\\
end; — of Main\_2\\
\\
The sequence of procedure calls is:\\
Main\_2 calls Bigsub\\
Bigsub calls Sub2\\
Sub2 calls Sub3\\
Sub3 calls Sub1\\
\\
The activation records with static and dynamic links is as follows:\\
\begin{figure}
\centering
\includegraphics[scale=0.5]{ari}
\end{figure}

Saturday, January 3, 2015

Assignment #9

Source:
Concepts of Programming Languages, Robert W. Sebesta.
Chapter 9: Subprograms, page 436-439

By:
Name : Helena Natanael
NIM  : 1801380333




Review Question:

6. What is a Ruby array formal parameter?
Ruby supports a complicated but highly flexible actual parameter configuration. The initial parameters are expressions, whose value objects are passed to the corresponding formal parameters. The initial parameters can be following by a list of key => value pairs, which are placed in an anonymous hash and a reference to that hash is passed to the next formal parameter. These are used as a substitute for keyword parameters, which Ruby does not support. The hash item can be followed by a single parameter preceded by an asterisk. This parameter is called the array formal parameter.


7. What is a parameter profile? What is a subprogram protocol?
Parameter profile is the number, order, and types of its formal parameters. Subprogram protocol is its parameter profile plus, if it is a function, its return type. In languages in which subprograms have types, those types are defined by the subprogram’s protocol.



8. What are formal parameters? What are actual parameters?
- Formal parameters are the parameters in the subprogram header.
- Actual parameters are a list of parameters to be bound to the formal parameters of the subprogram which must be included with the name of the subprogram by the subprogram call statements.


 9. What are the advantages and disadvantages of keyword parameters?
- The advantage : they can appear in any order in the actual parameter list. 
- The disadvantage : the user of the subprogram must know the names of formal parameters.

10. What are the differences between a function and a procedure?
A function returns value but procedures do not. Function are structurally resemble procedures but are semantically modeled on mathematical parameter.



Problem Sets:

6. Present one argument against providing both static and dynamic local variables in subprograms.
In subprograms local variables can be static or dynamic;  
If local variable treated statically:
This allows for compile-time allocation/ deallocation and ensures proper type checking but does not allow for recursion.
If local variables treated dynamically:
This allows for recursion at the cost of run-time allocation/ deallocation and initialization because these are stored on a stack, referencing is indirect based on stack position and possibly time-consuming.


7. Consider the following program written in C syntax:
void fun (int first, int second) {
first += first; second += second;
}
void main() {
int list[2] = {1, 3};
fun(list[0], list[1]);
}
For each of the following parameter-passing methods, what are the values
of the list array after execution?
a. Passed by value : 1,3
b. Passed by reference : 2,6
c. Passed by value-result : 2,6


8. Argue against the C design of providing only function subprograms.
If a language provides only functions, then either programmers must live with the restriction of returning only a single result from any subprogram, or functions must allow side effects, which is generally considered bad. Since having subprograms that can only modify a single value is too restrictive, C’s choice is not good.


9. From a textbook on Fortran, learn the syntax and semantics of statement functions. Justify their existence in Fortran.
The Fortran 1966 standard provided a reference syntax and semantics, but vendors continued to provide incompatible extensions. These standards have improved portability.


10. Study the methods of user-defined operator overloading in C++ and Ada, and write a report comparing the two using our criteria for evaluating languages.
One of the nice features of C++ is that you can give special meanings to operators, when they are used with user-defined classes. This is called operator overloading. You can implement C++ operator overloads by providing special member-functions on your classes that follow a particular naming convention. For example, to overload the + operator for your class, you would provide a member-function named operator+ on your class. Meanwhile for Ada, since much of the power of the language comes from its extensibility, and since proper use of that extensibility requires that we make as little distinction as possible between predefined and user-defined types, it is natural that Ada also permits new operations to be defined, by declaring new overloading of the operator symbols.

Friday, January 2, 2015

Assignment #8

Source:
Concepts of Programming Languages, Robert W. Sebesta.
Chapter 8: Statement-Level Control Structures, page 381-382

By:
Name : Helena Natanael
NIM  : 1801380333
P.S.: Happy New Year 2015! :)


Review Question:

6. What is unusual about Python’s design of compound statements?
Python uses indentation to specify compound statements. 
For example,
if x < y :
x = y
print "value of x is modified".
All statements equally indented are included in the compound statement.



7. Under what circumstances must an F# selector have an else clause?
An F# selector have an “else” clause if the “if” expression does return a value.


8.What are the common solutions to the nesting problem for two-way selectors?
A programmer should avoid syntactic entity because in some cases, syntactic entity leads to ambiguous meaning when it is compiled. Another way to avoid the issue of nested selection statements is to use an alternative means of forming compound statements.


 9. What are the design issues for multiple-selection statements?
1. What is the form and type of the expression that controls the selection?• How are the selectable segments specified?
2. Is execution flow through the structure restricted to include just a single selectable segment?
3. How are the case values specified?
4. How should unrepresented selector expression values be handled, if at all?


10. Between what two language characteristics is a trade-off made when deciding whether more than one selectable segment is executed in one execution of a multiple selection statement?
The C# switch statement differs from that of its C-based predecessors in two ways. First, C# has a static semantics rule that disallows the implicit execution of more than one segment. The rule is that every selectable segment must end with an explicit unconditional branch statement: either a break,
which transfers control out of the switch statement, or a goto, which can transfer control to one of the selectable segments (or virtually anywhere else).

As with C, if there is no break at the end of the selected segment, execution continues into the next segment.




Problem Sets:

6. Analyze the potential readability problems with using closure reserved words for control statements that are the reverse of the corresponding initial reserved words, such as the case-esac reserved words of ALGOL 68. For example, consider common typing errors such as transposing characters.
The potential readability problem is the typing errors. It’s very possible to occur if we don’t type the code carefully.


7. Use the Science Citation Index to find an article that refers to Knuth (1974). Read the article and Knuth’s paper and write a paper that summarizes both sides of the goto issue.
An alternative viewpoint is presented in Donald Knuth's Structured Programming with go to Statements, which analyzes many common programming tasks and finds that in some of them GOTO is the optimal language construct to use.[7] In their quasi-standard book on the C programming language, Dennis Ritchie and Brian Kernighan warn that goto is "infinitely abusable", but also suggest that it could be used for end-of-function error handlers and for multi-level breaks from loops.


8. In his paper on the goto issue, Knuth (1974) suggests a loop control statement that allows multiple exits. Read the paper and write an operational semantics description of the statement.
Operational semantics are a category of formal programming language semantics in which certain desired properties of a program, such as correctness, safety or security, are verified by constructing proofs from logical statements about its execution and procedures, rather than by attaching mathematical meanings to its terms (denotational semantics).


9. What are the arguments both for and against the exclusive use of Boolean expressions in the control statements in Java (as opposed to also allowing arithmetic expressions, as in C++)?
The primary argument for using Boolean expressions exclusively as control expressions is the reliability that results from disallowing a wide range of types for this use. In C, for example, an expression of any type can appear as a control expression, so typing errors that result in references to variables of incorrect types are not detected by the compiler as errors. No , it would not be a good idea. Although this custom precedence sounds like increasing flexibility, requiring parentheses to show a custom precedence would impact in readability and writability of a program.


10. In Ada, the choice lists of the case statement must be exhaustive, so that there can be no unrepresented values in the control expression. In C++, unrepresented values can be caught at run time with the default selector. If there is no default, an unrepresented value causes the whole statement to be skipped. What are the pros and cons of these two designs (Ada and C++)? 

---- C++ :
1. Control expression can be only an integer type 
2. Selectable segments can be statement sequences, blocks, or compound statements 
3. Construct is encapsulated 
4. Any number of segments can be executed in one execution of the construct (there is no implicit branch at the end of selectable segments) (a trade-off between reliability and flexibility–convenience) - To avoid it, the programmer must supply a break statement for each segment.
5. default clause is for unrepresented values (if there is no default, the whole statement does nothing) 
 ----- Ada:
 1. Constant lists can include: - Subranges e.g., 10..15
- Boolean OR operators
e.g., 1..5 | 7 | 15..20
2. Lists of constants must be exhaustive - Often accomplished with others clause
- This makes it more reliable.