代码改变世界

阅读排行榜

Effective Java 59 Avoid unnecessary use of checked exceptions

2014-04-23 17:50 by 小郝(Kaibo Hao), 451 阅读, 收藏,
摘要: If the programmer using the API can do no better an unchecked exception would be more appropriate. The checked nature of the exception provides no benefit to the programmer, but it requires effort and complicates programs.Turning a checked exception into an unchecked exception is to break the method that throws the exception into two methods, the first of which returns a boolean that indicates whether the exception would be thrown. 阅读全文

Effective Java 27 Favor generic methods

2014-03-21 08:16 by 小郝(Kaibo Hao), 450 阅读, 收藏,
摘要: Generic methods, like generic types, are safer and easier to use than methods that require their clients to cast input parameters and return values. Like types, you should make sure that your new methods can be used without casts, which will often mean making them generic. And like types, you should generify your existing methods to make life easier for new users without breaking existing clients (Item 23). 阅读全文

Effective Java 45 Minimize the scope of local variables

2014-04-08 19:45 by 小郝(Kaibo Hao), 448 阅读, 收藏,
摘要: By minimizing the scope of local variables, you increase the read-ability and maintainability of your code and reduce the likelihood of error. 阅读全文

Effective Java 21 Use function objects to represent strategies

2014-03-15 20:41 by 小郝(Kaibo Hao), 444 阅读, 收藏,
摘要: In the Java the function pointers is implemented by the declaring an interface to represent strategy and a class that implements this interface for each concrete strategy. It is possible to define an object whose methods perform operations on other objects, passed explicitly to the methods. An instance of a class that exports exactly one such method is effectively a pointer to that method. 阅读全文

Effective Java 14 In public classes, use accessor methods, not public fields

2014-03-09 11:50 by 小郝(Kaibo Hao), 443 阅读, 收藏,
摘要: Principle To offer the benefits of encapsulation you should always expose private field with public accessor method. 阅读全文

Effective Java 40 Design method signatures carefully

2014-04-03 08:53 by 小郝(Kaibo Hao), 442 阅读, 收藏,
摘要: Choose method names carefully.Don't go overboard in providing convenience methods.Avoid long parameter lists.Break the method up into multiple methods. Such as sublist element of List interface.Create helper classes to hold groups of parameters.Adapt the builder pattern form object construction to method invocation.See item For parameter types, favor interfaces over classes.Prefer two-element enum types to boolean parameters. 阅读全文

Effective C# 学习笔记(五) 最好重载你所创建类的ToString()方法

2011-07-02 23:15 by 小郝(Kaibo Hao), 440 阅读, 收藏,
摘要: 人人为我,我为人人,大家都来重载ToString()方法吧 阅读全文

NHibernate学习笔记(1)—从单表增删改查开始

2009-10-03 16:24 by 小郝(Kaibo Hao), 440 阅读, 收藏,
摘要: 从今天开始,我开始把我的NHibernate的学习笔记记在这里,作为自己的备忘录,以及园子里面的同志的参考。本人学习参考的是 李永京 的 NHibernate之旅,希望新版的NHibernate 2.1能在数据访问层给我更多的惊喜。这是我的第一个NHibernate程序的代码。To be continued... 阅读全文

JavaScript Patterns 5.3 Private Properties and Methods

2014-06-25 12:31 by 小郝(Kaibo Hao), 437 阅读, 收藏,
摘要: This post introduces how to limit the access scope of the field and method of the object. 阅读全文

Effective Java 07 Avoid finallizers

2014-03-01 21:56 by 小郝(Kaibo Hao), 436 阅读, 收藏,
摘要: In summary, don't use finalizers except as a safety net or to terminate noncritical native resources. In those rare instances where you do use a finalizer, remember to invoke super.finalize. If you use a finalizer as a safety net, remember to log the invalid usage from the finalizer. Lastly, if you need toassociate a finalizer with a public, nonfinal class, consider using a finalizer guardian, so finalization can take place even if a subclass finalizer fails to invoke super.finalize. 阅读全文
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 21 下一页