代码改变世界

阅读排行榜

Effective C# 学习笔记(四)使用Conditional Attributes 替代 #if

2011-07-02 23:14 by 小郝(Kaibo Hao), 512 阅读, 收藏,
摘要: 关于 Conditional Attributes 你了解多少? #if 是否该退休了? 阅读全文

Effective C# 学习笔记(三十五) 了解PLINQ如何实现并行算法

2011-07-21 22:11 by 小郝(Kaibo Hao), 511 阅读, 收藏,
摘要: AsParallel() 是PLINQ的一个方法,它使得并行编程变得简单,但是其并不能解决并行编程中的所有问题。本文对利用PLINQ来进行并行编程的内部机制来进行解析。 阅读全文

Effective C# 学习笔记(二十九)在范型中的协变和逆变

2011-07-17 17:34 by 小郝(Kaibo Hao), 510 阅读, 收藏,
摘要: 协变:若一个返回值类型可以用该类型的子类型(继承类型)替代,我们就说该类型是可协变的; 逆变:若一个参数的类型可以用该类型的父类型(被继承类型)替代,我们就说该类型是被逆变的。 在你的范型声明、使用中,注意支持协变(Covariance)和逆变(Contravariance)。编译器会捕捉你使用不当的逆变或协变行为。 阅读全文

Effective Java 74 Implement Serializable judiciously

2014-05-08 22:25 by 小郝(Kaibo Hao), 509 阅读, 收藏,
摘要: Unless a class is to be thrown away after a short period of use, implementing Serializable is a serious commitment that should be made with care. Extra caution is warranted if a class is designed for inheritance. For such classes, an intermediate design point between implementing Serializable and prohibiting it in subclasses is to provide an accessible parameterless constructor. This design point permits, but does not require, subclasses to implement Serializable. 阅读全文

Effective Java 38 Check parameters for validity

2014-04-01 18:29 by 小郝(Kaibo Hao), 509 阅读, 收藏,
摘要: Each time you write a method or constructor, you should think about what restrictions exist on its parameters. You should document these restrictions and enforce them with explicit checks at the beginning of the method body. 阅读全文

Effective Java 06 Eliminate obsolete object references

2014-02-28 22:58 by 小郝(Kaibo Hao), 507 阅读, 收藏,
摘要: Nulling out object references should be the exception rather than the norm. Another common source of memory leaks is caches. A third common source of memory leaks is listeners and other callbacks. 阅读全文

Effective C# 学习笔记(四十八)使用安全代码

2011-08-07 10:04 by 小郝(Kaibo Hao), 507 阅读, 收藏,
摘要: .NET 运行时保证了恶意代码不可在远程设备上(即跨Internet、Intranet)执行,但一些分布式部署的应用需要执行远程操作。若CLR不信任某个程序集,它就不会执行程序集的某个操作,这种行为叫做CAS(Code access security)。CLR执行基于角色的权限控制。这种控制是在运行时校验的,编译时无法强制检验,而且在你的开发机上也很难发现这些权限控制的约束,因为你硬盘上的代码拥有较高的执行权限。在处理此类非安全代码时,原则是首先看能否通过其他方式不去访问这些受保护的资源;若必须使用,则将这些代码放到一个独立的程序集中。 阅读全文

JavaScript Patterns 6.6 Mix-ins

2014-07-21 10:58 by 小郝(Kaibo Hao), 504 阅读, 收藏,
摘要: This post introduces how to combine different parent's properties into one child object. 阅读全文

Effective C# 学习笔记(十) 用可选参数尽量减少方法重载

2011-07-04 20:30 by 小郝(Kaibo Hao), 500 阅读, 收藏,
摘要: C# 引入了可选参数和命名参数的语法以简化函数的声明和使用,但使用上有些细节还是要注意的... 阅读全文

Effective Java 04 Enforce noninstantiability with a private constructor

2014-02-26 22:33 by 小郝(Kaibo Hao), 494 阅读, 收藏,
摘要: A class can be made noninstantiable by including a private constructor. 阅读全文
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 21 下一页