• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

21. Java > Coding Tips

Coding Tips

Okay, now that you know everything that’s wrong with Java, let’s talk about what we can do with it.

Use Good Algorithms

The architecture and algorithms of your program are much more important than any low-level optimizations you might perform. Bad architecture and algorithms can make any system seem slow. Premature optimization may be the root of all programming evil (says Knuth) but failure to consider performance right from the start can also doom a program to uselessness. Here are some good guidelines:

  • Tune at the highest level first.

  • Make the common case fast (Amdahl’s advice).

  • Use what you know about the runtime platform or usage patterns. This violates portability in some sense. In fact, it will hurt later if the platform details or usage pattern changes. For example, optimizations that help before using the Hotspot JIT may hurt with Hotspot.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint