DBGCOOL

debugging seems to be cool, doesn't it?

Browsing Posts published in June, 2010

C++ Network Programming, Volume I: Mastering Complexity with ACE and Patterns

Details

Name: C++ Network Programming, Volume I: Mastering Complexity with ACE and Patterns
Publisher: Addison-Wesley Professional
Release Date: December 20, 2001
Author: Douglas C. Schmidt, Stephen D. Huston

书名:C++网络编程 卷1:运用ACE和模式消除复杂性
出版社:华中科技大学出版社
出版日期:2003年12月(晚2年)
译者:於春景

Review

在没看这本书之前,就听说过ACE的大名,一直觉得是个挺神奇的框架。看了这本书之后,终于明白了ACE到底是什么了。ACE相对于我们传统的socket编程,就好比是MFC相对于传动的Win32 API。ACE是用C++重新封装了底层的API,不仅仅包括socket,也包括多线程、多进程。而且,还实现了自己的任务、消息机制,非常适合网络程序开发。

ACE可以适用于很多不同的系统,包括最常见的Windows和Linux系统。ACE里面运用了很多模式,而且这些模式是Design Patterns一书不曾介绍的,因为这些模式都是网络程序所特有的。

很奇怪的是,这本书中文版貌似只翻译了卷一,没有人翻译卷二。Google Trends了一下,发现ACE本身也不是很热的词汇。所以要问的是,大家在编写跨平台的网络程序时,使用的是什么框架呢?还是说,很少有人用C++编写跨平台的网络应用?

编程高手箴言Details

书名:编程高手箴言
出版社: 电子工业出版社
出版日期:2003年10月
作者:梁肇新

Review

我大概是2004-2005年左右看的这本书,此书刚一出我就毫不犹豫的买回来了,这本书绝对值得收藏。也许梁大师看到我说这句话一定会反驳我,说此书已经过时啦,呵呵。“过时”这个词看怎么解释了,也许里面的技术过时了,但是里面反映出来的事却会成为历史,永远不会过时。

这本书之所以值得收藏,是因为它记载了曾经风靡全中国的软件:豪杰超级解霸。从书中可以看出梁大师当年开发豪杰超级解霸的辛酸历程,以及所用到的技术。这个软件影响了70后~80初的一代人。相信这个年龄段使用过电脑的人,没有不知道豪杰超级解霸的。但由于国内的环境所限,盗版猖獗,所以估计梁大师也没赚到大钱。如果梁大师出生在国外,也许会把豪杰做得更大。

在2009中国软件技术英雄会上海站,我遇到了梁大师,可谓是面对面的交谈,虽然可能到现在梁大师也不知道我是谁。当时让我感到非常差异的是,听说梁大师最近两年隐居,研究起风水了。并且在会上,梁大师给我们做了个非常精彩的关于创业过程中“地利”问题的演讲。会间休息的时候,梁大师还给我们演示他的手机中自己写的一个计算风水的软件。

话说远了,继续说这本书。这本书里的技术我就不多说了,都是比较底层的,如CPU、内核优化等。主要说说此书第一章谈到的话题,程序员成长的六个阶段:

第一阶段:熟练地使用某种语言

据我观察,国内60%的程序员都停留在这个阶段吧。能熟练掌握C/C++的就不是很多,精通的就更少了。有几个人敢说自己可以清楚的知道STL的实现内幕的?大多都是只会if else和for,甚至还在用goto…反正是可以将就写程序了。

第二阶段:精通某种平台接口(例如Win32 API)

对于我来说,大学的时候只会用C/C++写console程序,自学过部分Win32 API。也就是从工作之后吧,才开始用MFC。连续用C++/MFC写了2年多的程序,才可以说是熟练运用Win32 API和MFC。又过了2年多,在调试MFC程序的过程中,看了一些MFC内部的实现代码,至此可算是略有精通吧。嘿嘿,至少对梁大师括号中的内容应该算是精通了。

第三阶段:了解某个平台底层

这个具体有多底层书中没说,之说算是有了初级内功。

第四阶段:在某个平台上进行深层次的开发

这个比较遗憾,一直没有机会进行深层次的开发。梁大师说,此时语言只是工具,已经不重要了。对于我,我是在Windows和Linux上都有开发,但没有一个开发的比较深层次。

第五阶段:从全局设计大的系统

只要有时间,连MS WORD都能做出来!这句话貌似很多人都说过,但是我不相信。即使在微软,能设计OFFICE架构的人恐怕也不多。国内的WORD也非金山WPS莫属了,但也不过如此,只能跟着时代跑,而不是领跑者。

第六阶段:无招胜有招

已经不关注某个具体的语言、平台了,C/C++/Java都一样,Windows/Linux都一样。

书中梁大师关于中国软件人才的评价到现在为止仍然是正确的:“而我认为,现在中国绝大多数都是初级的程序员,中级的程序员很少,高级的就更少了。”

这是为什么呢?也许还是环境问题,我们要考虑的问题太多了,毕业之后找工作,找到工作攒钱买房子,有了房子娶老婆,生孩子。而欧美呢,毕竟发达国家,吃穿住基本不用愁,所以可以用更多的时间做自己想做的事。只要自己喜欢写程序,就会写一辈子。而国内呢?工作3年开始搞管理,然后技术也就基本扔了。写程序的,永远是新入职的初级程序员…

