Preface

This book focuses on the most powerful approach available today to modeling and building industrial-strength Java applications: the Unified Modeling Language (UML) adopted in 1997 by the Object Management Group (OMG). A project lifecycle and software process model are demonstrated (Rational's Unified Process) through a sample application from requirements gathering, using use-cases, through implementation via the creation of Java code from class and sequence diagrams. This sample application uses two different architectures that the reader can focus on, depending on their specific needs. The first architecture uses Java servlets, JavaServer Pages (JSP), and JavaBeans all running in the freely available Apache Tomcat server. The second uses Java servlets, JavaServer Pages (JSP), and Enterprise JavaBeans 2.0 (EJB) all running in a commercially available application server.

Reason for the Book

It took me many years to understand that writing a program is nothing more than a learned tactical skill. To program in a language like Java is to be a journeyman. But to capture someone's requirements in an intelligent fashion and organize the necessary resources and resulting software into a cohesive deliverable are the signs of a strategic craftsman.

To me, the majority of Java books never consider Java “in the large.” They focus on the small view, covering single Java-enabled extensions such as JavaBeans, servlets, and JavaServer Pages. Although these views, too, are necessary, unfortunately no one seems to touch on project planning, software process, and the methodology for building enterprise-status Java applications. This is a difficult topic to explore and present because the whole subject of process spurs on many heartfelt debates and opinions. At the urging of many of my colleagues and supportive readers of my first book, Developing Applications with Visual Basic and UML, I have undertaken a similar project for Java.

Who Should Read This Book

This book is intended for anyone who wants to successfully build Java applications that can stand up over time. It provides an accurate road map for anyone to achieve the following goals:

  • Review two processes: one commercially available through Rational Software called the Unified Process and one from my own experiences called Synergy. The greatest emphasis will be placed on the Unified Process.

  • Establish a sound project plan (presented in depth in Appendix A).

  • Estimate projects with confidence, rather than by using a rule-of-thumb approach.

  • Understand and describe the requirements of the application using UML use-cases.

  • Create a sound design based on UML class and sequence diagrams.

  • Use a visual modeling tool such as Rose by Rational Software not only to create and track UML artifacts, but also to generate skeleton component code. Although I firmly believe that an automated code generation process is a big factor contributing to successful projects, it is certainly not mandatory.

  • Use Java to build server-side Java functionality employing architectures such as JavaServer Pages (JSP) and servlets, along with either JavaBeans or Enterprise JavaBeans 2.0 (EJB) managing the business rules.

  • Produce the code for the project using an evolutionary approach showing various technology options: (1) servlets, JSP, and JavaBeans; (2) servlets, JSP, and bean-managed persistence (BMP); and (3) servlets, JSP, and container-managed persistence (CMP).

  • Investigate the benefit of deploying Java applications on both open-source products like the Apache Tomcat server and commercial application server products such as BEA's WebLogic application server.

Anyone building Java applications today needs this book.

What You Need to Know to Use This Book

Maybe it's best to start out with what you don't need to know to benefit from this book. First, you don't need to know anything about UML. I present the essential aspects of UML and, more importantly, how they relate to Java deliverables. Although UML is expressed through nine separate diagrams, you will benefit the most from a core set.

Second, you don't need a formal background in object-oriented concepts (but it certainly doesn't hurt). I discuss standard object constructs in Chapter 2.

Third, you should have some conversational understanding of what Enterprise JavaBeans is. For a really thorough treatment of Enterprise JavaBeans (EJB), you should focus on one of the many texts that cover them in more detail. A favorite of mine is a book by Richard Monson-Haefel entitled Enterprise JavaBeans, published by O'Reilly. You will also benefit from some exposure to JavaServer Pages (JSP). One of my favorite sources on this topic is a book by Hans Bergsten entitled Java Server Pages, also published by O'Reilly.

