`
zhang_xzhi_xjtu
  • 浏览: 524395 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Effective Java第二版变更之 Creating and Destroying Objects

阅读更多
第2版  Creating and Destroying Objects

Item 1 Consider static factory methods instead of constructors.

Item 2 Consider a builder when faced with many constructor parameters.
Item 2 是新加的一个条目,这个条目介绍了Builer模式的用法,但是似乎和这本书的原有条目的特点不符合。而Builder一般在介绍设计模式的书籍里面会进行全面的介绍。放在这里有些不伦不类。有凑数之嫌。或许大师有其他的考虑。

Item 3 Enforce the singleton property with a private constructor or an enum type.
Item 3 新加入了Enum type来实现Singleton。
从语法上讲,这样当然是可以的,但是谈及Enum对于程序员来说,第一反应一般还是说有几个并列的概念组成的一个枚举集合,一个Enum定义一个元素来实现Singleton怎么看都是怪怪的。

Item 4 Enforce noninstantiability with a private constructor.

Item 5 Avoid creating unnecessary objects.
Item 5 中第一版的duplicate objects变成了unnecessary objects,这个虽然是一个很细小的变动,但是味道十足,慢慢品之。

Item 6 Eliminate obsolete object references.

Item 7 Avoid finalizers.







分享到:
评论

相关推荐

    CSharp - Module 9_Creating and Destroying Objects

    CSharp - Module 9_Creating and Destroying Objects

    Effective Java 3rd edition(Effective Java第三版英文原版)附第二版

    2 Creating and Destroying Objects Item 1: Consider static factory methods instead of constructors Item 2: Consider a builder when faced with many constructor parameters Item 3: Enforce the singleton ...

    JAVA小实验雷电(打飞机)

    Raiden consists of eight vertical scrolling missions where the player pilots the "Raiden Supersonic Attack Fighter" through waves of enemies, dodging and destroying enemy buildings, ground targets, ...

    Java版电子宠物游戏代码

    Java版电子宠物游戏代码,package Petgame; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class Petgame extends MIDlet { private static Petgame instance; private ...

    CD and DVD Forensics(syngress安全图书)

    floppy disks and other media, (c) considerations for handling CD and DVD evidence to both recover the maximum amount of information present on a disc and to do so without destroying or altering the ...

    KafkaOffsetMonitor监控工具2017年1月发布的版本

    Instead, closing and destroying the client and re-creating it. Sleeping on error before re-creating client and continuing to process Deal with thread-safety issues on shared memory between threads ...

    programing C# edition5

    Destroying Objects 79 Passing Parameters 83 iv | Table of Contents Overloading Methods and Constructors 89 Encapsulating Data with Properties 92 readonly Fields 96 5. Inheritance and Polymorphism . . ...

    TCL TK 语言8.5编程指导

    Chapter 12: Creating and Managing Menus 169 Introduction 169 Creating a menu 170 Adding menu buttons 175 Displaying a pop-up menu 178 Data entry application 180 Chapter 13: Creating the Address Book ...

    20190201版PythonForDelphi含例程源码.zip

    PythonForDelphi 修改 最后修改日期2019-2-1这一版,需要注意的是python 3.7 要安装32位版 需要在Delphi中先安装上Python...Demo34 Dynamically creating, destroying and recreating PythonEngine. Uses PytonVersions

    深入理解LINUX内核(影印版)(第3版)

    Creating and Deleting a Process Address Space Section 9.6. Managing the Heap Chapter 10. System Calls Section 10.1. POSIX APIs and System Calls Section 10.2. System Call Handler and Service Routines ...

    Pro PHP Security(Pro)

    Pro PHP Security guides developers through many of the defensive and proactive security measures that can be taken to help prevent attackers from potentially disrupting site operation or destroying ...

    TMS Pack for FireMonkey2.3.0.1

    Improved : block refreshing columns when destroying the component in TTMSFMXSpinner Fixed : Small issue in HTML Rendering engine for anchor rendering in TTMSFMXHTMLEngine Fixed : Issue with ...

    Thor’s Microsoft Security Bible

    Likewise, his namesake, Timothy “Thor” Mullen, has spent his entire adult life both destroying and restoring Microsoft-based security systems. Thor’s Microsoft Security Bible conveys the wisdom ...

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part2

    Q520547 - TcxVirtualVerticalGrid - Possible exception in the TcxvgPainter.DrawRow method when destroying and recreating rows within the BeginUpdate/EndUpdate block Q525420 - The Styles....

    DevExpress VCL 13.1.4(v2013vol1.4) 源码-例子-帮助-part1

    Q520547 - TcxVirtualVerticalGrid - Possible exception in the TcxvgPainter.DrawRow method when destroying and recreating rows within the BeginUpdate/EndUpdate block Q525420 - The Styles....

    U盘量产工具

    - Option for post image verification for both creating from and writing from usb drives. Previously, writing to drives always was verified. Verification may double the imaging time. - Each image ...

    polycom宝利通视频会议软件3.9 2018

    Subject to the terms of this Laboratory and Developer License, POLYCOM grants you a limited, non-exclusive, non-transferable license to install and use, on a DEVICE, the number and type of SOFTWARE ...

    convmv-1.15.tar.gz

    keep memory footprint low by not creating a hash of all files. This disables checking if symlink targets are in subtree. Symlink target pointers will be converted regardlessly. If you convert multiple...

    linux program

    theoretical side of his profession, which is especially reassuring considering his constant fear of accidentally destroying the universe. Outside his research work, he is fascinated by operating ...

    linux architecture

    destroying the universe. Outside his research work, he is fascinated by operating systems, and for more than a decade — starting with an article series about the kernel in 1997 — he has found great ...

Global site tag (gtag.js) - Google Analytics