Previous | Next | Trail Map | Overview of the JDK | Contents

A Case Study: A Business Application for Duke's Bakery

This lesson describes--from a very high vantage point--how the various JavaTM APIs might be used to create the functionality for a business application to run a fictional business. In this case, the business application must help run the daily operations for Duke's Bakery.

Duke's Bakery is a large, busy, and well-known neighborhood bakery with a loyal following. To continue their personalized service while scaling the business to accommodate the dozens of new customers they get every month, Duke's owner Kate Cookie has hired JavaTM programmer, Madhavi Rao, to help upgrade their operations with a business application. Kate and Madhavi prefer the Java platform because it not only meets Kate's business needs for today, but offers important features she will need as her business grows:

Right now, though, Duke's needs a clean and easy-to-use user interface and backend so the administrative staff (some of whom have limited computer experience) can track ordering, stock, and employee information.

Swing Components

Swing is ideal for creating the user interface. The components are highly configurable and use images easily. Kate and Madhavi agree to display sales, customer, and vendor information using Swing components such as tables, trees, labels, text fields, and text areas. They also decide to include photographs with the employee information and use images of baked goods in the user interface. For example, the delicious and proprietary cake recipes that have made them so popular over the years can be viewed by choosing a button with a cake on it.

Note: Swing components are not covered in this book, but you can find the documentation online at Using Swing Components.

Java 2D

The Java 2D APIs provide ways to enhance the user interface with color, graphics, and images to make it easy to understand and use. Kate is so excited about the possibilities, she has hired a grahic designer to help leverage the Java 2D functionality because she knows the less time her employees spend learning and using the new system, the happier and more productive they are.

Kate and Madhavi want to use Java 2D to help customers choose a cake's appearance. They decide to include a module in the application that uses a color chooser for selecting icings, and 2D text for demonstrating the appearance of the text on cakes for special occasions like birthdays and anniversaries.

Cryptography

Duke's is working out relationships with some of their suppliers for automated electronic ordering. The JDK 1.2 cryptography API and Java Cryptography Extension (JCE 1.2) by separate download allow Duke's, the suppliers, and their banks to use digital signatures and certificates to authorize and verify large orders with cash transfers in the thousands of dollars.

JDBC

From Madhavi's point of view as a programmer, the Java platform is ideal. The rich set of Java APIs gives her a lot to work with in designing and writing this application. She will use JDBCTM to access data in their current database. If they change databases or add another database, the existing JDBC code does not need to be changed.

JavaBeans

Madhavi will use JavaBeansTM to build some of the general parts of the application. This way she can reuse the code she writes for Kate in other similar business applications running on the Java platform.

Distributed Computing

Because of Kate's plans to use online ordering with her vendors, Madhavi must decide whether to use RMI or Java IDL for network communications. Because the vendors are also using the Java platform, she decides to use RMI. Java IDL would let her application use CORBA functionality to access objects written in languages other than the Java programming language (such as C++), but that is not necessary here. RMI is generally easier to use, and Madhavi wants to encourage new vendors to use the Java platform if they want an online purchasing arrangement with Duke's Bakery.

Of course, Madhavi will use Java servlets to implement an online ordering system that customers can use on the premises and eventually from their own computers at home.

Reference Objects and Collections

Madhavi considers using the Reference Objects API to create soft references to objects that might be left in memory so the garbage collector has the option of reclaiming the memory if need be. This situation could arise when customers choose custom cake decorations online. As they browse through and try the multitude of decorating possibilities, a number of graphical and image objects could be left in memory--especially if the customer or employee does not remember to quit out of this part of the application.

Madhavi also decides to use one of the classes in the collections API to simulate a first in first out (FIFO) queue. This way, the application can manage the floor when customers take a number and wait their turn for service. Madhavi is considering adding a feature where employees in the back are notified when more than 5 customers are waiting for service.

Other APIs

Some of the other APIs are not so critical in this application. She does not anticipate needing to access information on fields, methods, and constructors in loaded classes (reflection); making native C calls (Java Nataive Interface); extending the core Java platformm (extensions), or playing sound (audio). But when the application is written, she will bundle it and all its related files into a Java ARchive (JAR) file for installation at the site.


Previous | Next | Trail Map | Overview of the JDK | Contents