This book assumes that you have a working knowledge of Java. Both the new Java programmer and the experienced Java programmer will benefit. I don't cover the basics of simple Java constructs, assuming that you already know these. I do briefly review the tenets of Java's support for object-oriented principles in Chapter 2, but only as a baseline for other topics related to UML. If you have had no exposure to Java, buy this book anyway and open it after you have had some initial training in that programming language.

This book emphasizes the most mainstream Java techniques and products that are used to build production applications. When I began this book, I planned to cover all kinds of Java technologies (i.e., applets, Java applications talking to servlets or JSPs). However, it quickly became apparent to me that the majority of my clients and my associates' clients were all pretty much cut from the same mold in terms of architecture. They consist of a light client browser on the front end (with minimal JavaScript for syntax editing), and a Web server intercepting those browser requests with either servlets and/or JavaServer Pages acting as a broker within a container product that houses the business rules. These business rules are implemented as either JavaBeans or Enterprise JavaBeans. The container products range from open-source solutions like Apache Tomcat to commercial products.

The two biggest of the commercial application server players I run across are BEA (with its WebLogic product) and IBM (with its WebSphere product). This doesn't mean there aren't other good commercial container products, but these two vendors have the lion's share of the market. This book will utilize a light client-side technology (no applets or Java applications), and a Web server running servlets and JavaServer Pages, which in turn send messages to either JavaBeans (Tomcat) or Enterprise JavaBeans (session and entity beans) residing in a commercial application server.

In the case of the latter, I have chosen to use BEA's WebLogic as my application server. Don't be discouraged if you are using another vendor's application server product because this book's coverage of EJB is based on the 2.0 specification. This release of EJB resolved many of the ambiguities that kept beans from being truly transportable across vendor implementations. So regardless of your EJB vendor, you will be able to use the code built in this book.

It would be unfair to say that you will know everything about EJBs after reading this book. If you already know about EJBs, this book will help you put them into a sound design architecture. The emphasis is on the notation (UML) and the process (Unified Process and Synergy) in beginning, developing, and implementing a software project using the Java language. The benefit of seeing an application from requirements gathering to implementation is the key goal of this book. This is where I shall place my emphasis.

Structure of the Book

The following sections summarize the contents of each chapter.

Chapter 1: The Project Dilemma

Chapter 1 reviews the current state of software development and my reasoning regarding why it's in the shape that it is today. It also reviews the concept of iterative and incremental software development and provides an overview of both Rational Software's Unified Process and my Synergy Process methodology. In addition, it touches on the primary components of UML that will be covered in more depth later in the book.

Chapter 2: Java, Object-Oriented Analysis and Design, and UML

Chapter 2 covers some of the benefits of adopting Java as a development environment, presented in the context of Java's implementation of encapsulation, inheritance, and polymorphism. It then maps UML to various Java deliverables. Highlights include mapping the UML diagrams to Java classes and Java interfaces; mapping use-case pathways to Java classes; and mapping component diagrams to Java classes and Java packages.

Chapter 3: Starting the Project

Chapter 3 explores the case study used in the book: Remulak Productions. This fictional company sells musical equipment and needs a new order entry system. The chapter introduces a project charter, along with a tool, called the event table, to help quickly solidify the application's features. Further, the chapter maps events to the first UML model, the use-case.

Chapter 4: Use-Cases

Chapter 4 reviews the use-case, one of the central UML diagrams. Included is a template to document the use-case. Actors and their roles in the use-cases are defined. The concept of use-case pathways, as well as the project's preliminary implementation architecture, is reviewed. Also reviewed is an approach to estimating projects that are built with the use-case approach.

Chapter 5: Classes

Chapter 5 explores the class diagram, the king of UML diagrams. It offers tips on identifying good class selections and defines the various types of associations. It also covers business rule categorization and how these rules can be translated into both operations and attributes of the class. Finally, it discusses the utilization of a visual modeling tool as a means to better manage all UML artifacts.

Chapter 6: Building a User Interface Prototype

Chapter 6 reviews unique user interface requirements of each use-case. It develops an early user interface prototype flow and an eventual graphical prototype. Finally, it maps what was learned during the prototype to the UML artifacts.

