Effective Java 47 Know and use the libraries
2014-04-10 07:25
411 查看
Advantages of use the libraries
By using a standard library, you take advantage of the knowledge of the experts who
wrote it and the experience of those who used it before you.
Use Random.nextInt(int) to get the random number without flaw.
You don't have to waste your time writing ad hoc solutions to problems that are only marginally related to your work.
Performance tends to improve over time, with no effort on your part.
Libraries maintained by community also tend to gain new functionality over time.
Standard libraries is that you place your code in the mainstream. Such code is more easily readable, maintainable, and reusable by the multitude of developers.
Libraries you should know
Every programmer should be familiar with the contents of java.lang, java.util, and, to a lesser extent, java.io. Collections Framework under java.util, Java.util.concurrent.
Summary
Don't reinvent the wheel. If you need to do something that seems like it should be reasonably common, there may already be a class in the libraries that does what you want. If there is, use it; if you don't know, check. Economies of scale dictate that library code receives far more attention than most developers could afford to devote to the same functionality.
By using a standard library, you take advantage of the knowledge of the experts who
wrote it and the experience of those who used it before you.
Use Random.nextInt(int) to get the random number without flaw.
You don't have to waste your time writing ad hoc solutions to problems that are only marginally related to your work.
Performance tends to improve over time, with no effort on your part.
Libraries maintained by community also tend to gain new functionality over time.
Standard libraries is that you place your code in the mainstream. Such code is more easily readable, maintainable, and reusable by the multitude of developers.
Libraries you should know
Every programmer should be familiar with the contents of java.lang, java.util, and, to a lesser extent, java.io. Collections Framework under java.util, Java.util.concurrent.
Summary
Don't reinvent the wheel. If you need to do something that seems like it should be reasonably common, there may already be a class in the libraries that does what you want. If there is, use it; if you don't know, check. Economies of scale dictate that library code receives far more attention than most developers could afford to devote to the same functionality.
相关文章推荐
- Effective Java 英文 第二版 读书笔记 Item 13:Minimize the accessibility of classes and members
- Effective C++ Item 16 Use the same form in corresponding uses of new and delete
- Item 16: Use the same form in corresponding uses of new and delete.(Effective C++)
- use java to execute the cmd and compile to jar file
- Python Programming with the Java(TM) Class Libraries: A Tutorial for Building Web and Enterprise App
- java.lang.UnsatisfiedLinkError与all com.android.support libraries must use the exact same...问题的处理办法
- Use the C and Java to simulate the BigDecimal calculation
- A step-by-step guide to the use of the Intel OpenCV library and the Microsoft DirectShow technology
- java.lang.IllegalArgumentException: AppIndex: The URI host must match the package name and follow th
- stanford编程方法——习题答案(the art and science of java)——chapter03
- [转] How to install the glut libraries and dll's into windows
- [mysql] mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in
- INFO: Font Metrics and the Use of Negative lfHeight
- Effective Java 28 Use bounded wildcards to increase API flexibility
- The use of Git and Bitbucket
- Three tools that make Java code review painless and effective.
- java.lang.IllegalStateException: You need to use a Theme.AppCompat theme
- FolderSync :The various features and how to use them
- jooq使用自定义策略生成代码(How to use a custom strategy with the jOOQ code-generator and Maven?)