Every year, few of the Java web development and Java J2EE development teams fall into traps due to lack of familiarity with language. In this blog, we will discuss on some of the popular Java pitfalls that will help you in practicing best Java habits and how to avoid problems as soon as they are detected
- Expecting too much from JLayeredPane
While working on user interface layer, you should not completely rely on JLayeredPane. There may arise some background issues with image or content loading so you have to distributed objects to avoid the problem.
- Visiting a vector is always tough
If you would look around Enumerator classes and its implementation then its behavior is completely different from iterator classes. Here, there may raise code comment issues and it is generally referred as poor designing by other team.
When boolen value is returned then it does not give much information on cause of failure. This may cause consistency and poor designing at the end. There are plenty of reasons of failure that are tough to identify. Currently, there is no technique to identify these problems but Java web development and Java J2EE development teams are working hard to resolve the issue.
The other issue is attempting use of File object when rename() has already been defined successfully. In case, you just want to change the File name then how it could be done? You just have to pass name through string? This is called poor class naming. You have to be extra cautious when defining name of class and operations performed under it.
The third issue is that File.rename() function works differently on different operating systems. So, meaning of Write once, run everywhere quote has been violated here. So, you have to work with files wisely here. Both the issues are related with Java designing that should be fixed at early stage only.