Go Multidimensional with AOP and Annotations Following the European Dream vs. the American one?
Apr 13

Value types in Java: Striving for the stack

Java, Microsoft, Tech Add comments

I have recently had some .NETers claiming that they do now know how we live on our side of the fence in Java-land, without value types. They laugh in our general direction as they add structs to the stack.

I do understand that value types can be useful. I do understand that it will take longer to dereference an object each time vs. not having to do that bypassing the heap entirely. There are lots of good things there.

However, I am actually quite glad that we don’t have value types. Simple put: Have you missed them? I haven’t! I haven’t run into a performance or scalability issue that was profiled, and the result was “man if we could just put this String on a stack we would be fine”. It just hasn’t been a problem.

On the other side, if you flip through Effective C#, you see items dedicated to value vs. reference types. Sneaky methods like EqualsReferences vs. EqualsValues. Subtle differences. Common mistakes.

So, give me partial classes, and true delegates, but keep your value types :)

6 Responses to “Value types in Java: Striving for the stack”

  1. shaug Says:

    I know next to nothing about C#, but would value types mean you could have a destructor?

    God, I miss destructors.

  2. Bitter Says:

    No; it’s more like alloca()…

  3. Keith Lea Says:

    shaug, I’m curious, what do you want about destructors that finalize() doesn’t provide?

  4. Mats Henricson Says:

    Amen, Brother! Haven’t missed them once in 7 years or so of Java programming!

  5. Jonnie Says:

    I’m a newbie where can I find out more about value types?

    thanks

  6. free ringtones Says:

    Hi, cool site. I really like it.
    http://newestringtones.awardspace.com/free_cell_phone_ringtones/ free cell phone ringtones http://newestringtones.awardspace.com/free_120t_motorola_cell_phone_ringtones/ free 120t motorola cell phone ringtones http://newestringtones.awardspace.com/free_ringtones_for_cell_phone/ free ringtones for cell phone http://newestringtones.awardspace.com/motorola_cell_phone_ringtone/ motorola cell phone ringtone http://newestringtones.awardspace.com/free_ringtones_for_my_cell_phone/ free ringtones for my cell phone http://newestringtones.awardspace.com/download_free_cell_phone_ringtone/ download free cell phone ringtone http://newestringtones.awardspace.com/cell_phone_ringtone_for_an_nextel/ cell phone ringtone for an nextel http://newestringtones.awardspace.com/free_cell_phone_ringtones_download/ free cell phone ringtones download http://newestringtones.awardspace.com/cell_free_phone_ringtone/ cell free phone ringtone http://newestringtones.awardspace.com/cell_download_phone_ringtone/ cell download phone ringtone http://newestringtones.awardspace.com/cell_free_phone_ringtone_verizon/ cell free phone ringtone verizon http://newestringtones.awardspace.com/cell_download_free_phone_ringtone/ cell download free phone ringtone http://newestringtones.awardspace.com/cell_free_phone_ringtone_wallpaper/ cell free phone ringtone wallpaper http://newestringtones.awardspace.com/cell_phone_ringtone_verizon/ cell phone ringtone verizon http://newestringtones.awardspace.com/alltel_cell_phone_ringtone/ alltel cell phone ringtone http://newestringtones.awardspace.com/cell_free_motorola_phone_ringtone/ cell free motorola phone ringtone http://newestringtones.awardspace.com/cell_phone_ringtone_wallpaper/ cell phone ringtone wallpaper http://newestringtones.awardspace.com/alltel_cell_free_phone_ringtone/ alltel cell free phone ringtone http://newestringtones.awardspace.com/cell_free_phone_prepaid_ringtone/ cell free phone prepaid ringtone http://newestringtones.awardspace.com/cell_motorola_phone_ringtone/ cell motorola phone ringtone

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'cricket'