RolesLines
LeonardHere we go, Pad Thai, no peanuts.
LeonardEveryone keep an eye on Howard in case he starts to swell up.
■ If the amount or size of something swells or if something swells it, it becomes larger than it was before. = increase
SheldonSince it's not bee season, you can have my epinephrine.
上网查了一下,说被蜜蜂蛰过,可以根据情况注射过敏针、抗生素或者肾上腺素。Sheldon刚好属于最后一种,自己备份着肾上腺素呢。
HowardDo I look puffy? I fell puffy.
■ If a part of someone's body, especially their face, is puffy, it has a round, swollen appearance. = swollen
Howard对花生过敏,后面有一集过敏的浑身都肿起来了。
SheldonDon't take it personally, it's his pathology.
■ Pathology is the study of the way diseases and illnesses develop. (MEDICAL)
PennyI do like the one where Lois Lane falls from the helicopter and superman swooshes down and catches her.
SheldonYou realize that scene was rife with scientific inaccuracy.
■ If you say that something, usually something bad, is rife in a place or that the place is rife with it, you mean that it is very common.
LeonardYour entire argument is predicated on the assumption that superman's flight is a feat of strength.
■ If you refer to an action, or the result of an action, as a feat, you admire it because it is an impressive and difficult achievement.
SheldonA combination of the moon's solar reflection and the energy storage capacity of Kryptonian skin cells.
SheldonWell, we don't have a dolly.
■ Dolly is a platform on a roller or on wheels or casters for moving heavy objects.
LeonardGive me a fulcrum and a level and I can move the earth.
■ Fulcrum is the support about which a lever turns.
阿基米德的原话是希腊文的,英文有很多不同的译法,如Give me a place to stand, and I will move the earth.
SheldonYes, but they all involve a Green lantern and a Power ring.
SheldonAh, gravity, thou art a heartless bitch.
■ Thou is an old-fashioned, poetic, or religious word for `you' when you are talking to only one person. It is used as the subject of a verb.
■ Art is an old-fashioned form of the second person singular of the present tense of the verb be.
SheldonYou do understand that our efforts here will in no way increase the odds of you having sexual congress with this woman.
■ sexual congress = sex
SheldonA little messy? The Mandelbrot set of complex numbers is a little messy.
SheldonExplain to me an organizational system where a tray of flatware on a couch is valid.
■ You can refer to the knives, forks, and spoons that you eat your food with as flatware. (AM; in BRIT, use cutlery)
LeonardDid it ever occur to you that not everyone has the compulsive need to sort, organize and label the entire world around them?
■ You use compulsive to describe people or their behaviour when they cannot stop doing something wrong, harmful, or unnecessary.
SheldonThis is not anyone's home. This is a swirling vortex of entropy.
■ If you swirl something liquid or flowing, or if it swirls, it moves round and round quickly.
■ A vortex is a mass of wind or water that spins round so fast that it pulls objects down into its empty center.
■ Entropy is a state of disorder, confusion, and disorganization. (TECHNICAL)
SheldonBecause it was immaculate.
■ If you describe something as immaculate, you mean that it is extremely clean, tidy, or neat.
LeonardWell, we'll get out of your hair.
■ If you get someone out of your hair, you get them to stop bothering or annoying you.
SheldonYou might want to speak in a lower register.
■ In linguistics, the register of a piece of speech or writing is its level and style of language, which is usually appropriate to the situation or circumstances in which it is used. (TECHNICAL)
LeonardI accept your premise. Now, please let's go.
■ A premise is something that you suppose is true and that you use as a basis for developing an idea. (FORMAL) = assumption
SheldonI have to say I slept splendidly. Granted, not long, but just deeply and well.
■ You use granted or granted that at the beginning of a clause to say that something is true, before you make a comment on it.
LeonardA well known folk cure for insomnia is to break in your neighbor's apartment and clean.
■ Someone who suffers from insomnia finds it difficult to sleep.
SheldonAnd snoring, and that's probably just a sinus infection. But it could be sleep apnea.You might want to see an otolaryngologist.
■ When someone who is asleep snores, they make a loud noise each time they breathe.
■ Your sinuses are the spaces in the bone behind your nose.
■ Apnea is transient cessation of respiration.
■ Your respiration is your breathing. (MEDICAL)
■ An otolaryngologista is a medical specialty concerned especially with the ear, nose, and throat.
LeonardThe hallmark of the great human experiment is the willingness to recognize one's mistakes.
■ The hallmark of something or someone is their most typical quality or feature.
LeonardSix two-inch dowels.
One package Phillips-head screws.
■ A dowel is a short thin piece of wood or metal which is used for joining larger pieces of wood or metal together.

未来警察与去年上映的机器侠相比,未来警察在动画效果上有了很大的进步。人和机器人合二为一,2080年的坏人都变成了半人半机器的怪物。这部片子同样是爱情+戏剧+科幻的类型。

记得不久前还跟同事讨论,说十年前经典的港台电影一去不复返了。看来,香港以警察、科幻为题材的电影开始渐渐崭露头角了。希望不久以后,中国也能出现变形金刚似的国际大片吧。

导演:王晶
主演:刘德华 / 徐熙媛 / 范冰冰
类型: 爱情 / 动作 / 科幻
上映日期:2010年3月30日 中国

机器侠
2009年香港拍摄的机器侠,可能是第一部国内将人和机器人结合到一起的片子。看的时候虽然也有大片的感觉,但是明显跟美国有差距。看完这部片子,我对片中人和机器人的评价是,人的场景中几乎没有机器人,机器人的场景中几乎也没有人。有很明显的插播动画的嫌疑,呵呵。Anyway,任何事情都要有个开端,这也意味着中国渐渐有拍摄科幻大片的能力了。这部喜剧加科幻的片子,值得一看。

导演:刘镇伟
主演:孙俪 / 方力申 / 胡军
类型:爱情 / 动作 / 科幻 / 喜剧
上映日期:2009年8月18日 中国