Tuesday, March 12, 2013

你寫code嗎?

“Everybody in this country should learn how to program a computer...because it teaches you how to think."
--Steve Jobs


母校四十週年校慶,我和好朋友Cherry一道回校,和闊別多年的老師們敘舊。沒想到臨走前還碰到中四、中五時的班主任Miss Koo,聽了一個感動的故事。

Cherry剛升中時,成績不算突出,她又內儉,對許多師生來說,只是個中規中矩的同學﹣﹣直到她交出第一份電腦程式(programming)功課。

Miss Koo是數學老師,兼教電腦。我們中一開始要交programming功課,Miss Koo記得當年收到Cherry的功課時大吃一驚,忍不住告訴其他老師:這位同學一定好聰明,因為她寫的program不但精簡,而且邏輯性極強,將來成績一定拔尖。這番話當時可能沒有引起其他老師注意,但三年之後文理分班,Cherry成績果然一枝獨秀,此後兩次公開試,都是全校成績最好的學生。

令Cherry感動的是,當沒有人看到她的潛質、連她自己都未肯定自己的能力時,有一位老師肯定她必光芒四射。而這位老師之所以如此肯定,憑的只是一份初中的programming功課!利用programming功課預測成就,莫非有算八字般厲害?

我小時候也被一些老師視為資優兒童,主要因為我作文成績好。但事實上,一個小朋友作文成績好,除反映其詞𢑥較豐富、記性較佳外,沒有太大啟示。但programming卻遠遠不同。

寫program的目的,是要讓電腦替你完成一個任務。電腦語言遠比中文「簡單」,說到底就是0和1,所以再複雜的任務,都必須經過分類、定義、簡化,被切割成無數細小任務,最後化成按部就班的指示。Programming是最講究精簡的語言,不能有廢話,否則會慢;programming也是最講究結構的語言,嚴密或鬆散的根基,後果會差之毫釐謬之千里。語言越精簡、結構越嚴密,寫出來的program就越有效快捷。一個人的思考過程如何,他寫出來的program必如何,沒有討價還價的空間。所以programming可以準確反映一個人的思維能力,亦能有效訓練思維能力。就像當年的Miss Koo,憑一份programming功課就可斷定Cherry很有潛質。

我認為每個小朋友都應該學programming,當作學樂器一樣,一生受用。中產家長與其訂購一台霸佔整個客廳的豎琴給女兒做生日禮物,不如簡簡單單買部Mac機。

***

相關舊文:寫書

「我有沒有給你說過?好的programmer,也能寫出好文章? 反之也是。
因為好的program,應該簡潔易明、邏輯清楚…(「而且首尾呼應」,我接上去)是,因此如果一個programmer寫得出一篇好文,我也會對他寫的program有信心…

反過來說,你也很有潛質寫program呀。如有一天你想學一種新的語言,別學意大利文啦,不如考慮學C++。」他說得很認真。

13 comments:

Alvin said...

For every Cherry out there that write good, readable, well-structured code, there are dozens, if not hundreds, that write "spaghetti code". And many of them, they program for a living! :)

Leona said...

Alvin, LOL
So why we call those bad codes "spaghetti code" - very lengthy?

Alvin said...

Twisted and tangled, just like a bowl of spaghetti.

Google it! :)

Shumc said...

Why mac?

Leona said...

Shumc,
因為型

哥斯拉 said...

在香港做programming打份工的,永遠都成不了中產!就像有glass ceiling一樣。要上流,就要30歲前轉做management,離開寫program的工作。

近日報導的JPlus及9gag,不過是少數成功例子,香港IT界仍然不算是一個產業,就像香港足球界一樣,偶然拿到一次冠軍,之後又無以為繼,是一個十多年來都沒增長的行業。

SRX said...

將來不單是programmer才要些code. 千年前,讀寫可以靠書吏,現在已經是生存的最低條件。未來的職場,怎都可能需要懂一點coding...例如簡單如excel巨集。多個學系及行業都慢慢被數學/電腦化。一百年前的經濟學,幾乎都是歷史。現在不懂數學的基本上讀不上,而進幾年,不懂program的數學家和物理學家都開始有點壓力。

shangri_la said...

