Why all the talk about recycle() – how about dispose()?

Let me start by saying that I agree that recycle() could and should be handled by the API and there are numerous ways around it. I however also think that the majority of Notes developers out there will never have the need to call recycle() in their Java agents. There is a lot of talk about recycle() this and recycle() that but let’s face it – it’s not really a problem. If ever there is a problem with the Java API it’s not recycle() it is the fact that it has been left to stagnate and that it’s not keeping up with the Java language as a whole.

All this being said I wonder why so much talk and energy is being spent on recycle() and how come it is constantly being used as a reason not to move to Java and embrace the language. Looking at other API’s there are stuff that needs to be done. In the Java API it’s recycle() (whenever it’s actually needed) and in SWT it’s dispose(). I never see any SWT discussions on the dispose() method and DisposeListeners and using it as a justification for not choosing SWT and Eclipse as the fundation for an application. You judge a framework on what it does for you and not a single method in an API. Every API and language has quirks. Deal with it!

My post from 2006 (!!) has a lot more information on recycle() and why it’s there: Java in Notes/Domino Explained: The story on recycle()

5 thoughts on “Why all the talk about recycle() – how about dispose()?”

  1. So true. And people who develop in objective-c will have even more fun, e.g. when developing iPhone apps.

    In objective-c all reference counting has to be done manually. An object is disposed when the reference counter of an object goes down to zero. As long as you follow some coding conventions, that’s no problem at all.

    Like

  2. "You judge a framework on what it does for you and not a single method in an API. Every API and language has quirks. Deal with it!"

    Agree.  I think the bigger problem is the lack of material to show developers HOW and WHEN to use Java.  I think it’s a lack of knowledge that scares people from adopting these APIs.

    Like

  3. This is timely, as I’m doing quite a bit with JSF backing beans in xPages, and have noticed memory leak and am in the process of checking nits are being recycled…I guarantee you it’s my bad coding.

    Like

  4. Yes, recycle() should be behind the API. I maintain several APIs in other JVM languages that wrap the Notes API and I would really appreciate not having to deal with recycle in them or in my own Java intermediate API.

    More importantly, that the Java API "has been left to stagnate" is a crime. Have you ever shown the Notes Java API to other Java developers? I have. It’s embarrassing.

    Java 7 is now back on track for release next year. Java 5 is almost 7 years old. Yet we code against Notes.jar like it’s 1999. Criminal.

    Like

Comments are closed.