很多人學 C++ 不明究理,class 切來切去,繼承來繼承去,搞到最後自己也不知道在做什麼,最後得出一個結論:『C++ 很討厭,太複雜了,不如直接用 C 來的單純』。如果是這樣,來讀 Thinking 系列吧,作者會很巧妙的告訴你為何會有這些複雜的東西,而這些東西又怎麼來幫我們解決程式開發上的問題。
All programming languages provide abstractions. It can be argued that the complexity of the problems you’re able to solve is directly related to the kind and quality of abstraction.
The programmer must establish the association between the machine model (in the “solution space,” which is the place where you’re modeling that problem, such as a computer) and the model of the problem that is actually being solved (in the “problem space,” which is the place where the problem exists).
Thus, OOP allows you to describe the problem in terms of the problem, rather than in terms of the computer where the solution will run. There’s still a connection back to the computer: each object looks quite a bit like a little computer—it has a state, and it has operations that you can ask it to perform. 不使用 Java 的人可以直接看 Thinking in C++。
倒是 Java 系列因為會拿來跟 C++ 作比較,所以會看到很多 Java 跟 C++ 在設計上的不同處。雖然這是老掉牙的比較了,但透過 Bruce 來講這些差異,絕對跟一般我們會看到的大眾觀點,有很顯著的不同,而且是會讓人豁然開朗的那一種。
Code Monkey get up get coffee Code Monkey go to job Code Monkey have boring meeting with boring manager Rob Rob say Code Monkey very diligent but his output stink his code not functional or elegant what do Code Monkey think Code Monkey think maybe manager want to write goddamn login page himself Code Monkey not say it out loud Code Monkey not crazy just proud
Code Monkey like Fritos Code Monkey like Tab and Mountain Dew Code Monkey very simple man with big warm fuzzy secret heart Code Monkey like you Code Monkey like you
Code Monkey hang around at front desk tell you sweater look nice Code Monkey offer buy you soda bring you cup bring you ice you say no thank you for the soda cause soda make you fat anyway you busy with the telephone no time for chat
Code Monkey have long walk back to cubicle he sit down pretend to work Code Monkey not thinking so straight Code Monkey not feeling so great
Code Monkey like Fritos Code Monkey like Tab and Mountain Dew Code Monkey very simple man with big warm fuzzy secret heart Code Monkey like you Code Monkey like you a lot
Code Monkey have every reason to get out this place Code Monkey just keep on working to see your soft pretty face Much rather wake up eat a coffee cake Take bath, take nap This job fulfilling in creative way such a load of crap Code Monkey think someday he have everything even pretty girl like you Code Monkey just waiting for now Code Monkey say someday, somehow
Code Monkey like Fritos Code Monkey like Tab and Mountain Dew Code Monkey very simple man with big warm fuzzy secret heart Code Monkey like you Code Monkey like you