代码改变世界

阅读排行榜

Effective C# 学习笔记(三十一)利用IComparable<T>和IComparer<T>接口来实现排序关系

2011-07-17 21:13 by 小郝(Kaibo Hao), 389 阅读, 收藏,
摘要: 你的类型需通过描述在集合中该类型的对象该如何排序和被查找来说明其排序关系。 .NET framework中定义了ICommaprable和IComparer接口来为你的类型定义排序关系。 前者定义了你类型的自然排序方式,后者则定义了其他的排序方式(通过,=等运算关系的定义来提高在运行时的比较性能)。 阅读全文

Effective Java 56 Adhere to generally accepted naming conventions

2014-04-20 10:08 by 小郝(Kaibo Hao), 381 阅读, 收藏,
摘要: Internalize the standard naming conventions and learn to use them as second nature. The typographical conventions are straightforward and largely unambiguous; the grammatical conventions are more complex and looser. To quote from The Java Language Specification [JLS, 6.8], "These conventions should not be followed slavishly if long-held conventional usage dictates otherwise." Use common sense. 阅读全文

JavaScript Patterns 4.9 Configuration Objects

2014-06-17 09:00 by 小郝(Kaibo Hao), 375 阅读, 收藏,
摘要: Passing a large number of parameters is not convenient. A better approach is to substitute all the parameters with only one and make it an object. 阅读全文

Effective Java 61 Throw exceptions appropriate to the abstraction

2014-04-25 22:38 by 小郝(Kaibo Hao), 375 阅读, 收藏,
摘要: If it isn't feasible to prevent or to handle exceptions from lower layers, use exception translation, unless the lower-level method happens to guarantee that all of its exceptions are appropriate to the higher level. Chaining provides the best of both worlds: it allows you to throw an appropriate higher-level exception, while capturing the underlying cause for failure analysis (Item 63). 阅读全文

Effective C# 学习笔记(二十四)运用Delegates来实现回调

2011-07-15 19:33 by 小郝(Kaibo Hao), 375 阅读, 收藏,
摘要: 代理提供了类型安全的回调定义,可以让你在运行时配置你的行为,并且可以通知多个客户端。代理其实是一个指向方法的引用,该方法可以是静态方法也可以是动态实例的。.NET Framework利用 Predicate,Action及Func等类型来定义代理。 但由于历史原因,所有的代理都是多播代理。即所有的代理都是统一顺序执行的,而且若其中一个代理发生了异常,则剩下的代理将无法执行,而且返回值是最后一个添加到代理的方法的返回值。 阅读全文

Effective C# 学习笔记(四十六)对异常进行分类并逐类处理

2011-08-06 22:05 by 小郝(Kaibo Hao), 374 阅读, 收藏,
摘要: 对于异常的认识 1. 异常并不是包括所有错误条件 2. 抛出的异常最好是有定义的针对特殊类别的异常类型,不要总是使用System.Exception来处理异常,这样你可以针对不同的异常进行不同的Catch操作。可以从以下方面定义(这里只是抛砖引玉): a. 找不到文件或目录 b. 执行权限不足 c. 丢失网络资源 阅读全文

JavaScript Patterns 4.5 Immediate Functions

2014-06-11 23:44 by 小郝(Kaibo Hao), 369 阅读, 收藏,
摘要: Immediate Functions helps you wrap an amount of work you want to do without leaving any global variables behind. All the variables you define will be local to the self-invoking functions and you don’t have to worry about polluting the global space with temporary variables. 阅读全文

Effective C# 学习笔记(二十八)创建基于网络分布式部署的APIs

2011-07-16 22:45 by 小郝(Kaibo Hao), 368 阅读, 收藏,
摘要: 现在越来越多应用采用分布式部署,这种部署方式受限于带宽和并发事务。对于此类应用你应该提供低频率的事务操作和尽量少数据量交互,也就是尽量少的运用有限的带宽来传输数据。本文举例说明该如何设计你的APIs。 阅读全文

Effective C# 学习笔记(九) 在你的API中避免使用类型转换运算

2011-07-04 20:25 by 小郝(Kaibo Hao), 368 阅读, 收藏,
摘要: 类型转换会影响使你的程序得到意想不到的结果,你要谨慎使用呦 阅读全文

JavaScript Patterns 5.6 Static Members

2014-06-30 22:52 by 小郝(Kaibo Hao), 365 阅读, 收藏,
摘要: This post introduces how to implement the public or private static members in JavaScript. 阅读全文
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 21 下一页