Home > Articles > Programming > Java

  • Print
  • + Share This
  • 💬 Discuss

Watching the Skies at NASA

The first afternoon stop on the Java tour is a trip to NASA, a U.S. government agency that makes extensive use of Java. One of the most popular examples is SkyWatch, an applet that helps stargazers keep an eye out for orbiting satellites. Load it in your browser by visiting www.cadenhead.org/nasa; you are forwarded automatically to NASA’s SkyWatch site.

SkyWatch superimposes the current location and path of eight different satellites—which you can add or drop from view—over a globe of the world. The applet running in Figure 3.4 shows the SEASAT-1 satellite making a patch from the Bootes constellation to the Hercules constellation.

Figure 3.4

Figure 3.4. NASA’s SkyWatch applet monitors the location and path of orbiting satellites, a boon to metal birdwatchers.

The applet redraws the position of each tracked satellite as it runs. This kind of real-time update is possible because the Java language is multithreaded. Multithreading is a way for the computer to do more than one thing at the same time. One part of a program takes care of one task, another part takes care of a different task, and the two parts can pay no attention to each other. Each part of a program in this example is called a thread.

In a program such as SkyWatch, each satellite could run in its own thread. If you use an operating system such as Windows 7, you’re using a type of this behavior when you run more than one program at the same time. If you’re at work playing Desktop Tower Defense in one window while running a company sales report in another window and making a long-distance call to a friend, congratulate yourself—you’re multithreading!

  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus