014: Effective Java for Android developers : Item 1 episode artwork

EPISODE · Aug 10, 2015 · 17 MIN

014: Effective Java for Android developers : Item 1

from Fragmented - AI Developer Podcast · host Spec

We've mentioned the book "Effective Java" by Joshua Bloch quite a few times on previous episodes. At this point, everyone knows they should have read this book (quadruple times). But it's a dense read and everyone could use a reading buddy. Also, what does Effective Java look like through the eyes of an Android developer? In this second installment of our Fragment (a.k.a mini-episode), we thought we'll do our listeners a favor and help with that reading. We introduce the very first of these venerable "Items": Consider providing static factory methods instead of constructors. Stay tuned for more items from our "Effective Java for Android developers" Fragment series. Show Notes: Effective Java (2nd Edition) - Joshua Bloch Consider providing static factory methods instead of constructors static factory method makeText for Toast class [androidxref.com] ObjectAnimator [androidxref.com]: .ofInt [androidxref.com] .ofArgb [androidxref.com] .ofFloat [androidxref.com] Advantages: You can control the name and thus give it much more meaningful names You are not required to create a "new" object each time they are invoked You can even return an object that's a subtype of the return type (unlike constructors which only return class type) e.g.  Java Collections framework [grepcode.com] Disadvantages: Classes without public or protected constructors cannot be subclassed Static factory methods are not readily distinguishable from other static methods Takeaways "Consider" using static factory methods (not always) Use  newInstance when creating Fragments [androiddesignpatterns.com] Use newIntent static factory method for creating intents inside the target activity. Contact us: @fragmentedcast [twitter.com] @donnfelker [twitter.com] @kaushikgopal [twitter.com]

Episode metadata supplied by the publisher feed · Published Aug 10, 2015

Embed this episode

We've mentioned the book "Effective Java" by Joshua Bloch quite a few times on previous episodes. At this point, everyone knows they should have read this book (quadruple times). But it's a dense read and everyone could use a reading buddy. Also, what does Effective Java look like through the eyes of an Android developer? In this second installment of our Fragment (a.k.a mini-episode), we thought we'll do our listeners a favor and help with that reading. We introduce the very first of these venerable "Items": Consider providing static factory methods instead of constructors.

Distinct summary based on available episode metadata or transcript content.

NOW PLAYING

014: Effective Java for Android developers : Item 1

0:00 17:13

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 17 minutes long.

When was this Fragmented - AI Developer Podcast episode published?

This episode was published on August 10, 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!