代码改变世界

阅读排行榜

Effective Java 37 Use marker interfaces to define types

2014-03-31 09:03 by 小郝(Kaibo Hao), 564 阅读, 收藏,
摘要: If you find yourself writing a marker annotation type whose target is ElementType.TYPE, take the time to figure out whether it really should be an annotation type, or whether a marker interface would be more appropriate. 阅读全文

NHiberate学习笔记(3)—懒加载

2009-10-06 17:20 by 小郝(Kaibo Hao), 564 阅读, 收藏,
摘要: 继续学习NHibernte ,这一篇学习懒加载... 阅读全文

Effective Java 71 Use lazy initialization judiciously

2014-05-05 08:40 by 小郝(Kaibo Hao), 559 阅读, 收藏,
摘要: You should initialize most fields normally, not lazily. If you must initialize a field lazily in order to achieve your performance goals, or to break a harmful initialization circularity, then use the appropriate lazy initialization technique. For instance fields, it is the double-check idiom; for static fields, the lazy initialization holder class idiom. For instance fields that can tolerate repeated initialization, you may also consider the single-check idiom. 阅读全文

Effective Java 18 Prefer interfaces to abstract classes

2014-03-13 09:56 by 小郝(Kaibo Hao), 559 阅读, 收藏,
摘要: Advantages of Interfaces Existing classes can be easily retrofitted to implement a new interface. Interfaces are ideal for defining mixins. Interfaces allow the construction of nonhierarchical type frameworks. (Composite) 阅读全文

Effective Java 73 Avoid thread groups

2014-05-07 07:42 by 小郝(Kaibo Hao), 549 阅读, 收藏,
摘要: Thread groups don't provide much in the way of useful functionality, and much of the functionality they do provide is flawed. Thread groups are best viewed as an unsuccessful experiment, and you should simply ignore their existence. If you design a class that deals with logical groups of threads, you should probably use thread pool executors (Item 68). 阅读全文

Effective C# 学习笔记(三十六) 理解PLINQ对IO上瓶颈的处理方式

2011-07-23 21:04 by 小郝(Kaibo Hao), 549 阅读, 收藏,
摘要: IO操作一般会成为程序性能的瓶颈,我们可以用并行的方式来提高该方面的操作效率。 阅读全文

Effective Java 63 Include failure-capture information in detail message

2014-04-27 20:46 by 小郝(Kaibo Hao), 548 阅读, 收藏,
摘要: As suggested in Item 58, it may be appropriate for an exception to provide accessor methods for its failure-capture information (lowerBound, upperBound, and inde xin the above example). It is more important to provide such accessor methods on checked exceptions than on unchecked exceptions, because the failure-capture information could be useful in 阅读全文

Effective C# 学习笔记(二十七)使你的类型可被序列化

2011-07-16 11:12 by 小郝(Kaibo Hao), 546 阅读, 收藏,
摘要: .net中提供了类型对象序列化的简便实现方式,类型的持久性是一个类型的核心概念,为了使你的类的消费者在使用你的类型对象作为属性或使用你的类型作为父类时,能够方便的序列化他们创建的新类型,你应该尽可能的使你的类型可被序列化。否则这些可被序列化的特性的实现就要交给你的那些类型的消费者了,可惜他们并不比你更了解你的类型。所以使你的类型可被序列化是你应尽的义务和责任…... 阅读全文

Effective Java 39 Make defensive copies when needed

2014-04-02 08:44 by 小郝(Kaibo Hao), 545 阅读, 收藏,
摘要: If a class has mutable components that it gets from or returns to its clients, the class must defensively copy these components. If the cost of the copy would be prohibitive and the class trusts its clients not to modify the components inappropriately, then the defensive copy may be replaced by documentation outlining the client's responsibility not to modify the affected components. 阅读全文

Effective Java 24 Eliminate unchecked warnings

2014-03-18 19:34 by 小郝(Kaibo Hao), 541 阅读, 收藏,
摘要: Unchecked warnings are important. Don't ignore them. Every unchecked warning represents the potential for a ClassCastException at run-time. Do your best to eliminate these warnings. If you can't eliminate an unchecked warning and you can prove that the code that provoked it is typesafe, suppress the warning with an @SuppressWarnings("unchecked") annotation in the narrowest possible scope. Record the rationale for your decision to suppress the warning in a comment. 阅读全文
上一页 1 2 3 4 5 6 7 8 9 ··· 21 下一页