On Thu, Nov 24, 2011 at 2:18 PM, Mark Murphy <mmur...@commonsware.com>wrote:

> http://java.sun.com/developer/Books/shiftintojava/page1.html
>
> "Upon first exposure to the Java programming language, some C
> programmers believe that classes are too heavyweight to replace
> structs under some circumstances, but this is not the case. Degenerate
> classes consisting solely of data fields are nearly equivalent to C
> structs in every respect."
>
> If you choose not to believe Mr. Bloch, that is your decision.
>
>
http://developer.android.com/guide/practices/design/performance.html

"Object creation is never free. A generational GC with per-thread
allocation pools for temporary objects can make allocation cheaper, but
allocating memory is always more expensive than not allocating memory.

If you allocate objects in a user interface loop, you will force a periodic
garbage collection, creating little "hiccups" in the user experience. The
concurrent collector introduced in Gingerbread helps, but unnecessary work
should always be avoided."


For what is worth, I don't choose not to believe Mr. Bloch, I was just
wondering if in Android were better choices for classes as structs, as I
know my knowledge of both Java and Android is limited. That's the reason I
asked here after searching the web with no results (again, maybe my results
weren't good enough to get the answers I was looking for).

Thanks, though, for the link, as it seems interesting.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to