TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Why is “advice in Effective Java considered inappropriate for Android”?

13 pointsby amolguptaover 8 years ago
I came across this statement on Dagger's documentation at [http://google.github.io/dagger/android.html]. Also there is a discussion on reddit [https://reddit.com/r/androiddev/comments/4smncj/is_this_true/] but it does not cover much.

3 comments

ng12over 8 years ago
Android uses Dalvik/ART, which is an alternative to the JVM that has an entirely different set of optimizations for mobile. The most important one is that object creation is significantly more expensive -- if your code is allocating lots of objects it will significantly impact performance. This is why Android has the whole Recycler paradigm. My gut reaction is that Effective Java recommends a lot of heavy-OO practices which may impact Android performance.
jpetittoover 8 years ago
I would say most of it IS appropriate. A lot of the advice is good for Java development in general, regardless of platform. Enums are one area that is hotly debated in the Android community, but there is no consensus on it.<p>Generally, I would say follow the advice in Effective Java, but be aware of some potential performance issues and how you can avoid&#x2F;fix them if need be.<p>Edit: I noticed there is a chapter on serialization. This can be ignored by Android developers in favor of Parcelable.
mamonover 8 years ago
Simple answer: because Android is not Java. It&#x27;s a compeletely different platform, that just happens to use a programming language similar to Java to write programs for it&#x27;s virtual machine.
评论 #12894417 未加载
评论 #12896583 未加载