Getting Down to Business
At this point in your travels, you might have the impression that Java is primarily of use to space buffs, atrocious poets, and terrible skiers. The next stop on our trip shows an example of Java getting down to business.
Direct your web browser to the JTicker website at www.jticker.com.
The publisher of JTicker, a company called Stock Applets, develops Java programs that display business news headlines and stock quotes for use on other websites. Figure 3.5 shows a demo of its scrolling stock ticker.
Figure 3.5. Java programs from Stock Applets report stock market prices.
Unlike other stock analysis programs that require the installation of software on the computers of each employee who needs access, the use of Java enables customers of Stock Applets to make the programs available to anyone with a web browser. All employees have to do is access the company’s website.
You can think of a program like this stock ticker applet in several different ways. One is to think of a program as an object—something that exists in the world, takes up space, and has certain things it can do. Object-oriented programming (OOP), which Java uses (read more in Hour 10, “Creating Your First Object”), is a way of creating computer programs as a group of objects. Each object handles a specific job and knows how to speak to other objects. For example, a stock ticker program could be set up as the following group of objects:
- A quote object, which represents an individual stock quote
- A portfolio object, which holds a set of quotes for specific stocks
- A ticker object, which displays a portfolio
- An Internet object, a user object, and many others
Under that model, the stock ticker software is a collection of all the objects necessary to get work done.
OOP is a powerful way to create programs, and it makes the programs you write more useful. Consider the stock software. If the programmer wants to use the quote capabilities of that program in some other software, the quote object can be used with the new program. No changes need to be made.