> 在香港做programming打份工的,永遠都成
> 不了中產!就像有glass ceiling一樣。要> 上流,就要30歲前轉做management,離開寫> program的工作

This is the same everywhere, do you think Bill Gates/Steve Jobs got to where they are/were because of their programming skill? They are entrepreneurs!!

For a real computering pioneer, look at Dennis Ritchie, whom few people gave a flying damn when he died the same week as Steve Jobs

GuiltySky said...

樓上兩位都有點搞笑

> shangri_la
外國只會寫programme應該也是可以做個中產吧? 最少物價樓價都比較低, 失敗的成本沒有那麼高, 在香港你30歲還沒找到中產的路就已經完蛋了
而哥斯拉說的是行業沒有增長, 基本的道路根本沒有建好, 就是中產的路完全靠自己摸索, 反過來說你去真正的IT行業, 跟自行走進陷阱沒甚麼局別。

Dennis..中產以上吧?

>SRX
將來時代不同了...知識也不同了
現在20歲以下的有誰不是天生就會寫excel? 一百年前的經濟學是多少年前才會有人去專教這一科目? 當時數學應該已經普及了, 就像將來基本excel普及時, excel教學也已經普及了, 不然的話你應該去問問香港的教育在搞甚麼鬼, 嗯其實這篇不是在說programming有助生存的。

>Leona
與其要年青人走進IT這個陷阱, 還不如多打電腦遊戲, 有自製地圖的就是Programming, 玩別人地圖的就是查找Logic跟Bug了, 何其簡單
這樣IT下去你可能會變成老人家的...哈哈

shangri_la said...

> 外國只會寫programme應該也是可以做個
> 中產吧? 最少物價樓價都比較低, 失敗的
> 成本沒有那麼高

That's fair, however, is that specific to programmer or just life aboard in general is (or at least the common perception of what life aboard is in Hong Kong)? If it is the latter then we are talking about living conditions, not so much about IT or programming, you can argue the same for being, say, a teacher.

As a software developer in US myself, I can tell you that you would get a pretty decent starting salary and you can lead a very comfortable life in your 20s and up to mid 30s. However, one particular catch about computer industry is that your skills could become obsolete much faster once you turn 40s. There will always be fresh college grads who learn the latest technologies in school and they are cheaper to hire. If you were employers, why would you pay more for someone whose skills are outdated? That's why I argue it is just the same here for programmers to go into management after 30s just to stay alive. I can't tell you how many post-40s engineers here found themselves unable to compete with the young kids for job opportunities, or worry about being too expensive when they find themselves unexpectedly out of a job due to economic downturn. Sure you will get steady income *provided* you can hold down your job, but can you still call yourself 中產 when you struggle to get hired?

Don't get me wrong, I like my job because I like problem solving, and I would recommend it to those who pride themselves with their analytical skills but if you go into the field thinking that there is no glass ceiling or the promise of upward mobility (上流), I am afraid you will be surprised even if you are living aboard

Alvin said...

為何學習一種技能就要和就業掛勾?學寫code就要做programmer,難道學駕車的人其實通通都是想做職業司機?

GuiltySky said...

>shangri_la

當然不是說做IT或寫Programme就可以安枕無憂, 只是說在香港失敗的機率和代價都遠大於外國。
你說的30歲後轉型為管理階層是指IT相關的管理嗎? 香港在IT方面無論氛圍或政府政策支持都要比外國差, 無論打工或管理都是一樣的, 是根本行業都沒有發展到。
想問一下在外國這方面到30~40可能失業時有自己的房屋了嗎?

>Alvin
寫programme除了為工作還有甚麼用? 為甚麼要學? 入門難出門也難, 真是要用作訓練思考嗎?

GuiltySky said...

>shangri_la

忘了回應職業方面...教書等等其他一般行業僱主會比較多,行業發展也有一定程度, 會有大公司,對比其他行業是有落後一點, 而且其他行業可能賺錢不比寫Programme多, 但工作最少穩定可以計劃一下未來

行業發展加上生活壓力, 已經足以達到人生的臨界點了

在香港寫Programme我真的沒有信心, 大概轉management前都已經犯愁了, 30歲還在犯愁在香港的代價是致命的