Programlamanın Taosu
1. Kitap - Sessiz Boşluk
Ve şöyle dedi usta programcı: “Sadece TCP/IP kullanarak uzaktaki makinanın işletim sistemini anlayabildiğinde tapınaktan ayrılmanın zamanı gelmiş demektir.”
1.1
Sessiz boşlukta gizemli bir şey oluştu. Tek başına hareketsiz bekleyen o şey yine de sürekli hareket halindedir. Tüm programların özünde yer alır o. Adını bilmiyorum onun, bu yüzden Programlanın Taosu diyeceğim.
Tao büyükse işletim sistemi büyüktürr. İşletim sistemi büyükse derleyici büyüktür. Derleyici büyükse uygulama büyüktür. Kullanıcı mutludur ve dünyada uyum hüküm sürer.
Programlamanın Taosu uzaklara gider ve sabah rüzgarı ile geri döner.
1.2
Tao makina dilini doğurdu. Makina dili assembler’ı doğurdu.
Assembler derleyiciyi doğurdu. Şimdi ortalıkta onbin tane programlama dili var.
Ne kadar alçakgönüllü olsa da her dilin bir amacı vardır. Her dil yazılımın Yin ve Yang’ını ifade eder. Her dilin Tao içinde bir yeri vardır.
Ancak mümkünse COBOL ile programlamayın.
1.3
Başlangıçta sadece Tao vardı. Tao Mekânı ve Zamanı doğurdu. Bu yüzden Zaman ve Mekân programlamanın Yin ve Yang’ıdır.
Tao’yu anlamayan programcılar programları için bir türlü yeterli zamana ve mekana sahip olmazlar. Tao’yu anlayan programcılar ise hedeflerine varmak için gerekli zamana ve mekana daima sahiptirler.
Başka türlü nasıl olabilirdi ki?
1.4
Bilge programcıya Tao’dan bahsedildiğinde onu takip eder. Ortalama programcıya Tao’dan bahsedildiğinde onu araştırma gereği duyar. Aptal programcıya Tao’dan bahsedildiğinde kahkahalarla güler.
Eğer gülmezse, duyduğu gerçek Tao değildir.
En yüksek ses işitilmesi en zor olandır.
İleri gitmek geri çekilmeye götürür.
Büyük yetenek kendini olgunlukta gösterir.
Mükemmel bir programın bile hataları vardır.
2. Kitap - Eski Ustalar
Şöyle dedi usta programcı:
“Üç gün program yazma ve hayat anlamsızlaşır.”
2.1
Eski zamanlarda yaşayan programcılar gizemliydi. Onların düşüncelerini takip edebilmemiz mümkün değil, bu yüzden sadece görünüşlerini tarif etmekte yetineceğiz.
Suyu geçen bir tilki gibi uyanık. Savaş meydanındaki general gibi dikkatli. Misafirlerini ağırlayan ev sahibi gibi nazik. Yontulmamış tahta blok gibi basit. Derin mağaralardaki sular gibi karanlık.
Onların kalplerindeki ve kafalarındaki sırları kim bilir?
Cevap sadece Tao’dadır.
2.2
Büyük usta Turing bir gün rüyasında bir makina olduğunu gördü ve uyandığında dedi ki: “Bilmiyorum ki acaba ben rüyasında bir makina olduğunu gören Turing miyim yoksa Turing olduğunu gören bir makina mıyım!”
2.3
Büyük bir firma için çalışan bir programcı bir yazılım konferansına gider ve sonra dönüp müdürüne rapor verir: “O firmalarda çalışan programcılar nasıl insanlar! Kötü davranıyorlardı ve dış görünüşleri ile ilgilenmiyorlardı. Saçları uzun, giysileri eski püskü, kırış kırıştı. En güzel odamızı batırdılar ve benim prezentasyonum esnasında gürültü yapıp durdular.”
Müdür bunun üzerine dedi ki: “Seni oraya asla göndermemeliydim! O programcılar fiziksel dünyanın ötesinde yaşarlar. Hayatı saçma, bir tür tesadüf kabul ederler. Sınır tanımaksızın hareket ederler. Sadece programları için yaşarlar. Neden toplumsal kurallara uysunlar ki?…
Onlar Tao’nun içinde yaşarlar.”
2.4
Bir çırak ustaya sordu: “Bak şurada bir programcı var, hiç tasarım yapmadan program yazıyor, dokümantasyon hazırlamıyor ve test etmiyor. Ancak kimi gördüysem onun dünyadaki en iyi programcı olduğunu söylüyor. Bu nasıl olabilir?”
Usta cevap verdi: “O programcı Tao’yu bilir. Tasarım kaygısını aşmıştır, sistem göçtüğünde öfkelenmez, evreni olduğu gibi kabul eder. Dokümantasyon kaygısın aşmıştır, bir başkasının onun koduna bakıp bakmaması umurunda değildir. Test etme kaygısını da aşmıştır çünkü yazdığı her program kendi içinde mükemmel, şık ve rahattır, amaçları hemen belli eder kendini. Evet, gerçekten de o Tao’nun gizemlerine ermiştir.”
3. Kitap - Tasarım
Ve şöyle dedi usta programcı:
“Program test edilmeye başlandığında tasarım değişiklikleri yapmak için artık çok geçtir.”
3.1
Bir zamanlar bir bilgisayar fuarına giden bir adam vardı. Her gün girişteki güvenlik görevlisine şöyle diyordu: “Ben büyük bir hırsızım, arakladığım şeyler yüzünden meşhurum. Seni uyarıyorum bu fuar da benden nasibini alacak.”
Bu konuşma güvenlik görevlisini çok rahatsız etmişti çünkü içeride milyonlarca dolar değerinde bilgisayar ekipmanı vardı ve o da bu yüzden hırsız olduğunu söyleyen adamı yakın takibe almaya karar verdi. Ancak adam bir standdan diğerine gidiyor ve kendine kendine mırıldanıyordu, tüm yaptığı buydu.
Adam fuarı terk eder etmez, güvenlik görevlisi onu bir kenara çekiyor baştan sonra arama tarama yapıyordu. Adamın hırsızlığına işaret eden hiçbir şey çıkmıyordu üzerinden.
Ertesi günü fuara gelen adam güvenlik görevlisine yanaşıp dedi ki: “Dün iyi iş çıkardım ama bugün daha da iyi olacak.” Tüm huzuru kaçan bu sefer takip işini daha sıkı tutmaya karar vermişti ancak sonuç gene hüsrandı.
Fuarın son gününde dayanamayan güvenlik görevlisi adama gidip şöyle dedi:”Sayın Hırsız, o kadar şaşırmış durumdayım ki huzurum kaçtı, çok kötü durumayım, lütfen beni aydınlatın, çaldığınız şey nedir?”
Adam gülümsedi ve tek bir cümle sarf etti:”Fikir çalıyorum.”
3.2
Bir zamanlar yapısal olmayan programlar yazan bir usta programcı vardı. Çömez programcı onu taklit etmeye yeltendi ve o da yapısal olmayan programlar yazmaya başladı. Sonra ustaya gidip programlarını değerlendirmesini isteyince usta ona yapısal olmaya programlar yazmadığı için kızdı ve dedi ki: “Usta için uygun olan çömez için uygun değildir. Yapıyı aşmadan önce Tao’yu kavramalısın.”
3.3
Bir zamanlar savaş lordu Wu’nun topraklarında yaşayan bir programcı vardı. Wu onu huzuruna getirtti ve sordu: “Hangisini tasarlamak daha kolaydır, bir muhasebe paketi mi yoksa bir işletim sistemi mi?”
Programcı cevapladı: “Bir işletim sistemi.”
Kulaklarına inanamayan savaş lordu içini çekti ve dedi ki: “Bir işletim sistemi ile kıyaslandığında muhasebe yazılımının çok basit olduğu su götürmez!”
“Tam olarak öyle denemez efendim”, dedi programcı, “bir muhabesebe paketi tasarlarken programcı değişik fikirleri olan insanlarla muhatap olmak zorunda kalır: program nasıl çalışmalıdır, raporlar nasıl görünmelidir, vergi kanunlarına ne şekilde uymaldıdır, vs. Oysa bir işletim sistemi dış görünüş ile sınırlandırılamaz. Bir işletim sistemi tasarlarken programcı makina ve fikirler arasındaki en basit uyumu arar bu yüzden de işletim sistemi tasarlamak daha kolaydır.”
Savaş lordu Wu başını onaylar biçinde salladı ve gülümsedi: “Güzel ve akıllıca! Peki hangisinin hatalarını ayıklamak daha kolaydır?”
Programcı cevap vermedi.
3.4
Bir müdür usta programcıya gitti ve yeni bir uygulama ile ilgili özellik listesini gösterdi. Sonra da sordu: “Eğer 5 programcıyı görevlendirirsem sistemin tasarlanması ne kadar sürer?”
“1 yıl,” diye cevapladı usta hiç tereddüt etmeden.
“Fakat bu iş çok acil! 10 programcı çalıştırsak?”
Ustanın kaşları çatıldı. “Bu durumda iki yıl sürer” dedi.
“Peki ya 100 programcı çalıştırsak?”
Usta omuz silkti ve “O zaman tasarım asla tamamlanmaz” dedi
4. Kitap - Kodlama
Ve şöyle dedi usta programcı: “İyi yazılmış bir program kendi içinde bir cennettir, kötü bir program ise cehennemin ta kendisi.”
4.1
Bir program hafif ve çevik olmalıdır. Alt rutinleri inci dizileri gibi bağlanmalıdır. Programın ruhu ve amacı sürekli göz önünde bulundurulmalıdır. Fazla ya da az olmamalı, gereksiz döngüler ve değişkenler kullanılmamalıdır. Ancak yapıdan yoksunluk ya da değiştirilemez bir katılık da bulunmamalıdır.
Bir program “En Küçük Şaşkınlık” yasasını takip etmelidir. Nedir bu yasa? Program kullanıcıya daima onu en az şaşırtacak şekilde cevap vermelidir.
Bir program, ne kadar karmaşık olursa olsun, tek bir birim gibi çalışmalıdır. Program dış görünüşü tarafından değil içsel mantığı tarafından yönlendiriliyor olmalıdır.
Eğer program bu ihtiyaçları karşılamazsa düzensizlik ve karmaşa hakim olur. Bunu düzeltmenin tek yolu programı yeniden yazmaktır.
4.2
Bir çırak ustaya sordu: “Bazen çalışan, bazen de çöken bir programım var. Programlama kurallarına uydum ama gene de apışıp kaldım. Bunun sebebi ne olabilir?”
Usta şöyle cevapladı: “Kafan karışmış çünkü Tao’yu anlamıyorsun. Sadece bir insan etrafındaki insanlardan rasyonel davranışlar bekler. Sen neden aynı şeyi insanların yaptığı bir makinadan bekliyorsun? Bilgisayarlar determinizmi sadece simüle ederler, mükemmel olan ise sadece Tao’dur.
Programlama kuralları geçicidir. Sadece Tao kalıcıdır. Bu yüzden aydınlanabilmek için önce Tao’yu kavramalısın.”
“Peki ama aydınlandığımı nasıl anlayacağım?” diye sordu çırak.
Usta cevap verdi: “Programın düzgün çalışacak.”
4.3
Bir usta çıraklardan birine Tao’nun doğasını anlatıyordu: “Tao tüm yazılımların içinde vardır, ne kadar küçük olurlarsa olsun bu yazılımlar.”
“Bir hesap makinasında Tao var mıdır?” diye sordu bir çırak.
“Vardır.”
“Peki bir video oyununda da var mıdır Tao?” diye devam etti çırak.
“Bir video oyununda bile vardır,” dedi usta.
“Peki, kişisel bilgisayardaki Windows sisteminde de Tao var mıdır?” diye sordu çırak.
Usta öksürdü, boğazın temizledi, biraz kımıldandı ve “Bugünkü dersimiz bu kadar,” dedi.
4.4
Prens Wang’ın programcısı yazılım kodluyordu. Parmakları klavye üzerinde dans ediyor, programları tek bir hata mesajı olmadan derleniyor ve rüzgar gibi çalışıyordu.
“Mükemmel!” diye bağırdı Prens. “Tekniğin kusursuz!”
“Teknik mi?” dedi programcı ve terminalinden yukarı doğru baktı. “Benim takip ettiğim şey Tao’dur - tüm tekniklerin ötesinde. Programlamaya ilk kez başladığımda tüm problemi tek bir kütle gibi görüyordum. Aradan yıllar geçtikten sonra o kütleyi görmüyorum. Bunun yerine alt rutinler kullanıyordum. Ancak şimdi artık hiçbir şey görmüyorum. Tüm varlığım şekilsiz bir boşluk gibi. Ruhum plansız programsız, içgüdülerini takip ederek özgürce çalışabiliyor. Kısaca programım kendi kendini yazıyor. Evet, doğru, bazen güç problemlerle karşılaştığım oluyor. Onların geldiğini görüyorum ve yavaşlayıp sessizce izliyorum. Sonra tek bir satırı değiştiriyorum ve problemler duman gibi uçup gidiyor. Programı derliyorum ve yapılan işin güzelliği varlığıma işliyor. Gözlerimi kapatıyorum ve sonra sistemden çıkıyorum.”
Bunun üzerine Prens Wang dedi ki “Keşke tüm programcılarım senin kadar bilge olsaydı.”
5. Kitap - Bakım
Ve şöyle dedi usta programcı:
“Bir program üç satırı geçtiyse bir gün mutlaka bakıma ihtiyaç duyar.”
5.1
İyi kullanılan bir kapıya yağ gerekmez.
Akan su kir tutmaz.
Ne düşünceler ne de sesler boşlukta hareket edebilir.
Kullanılmayan yazılım çürür.
Bunlar büyük sırlardır.
5.2
Bir müdür bir programcıya üzerinde çalıştığı programı ne kadar sürede bitirebileceğini sordu. “Yarın bitecek,” diye cevapladı programcı tereddüt etmeden.
“Bu bana pek gerçekçi gelmedi açıkçası,” dedi müdür. “Açık konuş, ne kadar sürer?”
Programcı durup biraz düşündü. “Eklemek istediğim bir iki özellik daha var. İki hafta alır,” dedi.
“Bu bile iyimser bir beklenti!” diye ısrar etti müdür, “Bana kısaca programın ne zaman tamamlanacağını söyler misin?”
Programcı bunu kabul etti.
Yıllar sonra, müdür emekli oldu. Emekliliğini kutlama yemeğine çıkarken programcıyı bilgisayarı başında uyurken gördü. Sabaha kadar program yazmıştı.
5.3
Bir gün bir çırak programcıya bir muhasebe paketi yazma görev verildi.
Çırak günlerce deliler gibi çalıştı ancak usta programı incelediğinde sistemde bir ekran editörü, genelleştirilmiş grafik rutinleri, bir tür yapay zekâ arabirimi bulunduğunu gördü. Muhasebeye yönelik hiçbir şey yoktu.
Usta bu noktaya dikkat çekince çırak biraz bozuldu, “Lütfen bu kadar sabırsız olmayın, süreç içinde muhasebe fonksiyonlarını da ekleyeceğim.”
5.4
İyi bir çiftçi ekinini ihmal eder mi?
İyi bir öğretmen en aptal öğrenciye bile kötü davranır mı?
İyi bir baba bir çocuğunu açlığa makhum eder mi?
İyi bir pogramcı programının bakımını yapmayı reddeder mi?
6. Kitap - Yönetim
Ve şöyle dedi usta programcı:
“Programcılar çok ve yöneticiler az olsun - o zaman herkes çok daha üretken olur.”
6.1
Yöneticiler bitmek bilmeyen toplantılar yaparken programcılar oyun yazar. Muhasebeciler son dönem kârlarından bahsederken programcıların bütçesi kesilmek üzeredir. Bilimadamları gökyüzünden bahsederken ortalığı bulutlar kaplar.
Gerçekten de programlanın Tao’su bu değildir.
Yöneticiler kendilerini adadıklarında, oyun programları ihmal edilir. Muhasebeciler uzun dönemli plan yaptıklarında uyum ve düzen geri döner. Bilimadamları eldeki problemleri incelemeye başladıklarında problemler çözülür.
Gerçekten de programlamanın Tao’su budur.
6.2
Programcılar neden üretken değildir?
Çünkü vakitleri toplantılarda harcanır.
Programcılar neden isyankardır?
Çünkü yönetim işlerine çok fazla karışır.
Programcılar neden tek tek istifa ederler?
Çünkü kendilerini tüketilmiş hissederler.
Kötü yönetim için çalışmışlardır ve artık işlerine değer vermiyorlardır.
6.3
Bir yönetici kovulmak üzere iken onun için çalışan bir programcı yeni bir program geliştirdi, bu meşhur olup çok sattı ve yönetici yerini korudu.
Yönetici programcıya prim vermeye çalıştı ancak programcı reddetti ve dedi ki “O programı yazdım çünkü fikir hoşuma gitmişti, bu yüzden de ödül beklemiyorum.”
Bunu duyan yönetici, “Bu programcı bir çalışanın görevlerini mükemmel bir şekilde anlamış durumda, o halde onu yönetici danışman yaparak onurlandıralım!” dedi.
Bunu duyan programcı bir kez daha reddetti ve dedi ki: “Benim varlık amacım programlamak. Terfi edersem herkesin vaktini çalarım. Şimdi bana müsaade. Üzerinde çalıştığım bir program var da.”
6.4
Bir yönetici programcılarına gidip dedi ki: “İş saatlerinizle ilgili olarak, artık sabah 9′da gelecek ve akşam 5′te çıkacasınız.” Bunu duyar duymaz çoğu programcı hemen oracıkta bastı istifayı.
Bunu gören yönetici dedi ki: “Pekala, pekala. O halde iş saatleerinizi kendiniz ayarlayın, proje zamanında yetiştiği sürece özgürsünüz.” Tatmin olan programcılar öğlen gelip sabahın erken saatlerine dek çalışmaya başladılar.
7. Kitap - Şirket Bilgeliği
Şöyle dedi usta programcı:
“Bir şirket yöneticisi için program demosu sunabilirsiniz ama onu bilgisayardan anlayan biri haline getiremezsiniz.”
7.1
Acemi programcı ustaya sordu: “Doğuda insanların ‘Şirket Karargâhı’ dedikleri bir ağaç yapısı var. Bir sürü müdür yardımcısı ve muhasebeci ile dolu. Ortalıkta ‘Şuraya git!’, ‘Buraya git!’, ‘şunu yap, bunu yap’ yazan bir sürü not var ama kimse bunların tam olarak ne anlama geldiğini bilmiyor. Her yıl bu ağaca yeni isimler ekleniyor ama hiçbir işe yaramıyor. Bu kadar garip bir ucube varlığını nasıl oluyor da sürdürebiliyor?”
Usta cevapladı: “Bu koca yapıyı algılıyor ve onun mantıklı bir amacı olmamasından ötürü rahatsız oluyorsun. Onun devasa dönüşlerinden zevk almayı öğrenemez misin? Onun koruyucu dalları altında sakince program yazmanın güzelliğinin farkına varamaz mısın? Onun kullanışsızlığı seni neden bu kadar rahatsız ediyor?”
7.2
Doğuda tüm balıklardan daha büyük olan bir köpekbalığı yaşar. Kanatları bulutları kaplayan bir kuşa dönüşür. Bu kuş hareket eder etmez Şirket Karagâhından bir mesaj getirir. Bu mesaj programcıların ortasına düşer, tıpkı dalış yapan bir martı gibi. Ve sonra kuş rüzgarı arkasına alır, mavi gökyüzüne doğru yükselip evine döner.
Acemi programcı şaşkınlık içinde kuşa bakakalır çünkü onun ne olduğunu anlamaz. Ortalama programcı kuştan çekinir çünkü getirdiği mesajdan korkar. Usta programcı bilgisayarının başında çalışmaya devam eder çünkü O kuşun ne geldiğini fark eder ne de gittiğini.
7.3
Fildişi Kule’nin Büyücüsü son icadını getirip usta programcının önünde koydu. Büyücü koca siyah bir kutuyu ustanın ofisine sürüklerken usta sessizce olup bitenleri izliyordu.
“Bu entegre, dağıtık, genel amaçlı bir iş istasyonudur!” diye başladı büyücü ve devam etti, “özel bir işletim sistemi ile ergonomik olarak tasarlanmış, içinde altıncı kuşak dilleri ve teknoloji harikası kullanıcı arabirimleri barındıran bir bilgisayardır. Asistanlarımın yüzlerce adam yılına mal oldu bunu tasarlamak. Nasıl sence de büyüleyici değil mi?”
Usta hafifçe kaşlarını kaldırdı ve “Gerçekten de büyüleyici,” dedi.
“Şirket Karargâhı’ndan gelen emirlere göre yeni programlar için artık bu makinayi platform olarak kullanacaksınız, bu konuda anlaştık mı?”
“Elbette,” diye cevapladı usta, “Hemen onu bilgi işlem merkezine yollayacağım!” Ve büyücü mutlu bir şekilde kulesine geri döndü.
Günler sonra bir acemi, ustanın odasına girdi ve “Yeni programımın yazıcı çıktısını bulamıyorum bir türlü, siz gördünüz mü acaba?” diye sordu.
“Evet,” diye cevapladı usta, kağıtlar bilgi işlem merkezindeki platformun üzerinde yığılı.”
7.4
Usta programcı bir programdan diğerine korkusuzca geçer. Yönetimdeki hiçbir değişiklik ona zarar veremez. Proje iptal edilse bile o kovulmaz. Neden? Çünkü o Tao ile doludur!
8. Kitap - Yazılım ve Donanım
Şöyle dedi usta programcı: “Rüzgar olmadan çimler hareket edemez. Yazılım olmadan donanım işe yaramaz.”
8.1
Bir çırak, ustaya sordu: “Görüyorum ki bir bilgisayar firması var ki diğerlerinin hepsinden daha büyük. Rekabet ortamında cücelerin arasındaki dev gibi. Tek bir bölümü bile başlı başına bir şirket adeta. Bu neden böyle?”
Usta cevapladı: “Neden böyle aptalca sorular soruyorsun? Şirket büyük çünkü büyük. Sadece donanım yapsaydı hiç kimse satın almazdı. Sadece yazılım yapsaydı kimse kullanmazdı. Sadece sistem bakım hizmeti verseydi insanlar ona hizmetçi muamelesi yapardı. Fakat o bunların hepsini birleştiriyor bu yüzden de insanlar onu tanrılardan biri olarak görüyor. Çırpınmadan, zahmetsizce fethediyor.”
8.2
Usta bir programcı bir gün yolda bir acemi bir programcı ile karşılaştı. Usta, aceminin elindeki portatif bilgisayar oyununu fark etti. “Afedersin, bir bakabilir miyim acaba?” diye sordu.
Acemi, elindeki bilgisayarı ustaya verdi. Usta alete bakıp konuştu: “Gördüğüm kadarı ile oyunun üç seviyesi var; kolay, orta ve zor. Ancak bu tip bir aletin bir oyun seviyesi daha vardır. Öyle bir seviye ki ne bilgisayar insanı yenmeye çalışır ne de insan bilgisayarı.”
“Lütfen usta”, diye yalvardı acemi, “bu gizemli ayarı nasıl bulabilir bir insan?”
Usta aleti yere attı ve üzerinde zıplayıp parçaladı. Ve acemi o anda aydınlandı.
8.3
Bir zamanlar mikroişlemciler üzerinde çalışan bir programcı vardı. “Bak burada ne kadar iyiyim” dedi kendisini ziyarete gelen bir programcıya. “Kendi işletim sistemim ve depolama cihazım var. Kaynaklarımı hiç kimse ile paylaşmak zorunda değilim. Yazılım kendi kendine yeterli ve kullanması kolay. Neden işinden ayrılıp bana katılmıyorsun?”
Mainframe programcısı arkadaşına kendi sistemini tarif etmeye başladı: “Mainframe bilgi işlem merkezinde, meditasyon yapan kadim bir bilge gibi oturur. Yüzlerce disk sürücüsü büyük bir okyanus gibidir. Yazılım tıpkı bir elmas gibi çokyüzlüdür ve bir orman gibi derindir. Sistemdeki programlar ırmaklar gibi akar. Ben bulunduğum yerde mutluyum.”
Bunu duyan mikroişlemci programcısı sustu ve derin düşüncelere daldı. İki programcı ömür boyu dost kaldılar.
8.4
Donanım ve Yazılım Chang-tse yolunda karşılaştılar. Yazılım dedi ki: “Sen Yin’sin ve ben de Yang’ım. Eğer birlikte seyahat ederse meşhur olur ve çok para kazanırız.” Ve birlikte yola koyuldular dünyayı fethetmek üzere.
Yolda Firmware ile karşılaştılar, elinde bir değnek ve üzerinde hırpani giysiler vardı. Firmware onlara dedi ki: “Tao Yin ve Yang’ın ötesindedir. Bir su birikintisi kadar sessiz ve hareketsizdir. Meşhur olma arzusu gütmez ve bu yüzden de kimse onun varlığından haberdar değildir. Servet düşkünü değildir çünkü kendi kendine yetebilir. Zamanın ve mekanın ötesinde yaşar.”
Yazılım ve Donanım, utanmış bir halde eve döndüler.
9. Kitap - Bitiş
Şöyle söyledi usta programcı:
“Gitme zamanın geldi.”
Tercüme:Emre Sevinç, 16 Ağustos 2002 (*)
* Geoffrey James’in “The Tao of Programming” adlı eserinden tercüme edilmiştir.
Söz konusu eser Lao Tzu’nun “Tao Te Ching” adlı kitabından esinlenerek yazılmıştır.
ORJİNALİ :
The Tao Of Programming
Translated By Geoffrey James
Transcribed By Seth Robertson
Table of Contents
Book 1 — The Silent Void
Book 2 — The Ancient Masters
Book 3 — Design
Book 4 — Coding
Book 5 — Maintenance
Book 6 — Management
Book 7 — Corporate Wisdom
Book 8 — Hardware and Software
Book 9 — Epilogue
The Silent Void
Book One
Thus spake the master programmer:
“When you have learned to snatch the error code from
the trap frame, it will be time for you to leave.”
1.1
Something mysterious is formed, born in the silent void. Waiting alone
and unmoving, it is at once still and yet in constant motion. It is
the source of all programs. I do not know its name, so I will call it
the Tao of Programming.
If the Tao is great, then the operating system is great. If the
operating system is great, then the compiler is great. If the compiler
is greater, then the applications is great. The user is pleased and
there is harmony in the world.
The Tao of Programming flows far away and returns on the wind of morning.
1.2
The Tao gave birth to machine language. Machine language gave birth to
the assembler.
The assembler gave birth to the compiler. Now there are ten thousand
languages.
Each language has its purpose, however humble. Each language expresses
the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
1.3
In the beginning was the Tao. The Tao gave birth to Space and Time.
Therefore, Space and Time are the Yin and Yang of programming.
Programmers that do not comprehend the Tao are always running out of
time and space for their programs. Programmers that comprehend the Tao
always have enough time and space to accomplish their goals.
How could it be otherwise?
1.4
The wise programmer is told about the Tao and follows it. The average
programmer is told about the Tao and searches for it. The foolish
programmer is told about the Tao and laughs at it.
If it were not for laughter, there would be no Tao.
The highest sounds are the hardest to hear. Going forward is a way to
retreat. Greater talent shows itself late in life. Even a perfect
program still has bugs.
The Ancient Masters
Book Two
Thus spake the master programmer:
“After three days without programming, life becomes meaningless.”
2.1
The programmers of old were mysterious and profound. We cannot fathom
their thoughts, so all we do is describe their appearance.
Aware, like a fox crossing the water. Alert, like a general on the
battlefield. Kind, like a hostess greeting her guests. Simple, like
uncarved blocks of wood. Opaque, like black pools in darkened caves.
Who can tell the secrets of their hearts and minds?
The answer exists only in the Tao.
2.2
Grand Master Turing once dreamed that he was a machine. When he awoke
he exclaimed:
“I don’t know whether I am Turing dreaming that I am a machine,
or a machine dreaming that I am Turing!”
2.3
A programmer from a very large computer company went to a software
conference and then returned to report to his manager, saying: “What
sort of programmers work for other companies? They behaved badly and
were unconcerned with appearances. Their hair was long and unkempt and
their clothes were wrinkled and old. They crashed out hospitality
suites and they made rude noises during my presentation.”
The manager said: “I should have never sent you to the conference.
Those programmers live beyond the physical world. They consider life
absurd, an accidental coincidence. They come and go without knowing
limitations. Without a care, they live only for their programs. Why
should they bother with social conventions?”
“They are alive within the Tao.”
2.4
A novice asked the Master: “Here is a programmer that never designs,
documents, or tests his programs. Yet all who know him consider him
one of the best programmers in the world. Why is this?”
The Master replies: “That programmer has mastered the Tao. He has gone
beyond the need for design; he does not become angry when the system
crashes, but accepts the universe without concern. He has gone beyond
the need for documentation; he no longer cares if anyone else sees
his code. He has gone beyond the need for testing; each of his
programs are perfect within themselves, serene and elegant, their
purpose self-evident. Truly, he has entered the mystery of the Tao.”
Design
Book Three
Thus spake the master programmer:
“When program is being tested, it is too late to make design changes.”
3.1
There once was a man who went to a computer trade show. Each day as he
entered, the man told the guard at the door:
“I am a great thief, renowned for my feats of shoplifting. Be
forewarned, for this trade show shall not escape unplundered.”
This speech disturbed the guard greatly, because there were millions of
dollars of computer equipment inside, so he watched the man carefully.
But the man merely wandered from booth to booth, humming quietly to
himself.
When the man left, the guard took him aside and searched his clothes,
but nothing was to be found.
On the next day of the trade show, the man returned and chided the
guard saying: “I escaped with a vast booty yesterday, but today will be
even better.” So the guard watched him ever more closely, but to no
avail.
On the final day of the trade show, the guard could restrain his
curiosity no longer. “Sir Thief,” he said, “I am so perplexed, I cannot
live in peace. Please enlighten me. What is it that you are stealing?”
The man smiled. “I am stealing ideas,” he said.
3.2
There once was a master programmer who wrote unstructured programs. A
novice programmer, seeking to imitate him, also began to write
unstructured programs. When the novice asked the master to evaluate
his progress, the master criticized him for writing unstructured
programs, saying: “What is appropriate for the master is not
appropriate for the novice. You must understand the Tao before
transcending structure.”
3.3
There was once a programmer who was attached to the court of the
warlord of Wu. The warlord asked the programmer: “Which is easier to
design: an accounting package or an operating system?”
“An operating system,” replied the programmer.
The warlord uttered an exclamation of disbelief. “Surely an accounting
package is trivial next to the complexity of an operating system,” he said.
“Not so,” said the programmer, “when designing an accounting package,
the programmer operates as a mediator between people having different
ideas: how it must operate, how its reports must appear, and how it
must conform to the tax laws. By contrast, an operating system is not
limited my outside appearances. When designing an operating system,
the programmer seeks the simplest harmony between machine and ideas.
This is why an operating system is easier to design.”
The warlord of Wu nodded and smiled. “That is all good and well, but
which is easier to debug?”
The programmer made no reply.
3.4
A manager went to the master programmer and showed him the requirements
document for a new application. The manager asked the master: “How
long will it take to design this system if I assign five programmers
to it?”
“It will take one year,” said the master promptly.
“But we need this system immediately or even sooner! How long will it
take it I assign ten programmers to it?”
The master programmer frowned. “In that case, it will take two years.”
“And what if I assign a hundred programmers to it?”
The master programmer shrugged. “Then the design will never be
completed,” he said.
Coding
Book Four
Thus spake the master programmer:
“A well-written program is its own heaven;
a poorly-written program is its own hell.”
4.1
A program should be light and agile, its subroutines connected like a
strings of pearls. The spirit and intent of the program should be
retained throughout. There should be neither too little nor too much,
neither needless loops nor useless variables, neither lack of structure
nor overwhelming rigidity.
A program should follow the ‘Law of Least Astonishment’. What is this
law? It is simply that the program should always respond to the user
in the way that astonishes him least.
A program, no matter how complex, should act as a single unit. The
program should be directed by the logic within rather than by outward
appearances.
If the program fails in these requirements, it will be in a state of
disorder and confusion. The only way to correct this is to rewrite the
program.
4.2
A novice asked the master: “I have a program that sometimes runs and
sometimes aborts. I have followed the rules of programming, yet I am
totally baffled. What is the reason for this?”
The master replied: “You are confused because you do not understand the
Tao. Only a fool expects rational behavior from his fellow humans. Why
do you expect it from a machine that humans have constructed? Computers
simulate determinism; only the Tao is perfect.
The rules of programming are transitory; only the Tao is eternal.
Therefore you must contemplate the Tao before you receive enlightenment.”
“But how will I know when I have received enlightenment?” asked the novice.
“Your program will then run correctly,” replied the master.
4.3
A master was explaining the nature of the Tao to one of his novices,
“The Tao is embodied in all software — regardless of how
insignificant,” said the master.
“Is the Tao in a hand-held calculator?” asked the novice.
“It is,” came the reply.
“Is the Tao in a video game?” continued the novice.
“It is even in a video game,” said the master.
“And is the Tao in the DOS for a personal computer?”
The master coughed and shifted his position slightly. “The lesson is
over for today,” he said.
4.4
Price Wang’s programmer was coding software. His fingers danced upon
the keyboard. The program compiled without an error message, and the
program ran like a gentle wind.
Excellent!” the Price exclaimed, “Your technique is faultless!”
“Technique?” said the programmer, turning from his terminal, “What I
follow is the Tao — beyond all technique. When I first began to
program I would see before me the whole program in one mass. After
three years I no longer saw this mass. Instead, I used subroutines.
But now I see nothing. My whole being exists in a formless void. My
senses are idle. My spirit, free to work without a plan, follows its
own instinct. In short, my program writes itself. True, sometimes
there are difficult problems. I see them coming, I slow down, I watch
silently. Then I change a single line of code and the difficulties
vanish like puffs of idle smoke. I then compile the program. I sit
still and let the joy of the work fill my being. I close my eyes for a
moment and then log off.”
Price Wang said, “Would that all of my programmers were as wise!”
Maintenance
Book Five
Thus spake the master programmer:
“Though a program be but three lines long,
someday it will have to be maintained.”
5.1
A well-used door needs no oil on its hinges.
A swift-flowing steam does no grow stagnant.
Neither sound nor thoughts can travel through a vacuum.
Software rots if not used.
These are great mysteries.
5.2
A manager asked a programmer how long it would take him to finish the
program on which he was working. “I will be finished tomorrow,” the
programmer promptly replied.
“I think you are being unrealistic,” said the manager. “Truthfully, how
long will it take?”
The programmer thought for a moment. “I have some features that I wish
to add. This will take at least two weeks,” he finally said.
“Even that is too much to expect,” insisted the manager, “I will be
satisfied if you simply tell me when the program is complete.”
The programmer agreed to this.
Several years slated, the manager retired. On the way to his
retirement lunch, he discovered the programmer asleep at his terminal.
He had been programming all night.
5.3
A novice programmer was once assigned to code a simple financial
package.
The novice worked furiously for many days, but when his master reviewed
his program, he discovered that it contained a screen editor, a set of
generalized graphics routines, and artificial intelligence interface,
but not the slightest mention of anything financial.
When the master asked about this, the novice became indignant. “Don’t
be so impatient,” he said, “I’ll put the financial stuff in eventually.”
5.4
Does a good farmer neglect a crop he has planted?
Does a good teacher overlook even the most humble student?
Does a good father allow a single child to starve?
Does a good programmer refuse to maintain his code?
Management
Book Six
Thus spake the master programmer:
“Let the programmer be many and the managers
few — then all will be productive.”
6.1
When managers hold endless meetings, the programmers write games. When
accountants talk of quarterly profits, the development budget is about
to be cut. When senior scientists talk blue sky, the clouds are about
to roll in.
Truly, this is not the Tao of Programming.
When managers make commitments, game programs are ignored. When
accountants make long-range plans, harmony and order are about to be
restored. When senior scientists address the problems at hand, the
problems will soon be solved.
Truly, this is the Tao of Programming.
6.2
Why are programmers non-productive?
Because their time is wasted in meetings.
Why are programmers rebellious?
Because the management interferes too much.
Why are the programmers resigning one by one?
Because they are burnt out.
Having worked for poor management, they no longer value their jobs.
6.3
A manager was about to be fired, but a programmer who worked for him
invented a new program that became popular and sold well. As a result,
the manager retained his job.
The manager tried to give the programmer a bonus, but the programmer
refused it, saying, “I wrote the program because I though it was an
interesting concept, and thus I expect no reward.”
The manager, upon hearing this, remarked, “This programmer, though he
holds a position of small esteem, understands well the proper duty of
an employee. Lets promote him to the exalted position of management
consultant!”
But when told this, the programmer once more refused, saying, “I exist
so that I can program. If I were promoted, I would do nothing but
waste everyone’s time. Can I go now? I have a program that I’m
working one.”
6.4
A manger went to his programmers and told them: “As regards to your
work hours: you are going to have to come in at nine in the morning and
leave at five in the afternoon.” At this, all of them became angry and
several resigned on the spot.
So the manager said: “All right, in that case you may set your own
working hours, as long as you finish your projects on schedule.” The
programmers, now satisfied, began to come in a noon and work to the wee
hours of the morning.
Corporate Wisdom
Book Seven
Thus spake the master programmer:
“You can demonstrate a program for a corporate
executive, but you can’t make him computer literate.”
7.1
A novice asked the master: “In the east there is a great tree-structure
that men call ‘Corporate Headquarters’. It is bloated out of shape
with vice-presidents and accountants. It issues a multitude of memos,
each saying ‘Go, Hence!’ or ‘Go, Hither!’ and nobody knows what is
meant. Every year new names are put onto the branches, but all to no
avail. How can such an unnatural entity exist?”
The master replies: “You perceive this immense structure and are
disturbed that it has no rational purpose. Can you not take amusement
from its endless gyrations? Do you not enjoy the untroubled ease of
programming beneath its sheltering branches? Why are you bothered by
its uselessness?”
7.2
In the east there is a shark which is larger than all other fish. It
changes into a bird whose winds are like clouds filling the sky. When
this bird moves across the land, it brings a message from Corporate
Headquarters. This message it drops into the midst of the program-
mers, like a seagull making its mark upon the beach. Then the bird
mounts on the wind and, with the blue sky at its back, returns home.
The novice programmer stares in wonder at the bird, for he understands
it not. The average programmer dreads the coming of the bird, for he
fears its message. The master programmer continues to work at his
terminal, for he does not know that the bird has come and gone.
7.3
The Magician of the Ivory Tower brought his latest invention for the
master programmer to examine. The magician wheeled a large black box
into the master’s office while the master waited in silence.
“This is an integrated, distributed, general-purpose workstation,”
began the magician, “ergonomically designed with a proprietary
operating system, sixth generation languages, and multiple state of the
art user interfaces. It took my assistants several hundred man years
to construct. Is it not amazing?”
The master raised his eyebrows slightly. “It is indeed amazing,” he
said.
“Corporate Headquarters has commanded,” continued the magician, “that
everyone use this workstation as a platform for new programs. Do you
agree to this?”
“Certainly,” replied the master, “I will have it transported to the
data center immediately!” And the magician returned to his tower, well
pleased.
Several days later, a novice wandered into the office of the master
programmer and said, “I cannot find the listing for my new program. Do
you know where it might be?”
“Yes,” replied the master, “the listings are stacked on the platform in
the data center.”
7.4
The master programmer moves from program to program without fear. No
change in management can harm him. He will not be fired, even if the
project is canceled. Why is this? He is filled with the Tao.
Hardware and Software
Book Eight
Thus spake the master programmer:
“Without the wind, the grass does not move.
Without software, hardware is useless.”
8.1
A novice asked the master: “I perceive that one computer company is
much larger than all others. It towers above its competition like a
giant among dwarfs. Any one of its divisions could comprise an entire
business. Why is this so?”
The master replied, “Why do you ask such foolish questions? That
company is large because it is so large. If it only made hardware,
nobody would buy it. If it only maintained systems, people would treat
it like a servant. But because it combines all of these things, people
think it one of the gods! By not seeking to strive, it conquers
without effort.”
8.2
A master programmer passed a novice programmer one day. The master
noted the novice’s preoccupation with a hand-held computer game.
“Excuse me”, he said, “may I examine it?”
The novice bolted to attention and handed the device to the master. “I
see that the device claims to have three levels of play: Easy, Medium,
and Hard”, said the master. “Yet every such device has another level
of play, where the device seeks not to conquer the human, nor to be
conquered by the human.”
“Pray, great master,” implored the novice, “how does one find this
mysterious setting?”
The master dropped the device to the ground and crushed it under foot.
And suddenly the novice was enlightened.
8.3
There was once a programmer who worked upon microprocessors. “Look at
how well off I am here,” he said to a mainframe programmer who came to
visit, “I have my own operating system and file storage device. I do
not have to share my resources with anyone. The software is
self-consistent and easy-to-use. Why do you not quit your present job
and join me here?”
The mainframe programmer then began to describe his system to his
friend, saying: “The mainframe sits like an ancient sage meditating in
the midst of the data center. Its disk drives lie end-to-end like a
great ocean of machinery. The software is a multi-faceted as a diamond
and as convoluted as a primeval jungle. The programs, each unique,
move through the system like a swift-flowing river. That is why I am
happy where I am.”
The microcomputer programmer, upon hearing this, fell silent. But the
two programmers remained friends until the end of their days.
8.4
Hardware met Software on the road to Changtse. Software said: “You are
the Yin and I am the Yang. If we travel together we will become famous
and earn vast sums of money.” And so the pair set forth together,
thinking to conquer the world.
Presently, they met Firmware, who was dressed in tattered rags, and
hobbled along propped on a thorny stick. Firmware said to them: “The
Tao lies beyond Yin and Yang. It is silent and still as a pool of
water. It does not seek fame, therefore nobody knows its presence. It
does not seeks fortune, for it is complete within itself. It exists
beyond space and time.”
Software and Hardware, ashamed, returned to their homes.
Epilogue
Book Nine
Thus spake the master programmer:
“Time for you to leave.”