上传一本书(Agile_Java英文版)

本文分享了《Java核心技术》一书中提出的几个重要的编程习惯与原则,包括单一职责原则、构造器私有化、避免通过实例访问类方法等。这些原则有助于提高代码质量和系统的可维护性。
英文版得书,另外添加一本java核心技术的英文版.(如需要中文版,留言)
最近在看这本书,书中一些好的编程习惯也列出来,供以后参考.

1.Design your methods to either change object state or return information, not both.
2.Single-Responsibility Principle.
One of the most basic design principles in object-oriented programming is that a class should do one thing and do it well. By virtue of doing this one thing, the class should have only one reason to change. This is known as the Single-Responsibility Principle
3.By declaring the constructor as private, only code in the DateUtil class can construct new DateUtil instances. No other code will be able to do so. While it wouldn't be harmful to allow creation of DateUtil objects, keeping clients from doing something nonsensical and useless is a good idea
4.It is possible to access a class method or variable from the instance side of a class without specifying the class name.Even though it will work, avoid doing this. Accessing class methods without using the class name introduces unnecessary confusion in your code and is considered bad form.

5. The more you depend upon concrete types, the more difficult your system is to change. The more you depend upon abstract types (interfaces), the easier your system is to change. By introducing interfaces, you build an abstraction barrier between the client and a concrete server class.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值