慧伟's profile流水不腐PhotosBlogListsMore Tools Help

Blog


    30 December

    君子善假于物

    简单地记下读代码的量变。

    1、10行
    直接读
    2、100行
    100行的程序基本上不存在复杂的函数调用,关注控制语句(if,else,while,for),分成块来读
    注:写的时候也先写控制语句再写控制块里面的代码
    3、1000行
    用source insight关注函数调用,用读100行的方法读每个函数
    4、10000行
    用source insight也感觉不够了,因为这个级别的代码,函数调用会跨过很多个源程序,即使用source insight来跟也会跳三四次或者更多。在很多个文件之间跳来跳去,注意力很快就分散了,效率也很低。这时需要用函数调用图(call graph)对全局有一个认识,加上读1000行的方法。

    最近做的事情就是读和修改>10000行代码的事。在今天之前,函数调用图都是手动用mindmap工具(Mindjet MindManager)画的。画了好几幅以后,终于受不了了,就想着是不是可以自动画。基于现在知道的工具:ctags, graphviz,要没有现成的,那就自己写了。写好了还可以给其他人用。

    google了一下,果然是有这样的工具。参考下文:分析函数调用关系图(call graph)的几种方法

    该博客的Title介绍是这么写的:
    陈硕的blog:
    吾尝终日而思矣,不如须臾之所学也。吾尝跂而望矣,不如登高之博见也。……君子生非异也,善假于物也。
    受益匪浅!

    善用工具才能事半功倍!

    Comments (1)

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    君子善假于物,君子不器
    30 Dec.

    Trackbacks

    The trackback URL for this entry is:
    http://fire1983.spaces.live.com/blog/cns!9DC52672F572FD6E!2013.trak
    Weblogs that reference this entry
    • None