Skip to content
TrackPodcasts
educationOct 15, 20156:33pending

019: Effective Java for Android developers : Item 4

About this episode

Singer and Android developer Donn Felker explores Joshua Bloch's fourth Item: Enforce noninstantiability with a private constructor.

Stay tuned, cause we got more of these quick ones coming.

Enforce noninstantiability with a private constructor.

Examples where you don't want class to be instantiated

  1. class that groups static methods and static fields (Util like classes think java.lang.Math/java.util.Arrays)
  2. class that groups static methods (including factory methods) for objects implementing specific interfaces (think java.util.Collections)
  3. class that group methods on a final class (vs. extending the class)

Considerations

  • Makes no sense to instantiate such "Util" classes
  • Private constructors prevent instantiation
  • Important side effect: prevents subclassing

Contact us:

Get every episode summarized

Each time Fragmented - AI Developer Podcast publishes, we email you a written briefing from the transcript — the topics, who appeared, and any specific claims, with the ad reads skipped.

Email me new episodes

Free for 3 shows. No card needed.

Hosts & guests

No transcript yet

This episode has not been transcribed. Request it and it moves to the front of the queue.

019: Effective Java for Android developers : Item 4

Fragmented - AI Developer Podcast

0:00
6:33

More episodes

More from Fragmented - AI Developer Podcast

View all episodes →