Developing Applications with Java and Uml

  • Authors:
  • Paul R. Reed

  • Affiliations:
  • -

  • Venue:
  • Developing Applications with Java and Uml
  • Year:
  • 2001

Quantified Score

Hi-index 0.01

Visualization

Abstract

From the Book:PREFACE: This book focuses on the most powerful approach available today to model and build 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) using a sample application from requirements gathering, using Use Cases, through implementation via the creation Java code from Class and Sequence diagrams. This sample application uses the latest Java technology frameworks such as Java Server Pages (JSP), Servlets, and most importantly, the Enterprise Java Bean 2.0 (EJB) server-side enabling technology for the implementation of the business rules. Products to implement these server-side solutions range from the Apache Tomcat server to commercial applications servers such as BEA's Weblogic server.Reason for the BookIt took me many years to understand that writing a program was nothing more than a learned tactical skill. To program in a language like Java is to be a journeyman. But to somehow capture someone's requirements in an intelligent fashion and organize the necessary resources and resulting software into a cohesive deliverable, is the sign 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 Java Server 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 andpresent as the whole subject of process stirs 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 BookThis book is 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 (UP) and one from the author's experiences called Synergy. The greatest emphasis will be placed on the Unified Process. Establish a sound project plan (presented in-depth in Appendix E). Estimate projects with confidence, rather than a rule-of-thumb approach. Understand and describe the requirements of the application using UML Use Cases. Create a sound design based 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 skeletons for the component code. Although this author firmly believes that an automated code-generation process is a big factor contributing to successful projects, it by far is not mandatory. Use Java to build server-side Java functionality employing frameworks such as Java Server Pages (JSP), Servlets, and Enterprise JavaBeans 2.0 (EJB). 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) 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 as well as using 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 BookMaybe 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 the UML. I present the essential aspects of the UML and, more important, how they relate to Java deliverables. Although the UML is expressed with 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 wouldn't hurt). I discuss standard object constructs in the text in Chapter 2. Third, you should have some conversational understanding of what Enterprise JavaBeans are. 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 book of mine is by Richard Monson-Haefel entitled Enterprise JavaBeans (O'Reilly). The reader would also benefit by having some exposure to Java Server Pages (JSP). A favorite book of mine is by Hans Bergsten entitled Java Server Pages (O'Reilly).This book does assume that you have a working knowledge of Java. Both the new Java programmer and the experienced Java programmer will benefit. However, 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 principals in Chapter 2, but only as a baseline for other topics related to the 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 places an emphasis on 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 associate's clients were all pretty much cut from the same mold when you looked at their architecture. They consist of a light client browser on the front-end (with minimal JavaScript for syntax editing) a web server intercepting those browser requests with either Servlets and/or Java Server Pages acting as a broker within some container product which houses the business rules. These business rules are either implemented as 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 their Weblogic product and IBM with their Websphere product. This doesn't mean there aren't more 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), web server running Servlets and Java Server Pages who in turn message to either JavaBeans (Tomcat) or Enterprise JavaBeans (session and entity beans) residing in a commercial application server. In the case of the later, I have chosen to use BEA's Weblogic as my application server. Don't get 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 disallowed beans to be 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 you will know, for instance, everything about EJBs after reading this book. If you already know about EJBs then this book will better help you put them into a sound design architecture. The emphasis is placed 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 to goal of this book. This is where I shall place my emphasis. Structure of the BookFollowing is a summary of the book's chapters and contents.Chapter 1: The Project DilemmaThis chapter 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 the Unified Process from Rational Software and my Synergy methodology. It also touches on the primary components of the UML that will be covered in more depth later in the book.Chapter 2: Java, Object-Oriented, and the UMLThis chapter covers some of the benefits that result from the adoption of Java as a development environment. It presents these in the context of Java's implementation of encapsulation, inheritance, and polymorphism. It then maps the UML to various Java deliverables. Highlights include mapping the UML class to Java classes and Java interfaces; mapping use case pathways to Java entity, interface, and controller types of classes; and mapping component diagrams to Java classes and Java packages.Chapter 3: Getting the Project StartedThis chapter explores the case study used in the book, Remulak Productions. This fictional company sells musical equipment and needs a new order entry system. It 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 CasesThis chapter 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 chapter reviews the concept of use case pathways, as well as the project's preliminary implementation architecture. Also reviewed is an approach to estimating projects that are built by using the use case approach.Chapter 5: ClassesThis chapter 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 PrototypeThis chapter reviews unique user interface requirements of each use case. It develops an early U/I prototype flow and an eventual graphical prototype. Finally, it maps what was learned during the prototype to the UML artifacts.Chapter 7: The Dynamic Elements of the ApplicationThis chapter discusses the dynamic models supported by the 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 LandscapeThis chapter 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 a solution for housing the business rules are also be explored.Chapter 9: Data Persistence: Storing the ObjectsThis chapter 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 when translating to an RDMBS. 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 later 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: Applying the InfrastructureThis chapter 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 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 JavaBeansThis chapter builds the first Architectural Prototype for Remulak and does not rely on Enterprise JavaBeans. Using 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 controller classes.Chapter 12: Constructing a Solution: Servlets, JSP, and Enterprise JavaBeansThis chapter 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. Both a Container Managed Persistence (CMP) and Bean Managed Persistence (BMP) are presented. Leveraging the Data Access Objects created in the previous chapter is paramount to the success of a BMP implementation.Updates and InformationI 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 regarding how to use and apply the 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, where you can get 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 prreed@jacksonreed.com.