| You are here: | About>Computing & Technology>Focus on Java |
![]() | Focus on Java |
Java ArraysIn Java Arrays, I introduce the fixed-length array. You can use arrays as data structures to hold values that are of the same type. Arrays are an alternative to Java collections classes such as ArrayList and LinkedList. Arrays are most beneficial when the number of elements being stored is relatively stable and when performance is important; resizing arrays is an expensive operation.
Tuesday December 19, 2006 | permalink | comments (0) Contractor or Consultant? What's the Difference?Don Wallace is an IT consulting guru who is well-known in many IT industry venues. In Contractor or Consultant? What's the Difference?, he clearly explains what these two terms mean in relation to the IT industry. Read this article if you are considering going out on your own as an independent contractor.
Saturday December 9, 2006 | permalink | comments (0) Java Programming TutorialFocus on Java's free Java Programming Tutorial provides short, focused topics in a comfortable sequence for beginning Java programmers. In fact, no programming experience is assumed. You will start off by learning what software you need to download and will then delve into the Java language basics.
Wednesday November 29, 2006 | permalink | comments (0) Open Source JavaSun recently announced the open sourcing of the Java Platform Standard Edition (Java SE), Java Platform Micro Edition (Java ME), and Java Platform Enterprise Edition (Java EE) under the GNU General Public License version 2 (GPLv2), the same license as GNU/Linux.
In one move, Sun has arguably made Java the most important and widely-used open source software in the world. So, how does this affect the average corporate developer? Maybe even more importantly, how does this affect entrepreneurs and other drivers of the technical economy? Sunday November 19, 2006 | permalink | comments (0) Hibernate PerformanceAlthough this article of Hibernate performance tips has been around for a while, the author provides great tips and advice on how to use Hibernate effectively without your application ginding to a halt. Study this list and refer back to it when you become mired in Hibernate performance issues. (It will happen with any non-trivial Hibernate application, if you are not careful.)
Wednesday November 8, 2006 | permalink | comments (0) EclipseCon 2007 Short Tutorial ProposalEclipseCon 2007 is right around the corner. This year, my colleague Scott Delap and I are proposing a short tutorial (2 hrs) called Creating Enterprise Business Applications Using Eclipse RCP.
Many applications are now being written or rewritten with an Ajax rich client user interface (UI) because the first generation of thin client UI paradigms were a step back from what we were delivering back in the 1990s. But, what do you do if your application requires offline access, desktop integration, and UI customizations that Ajax cannot support? Using Eclipse RCP is an increasing popular solution. In the tutorial, if it gets accepted, Scott and I will be discussing the challenges that our team has overcome using Eclipse RCP in an enterprise environment. We have invested a lot of effort plugging holes in the pre-canned functionality that the Eclipse framework provides, and we'll be reviewing both the holes and our solutions. Wednesday November 1, 2006 | permalink | comments (0) Hibernate Recipe - Implementing equals() and hashCode()ProblemWhen using Hibernate to lazily load persistent objects, hibernate (obviously) proxy objects stand-in for any uninitialized persistent objects. These proxy objects are not your class: They are a bytecode-generated class that mimics your real class. This can create subtle bugs in your code, if your persistent object's equals() and hashCode() are not ready to fend off this Hibernate anomally. You'll typically see these issues when you have retrieved two objects with database equality (same primary key) from two different Hibernate sessions and then you try to compare them via equals(). For instance, object1 lives in a List and you make a list.contains(object2) call. You need this to return true if the objects represent the same row in your database. This problem of proxy identity becomes even more difficult when your persistent objects are subclassed.
RecipeThere is no definite way to implement equals() and hashCode() in Hibernate. If you never use your persistent objects across multiple sessions or you never use lazy loading, then you can stick with the default Object implementations. Otherwise, here are safe equals() and hashCode() implementations that I have used successfully.
public class Person {
// ...
public boolean equals(Object o) {
if (this == o)
return true;
if (!(HibernateProxyHelper.getClassWithoutInitializingProxy(o)
instanceof Person))
return false;
final Person person = (Person) o;
if (null != id ?
!id.equals(person.getId()) :
null != person.getId())
return false;
return true;
}
public int hashCode() {
return null != id ? id.hashCode() : super.hashCode();
}
}
DiscussionThis is a classic "Effective Java"-style equals() implementation except for two Hibernate-fending refinements. The first is the call to HibernateProxyHelper.getClassWithoutInitializingProxy(o) in the instanceof check. This ensures that you are checking the underlying persistent class in the instanceof comparison (and NOT the generated proxy class!). If o is a proxy, it will return the underlying persistent class that it is mimicing. If o is one of your real persistent objects, it will return that object's class. The downside of this call is that your models are now "Hibernate aware." The other refinement we've made to a classic equals implementation is the use of person.getId() instead of person.id. This is, again, to compensate for the fact that person may be a Hibernate proxy. A hibernate proxy doesn't have initialized fields. In order to get the id attribute, you must access it through the getter. Thursday October 26, 2006 | permalink | comments (4) Latest JRuby Release AvailableIf you are interested in trying out JRuby, a new version was released a few days ago. 0.9.1 has improved support for Ruby on Rails. This means that you can theoretically run Rails apps on a JVM. I haven't had success with this yet, but there are more and more reports of successful JRuby Rails deployments.
Also, this version of JRuby is seeing significant performance improvements. Saturday October 21, 2006 | permalink | comments (0) Review of Pragmatic Ajax Ajax is taking the Web development world be storm. But, what is it and how
should you be using it on your project? These are the questions that
"Pragmatic Ajax" attempts to answer. In doing so, they offer many
guidelines and best practices for using Ajax"s power for good while
avoiding many User Interface (UI) pitfalls. Read the entire review.Sunday October 15, 2006 | permalink | comments (0) Sun Embraces JRubySun Microsystems is actively pursuing the idea of "officially" supporting languages other than Java on the Java Virtual Machine (JVM). This will continue the move that Java is making from being simply a language to being a platform.
In its latest move, Sun has hired the developers responsible for JRuby: Charles Nutter and Thomas Enebo. According to Sun the dynamic duo will continue to work on JRuby. They will also be working on tools for Ruby developer. This is welcome news. Ruby is not the only dynamic language being courted by Sun. PHP, JavaScript, and others, are all being evaluated as potential future JVM languages. Wednesday October 11, 2006 | permalink | comments (3) Display Latest Headlines | powered by WordPress |
|
All Topics | Email Article | Print this Page | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2007 About, Inc., A part of The New York Times Company. All rights reserved. |

Ajax is taking the Web development world be storm. But, what is it and how
should you be using it on your project? These are the questions that
"Pragmatic Ajax" attempts to answer. In doing so, they offer many
guidelines and best practices for using Ajax"s power for good while
avoiding many User Interface (UI) pitfalls. Read the entire 
