018: Effective Java for Android developers : Item 3 episode artwork

EPISODE · Oct 8, 2015 · 11 MIN

018: Effective Java for Android developers : Item 3

from Fragmented - AI Developer Podcast · host Spec

In this mini Fragment, we introduce Joshua's third Item: Enforce the Singleton property with a private constructor or an enum type. Stay tuned for more items from our "Effective Java for Android developers" Fragment series. Show Notes Effective Java (2nd Edition) - Joshua Bloch Enforce the Singleton property with a private constructor or an enum type Approaches Create a public static final INSTANCE variable and privatize constructor Same as 1 but privatize variable and expose access with provide factory method getInstance Single element Enums Considerations First two approaches are open to Serialization attacks (deserializing creates new instance) To protect from those declare the fields transient + provide readResolve method Enums are concise, provide free serialization and ironclad Singleton guarantees and are functionally equivalent to first approach Supplemental reading (for the diligent ones that follow shownotes) Dianne Hackborn regretting exposing the base Application class DH again saying Application is a Singleton with crappier semantics Elvis sightings Contact us: @fragmentedcast [twitter.com] @donnfelker [twitter.com] @kaushikgopal [twitter.com]

Episode metadata supplied by the publisher feed · Published Oct 8, 2015

Embed this episode

In this mini Fragment, we introduce Joshua's third Item: Enforce the Singleton property with a private constructor or an enum type. Stay tuned for more items from our "Effective Java for Android developers" Fragment series.

Distinct summary based on available episode metadata or transcript content.

NOW PLAYING

018: Effective Java for Android developers : Item 3

0:00 11:56

No transcript for this episode yet

We transcribe on demand. Request one and we'll notify you when it's ready — usually under 10 minutes.

No similar episodes found.

No similar podcasts found.

Frequently Asked Questions

How long is this episode of Fragmented - AI Developer Podcast?

This episode is 11 minutes long.

When was this Fragmented - AI Developer Podcast episode published?

This episode was published on October 8, 2015.

Can I download this Fragmented - AI Developer Podcast episode?

Yes. Use the download control on the episode player to save the publisher-provided media file.
URL copied to clipboard!