Mark Watson’s Artificial Intelligence Books and Blog

Share this post

Java arrays and primitive types should (perhaps) be deprecated

markwatson.com

Java arrays and primitive types should (perhaps) be deprecated

Mark Watson
Sep 6, 2008
Share
Share this post

Java arrays and primitive types should (perhaps) be deprecated

markwatson.com

I have been brushing up on my Java skills this year. For 2 years I did mostly Ruby and Common Lisp development. I think that Lisp is a great research language but not so great for deployments and long term maintainability. Ruby is a great prototyping language and for small web portal projects Rails is my favorite tool. However, I keep coming back to Java because of the tools/libraries and the robust deployment software options.

So, I have carefully read through both Effective Java (2nd edition) and Java Generics recently to brush up on my Java skills. As a result, I completely refactored one of my medium size projects to use generics and collection classes exclusively - no arrays. Since arrays must contain reifiable types they play poorly with generics.

There are some obvious cases where not using primitive types leads to excessive object creation and boxing/unboxing. That said, I expect Java compilers, Hotspot, and the JVM in general to keep getting better and this may be a non-issue in the future.

Share
Share this post

Java arrays and primitive types should (perhaps) be deprecated

markwatson.com
Comments
Top
New

No posts

Ready for more?

© 2023 Mark Watson
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing