用户操作
[即时聊天] [发私信] [加为好友]
刘晓伟ID:lxwde
167462次访问,排名453好友0人,关注者2
lxwde的文章
原创 27 篇
翻译 34 篇
转载 0 篇
评论 244 篇
最近评论
mldstk:wow power leveling
lshvs2006:你好,你設計的東東非常不錯。
但是,現在有個疑問,不知道,怎樣保存設計的文件,
存成XML 文件格式可能會好一點,但是,不知道如何去存? 需要調用什么接口 或是 需要寫什么 方法嗎?

期待您的指教。謝謝

lsh2011@163.com
zeeler:补上这一部分吧(本人中文表述能力没有lxwde强哦 :) ):
The Singleton
也许最简单的设计模式是Singleton模式了,它可以给某种类型提供唯一的对象,下面是个例子:
(译者按:例子省略)
创建一个唯一对象的关键是防止客户程序员(client programmer)用其他任意方法创建对象,只能用你提供的方法。你必须把所有构造器写成p……
zeeler:翻译的不错呀,全力支持!
不过在Design principles和Classifying patterns之间还有个The Singleton部分好像lxwde漏掉了?还是Bruce Eckel修改版面了?
总之,支持呀,本来我也想翻译一下的,不过没有lxwde这么有毅力,翻译一节就停了,实在很累的,所以非常敬佩lxwde能坚持做这么多!
roger_77:可惜,
这个库被boost放弃了,加入另一个ASIO的网络类库
文章分类
收藏
    相册
    链接
    My articles on codeproject
    SharpFormEditor下载
    Thinking in Patterns中文版
    友情链接
    alai04
    C++的罗浮宫
    fatalerror99
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 The Art of Maintenance Programming收藏

    新一篇: 翻译TIPatterns--多个编程语言(Multiple languages)-1 | 旧一篇: 翻译TIPatterns--模式重构(Pattern refactoring)

    The Art of Maintenance Programming

     

    最近项目人员变动,有一半时间都在维护别人的代码,真是有些不适应,主要是一开始对于Maintenance Programming没啥认识,太想当然了,本以为既能学东西还能算工作量。不知道其他人都是怎么维护别人留下来的代码的。

     

    前两天看到CodeProject上一篇短好文实说Maintenance Programming Good Practices的:

    http://www.codeproject.com/gen/design/artmaintenance.asp

     

    可惜看到有点晚了):

    人家说了9条,也懒得翻了,没看过的听俺大概说说:


    1. Get to Like It (先喜欢上它)

        说起来容易做起来可难,让写程序的心甘情愿去维护别人的代码,而且还要like,确实难。


    2. Get Familiar with the Functionality of the Software You Maintain (熟悉你需要维护的软件的功能)

        你得维护还得改bug,想不熟悉都难。但还是觉得一开始比较痛苦。


    3. Get Familiar with the Architecture of the Software You Maintain(熟悉你所维护软件的架构)

        熟悉熟悉多学一点东西。


    4. Communicate with the Users(多跟用户沟通)

        沟通一下也没啥坏处。


    5. If Possible, Communicate with Original Developers(如果可能,跟原来的那个开发人员多沟通)

        通常这个是不大可能的。要是人家还在,PM一般也不会让别人来维护这部分代码。


    6. Keep the History of Changes (保留改动的记录)

        这个基本上就靠版本控制软件了。

     

    7. Be Conservative (越保守越好)

        一开始还不信,有些维护起来比较痛苦的地方,我还试图把它重写一下,后来发现行不通的时候自己都傻了,只能退回到一个礼拜以前的状态。

    • How would it benefit your organization and its customers? The fact that some code is ugly, or looks ugly to you is not per se a reason to rewrite it. If a customer wants a feature that can’t be added to existing code, that could be a reason to consider rewriting it.
    • Are you sure you understand what this code does and how it works?
    • Are you sure you understand how it interacts with other parts of the system, and which modules and functionality depend on the code you want to rewrite?
    • Are you sure you can make it better? Maybe you run into the same problems the original developers did, and make it same or even worse.

    8. Test after Every Change You Make(每次有改动都跑一下测试代码)

        这条对于C++写的程序来说太难做到了,试过CppUnitTUTCppUnit还好一点,可以嵌到VC6IDE里,但写测试代码也是不胜其烦。俺也知道Test driven是好东东,有谁用的得心应手一定要把好经验分享一下。

     

    9. Adopt Existing Code Conventions Even If You Don’t Like Them(即使你不喜欢原来的编码规范也要接受它)

     

        Code conventions are something people get religious about。但是如果不强迫自己慢慢适应你的前任的编码习惯(至少在你维护代码的时候),到后面会越来越痛苦。作者说了,adopt one of the existing conventions, and don’t introduce yet another one.

     

     

    发表于 @ 2004年12月31日 18:01:00|评论(loading...)|编辑

    新一篇: 翻译TIPatterns--多个编程语言(Multiple languages)-1 | 旧一篇: 翻译TIPatterns--模式重构(Pattern refactoring)

    评论

    #I don't know 发表于2004-12-31 22:58:00  IP: 61.149.101.*
    Get Familiar with the Architecture of the Software You Maintain(跟你维护的那个软件的架构师混熟)
    -------------------------------------------
    老兄,是熟悉你所要维护的软件的架构吧?!
    #lxwde 发表于2005-01-01 14:54:00  IP: 61.165.243.*
    我靠,果真是,好几天以前看的,昨天copy的时候就没注意了,真实不好意思。都怪这个单词太长了):
    马上改。多谢纠正。
    #lxwde 发表于2005-01-01 15:18:00  IP: 61.165.243.*
    见鬼了不能提交,以后再说吧。
    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © lxwde