The Art of Readable Code的笔记(34)


按有用程度 按页码先后 最新笔记

  • forgetthisuser

    forgetthisuser (So many papers unread)

    Names like i, j, iter, and it are commonly used as indices and loop iterators. Even though these names are generic, they’re understood to mean “I am an iterator.” (In fact, if you used one of these names for some other purpose, it would be confusing—so don’t do that!) But sometimes there are better iterator names than i, j, and k. For instance, the following loops find which users belong t...

    2013-02-05 12:12   1人喜欢

  • [已注销]


    Keeping Your Codebase Small 不错.   (1回应)

    2011-11-25 11:59

  • 深度霸王学习机

    深度霸王学习机 (Half The World is Watching Me)

    Word Alternatives send: deliver, dispatch, announce, distribute, route find: search, extract, locate, recover start: launch, create, begin, open make: create, set up, build, generate, compose, add, new

    2013-11-16 21:30

  • ziyoudefeng

    ziyoudefeng (娜娜,有你生活真幸福~~)

    哈哈,对着一支塑料橡皮鸭子调bug,好有想象力。不过,我觉得对着边上的妹子更有情调。 一会,跟边上的妹子商量一下,看以后能否互相调bug~~ But this process of “saying things in plain English” is applicable outside of just writing code. For example, one college computer lab policy states that when a student needs help debugging his program, he first has to explain the problem to ...

    2012-12-23 10:24

  • ziyoudefeng

    ziyoudefeng (娜娜,有你生活真幸福~~)

    A lot of coders don’t like to write comments because it feels like a lot of work to write a good one. When writers have this sort of “writer’s block,” the best solution is to just start writing. So the next time you’re hesitating to write a comment, just go ahead and comment what you’re thinking, however half-baked it may be 不要怕自己不会注释,不用想太多,把自己脑子里怎么想的写下来就..

    2012-12-15 21:38

  • selevent

    selevent (每天靠近爱,良质与真理多一点。)

    Test code should be readable so that other coders are comfortable changing or adding test. 这一章强调了ut的可读性。观点是ut的可读性能够使得: 1. 使用者能够更加清楚的理解函数的作用,可以作为demo来用。 2. 使得开发人员更乐意的修改和添加新的case。 在模块的迭代过程中,编写ut的困难性,阻碍了整个模块的可测性,使得模块代码质量的下降。 对这一点深有体会。目前普遍对ut的重视性不够,在产品代码的可...

    2012-11-13 00:41

  • selevent

    selevent (每天靠近爱,良质与真理多一点。)

    这个部分介绍了重构代码的技巧,主要focus在函数级别层面。包含了4个章节: Chap.10 Extracting Unrelated Subproblems 将与应用无关的逻辑与通用的utility逻辑分开,将utility函数单列出来形成通用库函数供应用逻辑调用。 应用逻辑code数量变少,开发者不用被“不相关”逻辑分心,且主要逻辑部分code更加清晰。 Chap.11 One Task at a Time 要按照逻辑和功能对函数内部进行分块或以函数形式组织,将相同逻辑处理部分放...

    2012-11-06 00:31

  • selevent

    selevent (每天靠近爱,良质与真理多一点。)

    You do not really understand something unless you can explain it to your grandmother. -- Albert Einstein 跟白居易读诗给老妪的故事一样,诗要写的明白易懂,code也是。 这章介绍的方法其实相当实用,在下手写code之前先用日常语言表达要实现的逻辑。很多人写代码的时候急于一时,并没有做详细的考虑,实现功能就行,写出来的代码逻辑相当混乱,可读性低。而表达的过程就是组织自己实现逻辑的机会,组织code会更加有条...

    2012-11-05 23:43

  • W·思维印记

    W·思维印记 (热爱生活,享受孤独,保持幽默!)

    So if an identifier has a large scope, the name needs to carry enough information to make it clear. P42 Consistent style is more important than the "right" style.

    2012-08-12 23:04

  • curer

    curer (comfortably numb)

    REMOVING UNUSED CODE 这个真的很难啊,这个就像书里写的,这相当于放弃了之前的工作。这是我的一个非常大的坏习惯。在生产环境下,这个的确产生了很多额外的代码,增加的代码维护成本。 很多情况由于需求改变,而导致的功能变化,而旧的逻辑并没有被删除掉。而且后面也真的没有再使用这些功能,而这些功能的代码却保留在工程中。导致移植过程中又消耗了好多额外的脑力。真的是一个非常坏得习惯。 换一个角度,把自己当成...

    2012-08-02 23:28

<前页 1 2 3 4 后页>



The Art of Readable Code

>The Art of Readable Code