Chapter 7: Dynamic Elements of the Application

Chapter 7 discusses the dynamic models supported by UML, exploring in depth the two key diagrams, often referred to as the interaction diagrams: sequence and collaboration. These are then directly tied back to the pathways found in the use-cases. Other dynamic diagrams discussed include the state and activity diagrams.

Chapter 8: The Technology Landscape

Chapter 8 covers the importance of separating logical services that are compliant with a model that separates services. It explores technology solutions specific to the Remulak Productions case study, including distributed solutions and the Internet using HTML forms, JSP, and servlets. Both JavaBeans and Enterprise JavaBeans as solutions for housing the business rules are also explored.

Chapter 9: Data Persistence: Storing the Objects

Chapter 9 explores the steps necessary to translate the class diagram into a relational design to be supported by both Microsoft SQL Server and Oracle databases. It offers rules of thumb regarding how to handle class inheritance and the resulting possible design alternatives for translation to an RDBMS. This book will deliver solutions that range from roll-your-own persistence using JavaBeans and JDBC, all the way to container-managed persistence (CMP) features of the EJB 2.0 specification. The latter removes all the requirements of the application to write SQL or control transactions. This chapter introduces the concept of value objects to reduce network traffic, as well as data access objects that encapsulate SQL calls.

Chapter 10: Infrastructure and Architecture Review

Chapter 10 finalizes the design necessary to implement the various layers of the application. It also presents the communication mechanism utilized between the layers and possible alternatives. Each class is delegated to one of three types: entity, boundary, or control. These types are used as the basis for the design implementation and as the solution to providing alternative deployment strategies.

Chapter 11: Constructing a Solution: Servlets, JSP, and JavaBeans

Chapter 11 builds the first architectural prototype for Remulak and does not rely on Enterprise JavaBeans. With the Maintain Relationships use-case as the base, the various components are constructed. The primary goal of the architectural prototype is to reduce risk early by eliminating any unknowns with the architecture. This chapter uses the Apache Tomcat server and introduces the concepts of user interface and use-case control classes.

Chapter 12: Constructing a Solution: Servlets, JSP, and Enterprise JavaBeans

Chapter 12 initially uses Rational Rose to generate EJB components. A primer on EJB is offered, along with a thorough discussion of the transaction management options in the EJB environment. Session beans are utilized as the use-case controller. Solutions that incorporate both container-managed persistence (CMP) and bean-managed persistence (BMP) are presented. Leveraging the data access objects created in Chapter 11 is crucial to the success of a BMP implementation.

Updates and Information

I have the good fortune to work with top companies and organizations not only in the United States, but also in Europe, Asia, and South America. In my many travels, I am always coming across inventive ideas for how to use and apply UML to build more-resilient applications that use not only Java, but also C++, C#, and Visual Basic. Please visit my Web site, at www.jacksonreed.com, for the latest on the training and consulting services that I offer, as well as all of the source code presented in this book. I welcome your input and encourage you to contact me at [email protected].

About the Author

Paul R. Reed, Jr., is president of Jackson-Reed, Inc., www.jacksonreed.com, and has consulted on the implementation of several object-oriented distributed systems. He is the author of the book Developing Applications with Visual Basic and UML, published by Addison-Wesley in 2000. He has published articles in Database Programming & Design, DBMS, and Visual Basic Programmer's Journal, and he has spoken at industry events such as DB/Expo, UML World, and VBITS. He is also the author of many high-technology seminars on such topics as object-oriented analysis and design using UML, use-case analysis, the Unified Process, Internet application development, and client/server technology. He has lectured and consulted extensively on implementing these technologies to companies and governments in the Middle East, South America, Europe, and the Pacific Rim.

Paul holds an MBA in finance from Seattle University. He also holds the Chartered Life Underwriter (CLU) and Chartered Financial Consultant (ChFC) designations from the American College and is a Fellow of the Life Management Institute (FLMI).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.237.194