Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deprecated methods - doubt

 
Janhavi Namshikar
Ranch Hand
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have got a question about deprecated methods.
Do they cause any performance issue when used in your application? What are the drawback of using a deprecated method.
Does it affect the functioning and performance in any way?


Thank you.


Janhavi.
 
u johansson
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main issue is that deprecated methods may, in principle, disappear in future Java versions and thus break your program.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a number of reasons why a method or class may become deprecated. An API may not be easily extensible without breaking backwards compatibility, and thus be superseded by a more powerful API (e.g., java.util.Date has been deprecated in favor of Calendar, or the Java 1.0 event model). It may also simply not work or produce incorrect results under certain circumstances (e.g., some of the java.io stream classes do not work properly with some encodings). Sometimes an API is just ill-conceived (SingleThreadModel in the servlet API), and gets replaced by nothing. And some of the early calls have been replaced by "Java Bean"-compatible methods (size by getSize, bounds by getBounds etc.)

So there are a number of reasons why an API can be deprecated. Study the javadocs for the classes and methods you use to see whether it is advisable to avoid them in your case. I don't generally advise to remove deprecated methods just for its own sake, but to consider the circumstances.
 
Jaime M. Tovar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a matter of decision and risk, deprecated means that you should not be using those methods as part of a new development. Basically because they are known to have undesirable behavior (lets say lack of precision, lack of portability, problems with performance). They are kept because some times it is mandatory to have backward compatibility in software maintenance. Normally when something is deprecated it is replaced by a better option, so if you can choose go for the non deprecated functionality. Just for your own security and good practices.
 
Adam Richards
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you "doubt"?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic