代码改变世界

阅读排行榜

Effective C# 学习笔记(八)多用query语法,少用循环

2011-07-03 22:55 by 小郝(Kaibo Hao), 855 阅读, 收藏,
摘要: 比较后发现 query syntax确实太有优势了,少用循环吧 :) 阅读全文

Effective Java 49 Prefer primitive types to boxed primitives

2014-04-12 08:58 by 小郝(Kaibo Hao), 813 阅读, 收藏,
摘要: Use primitives in preference to boxed primitives whenever you have the choice. Primitive types are simpler and faster. Autoboxing reduces the verbosity, but not the danger, of using boxed primitives. When your program compares two boxed primitives with the ==operator, it does an identity comparison, which is almost certainly not what you want. When your program does mixed-type computations involving boxed and unboxed primitives, it does unboxing, and when your program do 阅读全文

Effective Java 23 Don't use raw types in new code

2014-03-17 10:42 by 小郝(Kaibo Hao), 806 阅读, 收藏,
摘要: Raw types can lead to exceptions at runtime, so don’t use them in new code; Set<Object> is a parameterized type representing a set that can contain objects of any type; Set<?> is a wildcard type representing a set that can contain only objects of some unknown type, and Set is a raw type, which opts out of the generic type system. The first two are safe and the last is not. 阅读全文

Effective C# 学习笔记(四十三)使用Expression处理绑定(属性值更改)事件

2011-08-04 21:59 by 小郝(Kaibo Hao), 800 阅读, 收藏,
摘要: DataBinding的实现原理是当其绑定的属性的值发生变化时将触发属性值改变事件,以调用数据绑定值改变后应触发的逻辑(如更新GridView列表中的数据展现)。其每个属性更改的区分是通过属性的名称来唯一标识的。这样的方法不利于代码的重构,也容易引起书写错误导致不易排查的运行时错误。使用Expression API和反射原理可以帮你解决属性变更触发事件的通用逻辑与属性名称之间的耦合。其实,LINQ TO SQL及 Entity Framework就是构建在System.Linq.Expression的API上的。 阅读全文

Effective Java 69 Prefer concurrency utilities to wait and notify

2014-05-03 21:13 by 小郝(Kaibo Hao), 778 阅读, 收藏,
摘要: using wait and notify directly is like programming in "concurrency assembly language," as compared to the higher-level language provided by java.util.concurrent. There is seldom, if ever, a reason to use wait and notify in new code. If you maintain code that uses wait and notify, make sure that it always invokes wait from within a while loop using the standard idiom. The notifyAll method should generally be used in preference to notify. If notify is used, great care must be taken to ensure liven 阅读全文

Effective C# 学习笔记(七) 重载GetHashCode()方法要小心

2011-07-03 22:52 by 小郝(Kaibo Hao), 713 阅读, 收藏,
摘要: GetHashCode()方法你重载过么?重载的原则是什么? 阅读全文

Effective C# 学习笔记(四十二)理解Expression API的使用方式

2011-08-03 22:49 by 小郝(Kaibo Hao), 696 阅读, 收藏,
摘要: .NET原来就拥有反射的机制来处理运行时的代码动态构建与使用。但这种代码的构建比较复杂,难以维护。而C#的LINQ和Dynamic支持使这个特性更加简单和容易使用。那就是使用Expression 表达式来为运行时提供动态业务逻辑。 阅读全文

Effective Java 15 Minimize mutability

2014-03-10 17:24 by 小郝(Kaibo Hao), 684 阅读, 收藏,
摘要: Use immutable classes as much as possible instead of mutable classes. Advantage Easy to design, implement and use than mutable classes. Less prone to error and more secure. Immutable objects are simple. Immutable objects are inherently thread-safe; they require no synchronization. Immutable objects and their internals can be shared freely between threads. Immutable calss can provide static factories that cache frequently requested instances to avoid creating new in 阅读全文

Effective C# 学习笔记(二)readonly和const的性能和灵活性的权衡

2011-07-02 23:10 by 小郝(Kaibo Hao), 678 阅读, 收藏,
摘要: 你分得清 const 和 staitc readonly 声明的使用场景么?看看这篇文章会有启发的 :) 阅读全文

JavaScript Patterns 3.6 Regular Expression Literal

2014-06-02 12:08 by 小郝(Kaibo Hao), 662 阅读, 收藏,
摘要: Te Regular Expression literal also creates new objects in ECMA Script 5. And one last note that calling RegExp() without new(as a function, not as a constructor) behaves the same as with new. 阅读全文
上一页 1 2 3 4 5 6 ··· 21 下一页