The Essence of Object Oriented Programming with Java and UML
Total Page:16
File Type:pdf, Size:1020Kb
Contents The Essence of Object Oriented Programming with Java and UML by Bruce E. Wampler, Ph.D. Contents Preface Why This Book? Who Is This Book For? Overview of Chapters About the Author Acknowledgements Chapter 1: Objects, UML, and Java Introduction Object Orientation Object-Oriented Languages Object-Oriented Design and the UML The Payoff of Objects Chapter Summary Chapter 2: The Essence of Objects What Is an Object-Oriented System? file:///C|/oobook/EOOPTOC.html (1 of 8) [13/03/2003 02:55:02 }Ç Contents Fundamental Properties of an Object-Oriented System Abstraction with Objects Encapsulated Classes Communication via messages Object Lifetime Class Hierarchies Polymorphism An Example - Putting it All Together Other OO Concepts Abstract Classes Visibility of Methods Class vs. Instance Accessing Objects A Low-Level View of Objects Chapter Summary Resources Object-Orientation UML Chapter 3: Objects in Java Defining Classes in Java Visibility Inheritance Association, Aggregation, and Composition Java Interfaces Object lifetime in Java Constructors Garbage collection Memory leaks Class vs. Instance methods and attributes Copies of Objects Messages Chapter Summary Resources file:///C|/oobook/EOOPTOC.html (2 of 8) [13/03/2003 02:55:02 }Ç Contents Java Chapter 4: Object-Oriented Analysis and Design Software Methodologies The Elements of a Software Project The Essence of Object-Oriented Analysis Object Discovery Evaluate Candidate Objects Determine Object Hierarchies Discover Object Attributes Discover Object Operations The Essence of Object-Oriented Design Some Design Guidelines Get The Big Picture Encapsulation Designing Classes Inheritance General Guidelines The Build and Release Phases Building the Software Releasing the Software More on the UML Chapter Summary Resources OOAD CRC Chapter 5: Object-Oriented Graphical User Interfaces with Swing Graphical User Interfaces A Typical Application Dialog Boxes Events file:///C|/oobook/EOOPTOC.html (3 of 8) [13/03/2003 02:55:02 }Ç Contents A Brief Introduction to Swing Handling Swing Command Events A Bunch of Options MVC: Model, View, Controller MVC with Java A Small Swing MVC GUI Framework A Simple Application Based on Wmvc UML Sequence Diagram for Thermometer Chapter Summary Resources Swing Chapter 6: A Case Study in Java Analysis of MovieCat Use Cases Object, Attribute, and Operation Discovery Evaluation Design of MovieCat Movie Class MovieModel Class View Classes Putting It All Together Implementation of MovieCat MovieCat Class Movie Class MovieModel Class MainView Class MovieListView Class MovieItemView Class MovieEditor Class Movie Helper Classes Review Chapter Summary file:///C|/oobook/EOOPTOC.html (4 of 8) [13/03/2003 02:55:02 }Ç Contents Chapter 7: Design Patterns What are Design Patterns? Using Design Patterns Design Pattern Description Template The Gang of Four Patterns Creational Patterns Structural Patterns Behavioral Patterns Example Design Patterns used by Wmvc and MovieCat MVC Observer Pattern Observer Pattern in Wmvc Command Pattern in Wmvc Other Patterns used in Wmvc and MovieCat Chapter Summary Resources Chapter 8: Refactoring What is Refactoring? The Basic Refactoring Process When Do You Refactor? Code Smells When not to refactor Some Refactorings Refactoring Categories Some Specific Refactorings Chapter Summary Resources Chapter 9: Software Development Methodologies Methodologies for Large Scale Projects Overview of the Unified Process file:///C|/oobook/EOOPTOC.html (5 of 8) [13/03/2003 02:55:02 }Ç Contents Basic Concepts Agile Methodologies for Small Projects The Agile Alliance eXtreme Programming DSDM Crystal - Adaptive Software Development Open Source Development Open Source is Distributed Development Resources Methodologies Web Sites Chapter 10: Software Tools for Object-Oriented Development GUIs vs. Consoles Editors and IDEs Emacs Vi Integrated Development Environments VIDE Borland JBuilder Sun Forte Other IDEs Source code control CASE, Modeling, and UML Tools ArgoUML MagicDraw Rational Software TogetherSoft Other UML Tools Other Java Tools JUnit Jikes file:///C|/oobook/EOOPTOC.html (6 of 8) [13/03/2003 02:55:02 }Ç Contents Chapter 11: Programming - A Personal Perspective Programming Your Code Never Dies Program With Style Know What You Are Doing Write Practice Programs Practice Incremental Programming The Tools Matter Objects Really Help Testing Debugging Don't Reinvent the Wheel Sometimes It is Better to Do It Yourself You Can Get Ideas Any Time Get A Life A Plan Matters The Tools Your Editor Really Matters Know About the Time-Tested Tools Know About the Latest Tools Tools Go Away The Work Environment A Happy Programmer is a Productive Programmer Physical Environment Flexibility 40 Hours The Team Marketing Matters Keep Up To Date Share the Struggle Let Programmers Help Make Policy Let Your Boss Know What You Need The Reference Software Story Programming Resources Use The Web file:///C|/oobook/EOOPTOC.html (7 of 8) [13/03/2003 02:55:02 }Ç Contents Watch Out for the Web Use Open Source, If You Can Other Programmers Web Sites Chapter 12: What Next? Object Orientation Java More Terms You Need To Know Distributed Computing Java Related Terms from Sun Other Terms Glossary med for Flyheart file:///C|/oobook/EOOPTOC.html (8 of 8) [13/03/2003 02:55:02 }Ç Why This Book? Preface Why This Book? The goal of this book is to cover the essence of what you need to know to develop object-oriented software using Java and UML. When you are through with this book, you should understand object- oriented software development well enough to answer the following questions: ● What is object orientation? ● What is the UML? ● What is Object-Oriented Analysis and Design? ● How do you do OOAD? ● What are object-oriented development methodologies? ● How do you use Java to write truly object-oriented programs? ● What is Swing, and how can you use it to write object-oriented graphical user interfaces? ● What are design patterns? ● What is refactoring? ● What tools do you use to write object-oriented programs? ● What are some guidelines for writing good code? ● What do I need to read next to learn even more about object orientation? Who Is This Book For? This book is intended for programmers who know the basics of file:///C|/oobook/Preface.html (1 of 6) [13/03/2003 02:55:04 }Ç Why This Book? programming with Java, and now want to understand the fundamentals of object-oriented software development. If you're fairly new to programming, and have had a class or two in Java, you're probably starting to feel comfortable using Java. So now, you're ready to really reap the benefits of true object-orientated programming in Java, and this book will help you. If you're an experienced programmer who wants to move from using an old style procedural programming language to developing object- oriented systems in Java, this book is also for you. This book will get you well down the path to real object-oriented software development. You will likely be able to learn the most important aspects of Java from the examples included in this book if you have a Java manual available for quick reference. However, this book should not be the last one you read on object orientation, the UML, or Java. Instead, it should give you the essential understanding of objects so you can read more advanced and detailed books on the topic with greater purpose. Overview of Chapters Chapter 1 is a brief introduction to objects and the benefits of object- oriented software development. Chapter 2 covers the fundamental concepts of object orientation. Object orientation has many important concepts, and of course, its own vocabulary. It is very important for you to understand the main concepts, and to be familiar with the specialized vocabulary. Even if you already are familiar with some object-oriented concepts, you should review them in this chapter. Chapter 3 covers how to use Java to write object-oriented programs. It is not really a Java tutorial, but rather concentrates on using Java to file:///C|/oobook/Preface.html (2 of 6) [13/03/2003 02:55:04 }Ç Why This Book? implement object-oriented concepts. The first part of the chapter covers very basic Java concepts. However, the later parts of the chapter cover more advanced topics such as object lifetime, copies of objects, and other concepts that are very important when working with classes and objects. Chapter 4 covers Object-Oriented Analysis and Design (OOAD). Rather than focusing on any specific OOAD methodology, Chapter 4 covers the basic concepts that are important for any methodology. The first four chapters cover the essence of object orientation. Chapter 5 takes a look at Graphical User Interfaces (GUIs) and the Java Swing library using the object-oriented perspective developed in the previous chapters. This object-oriented introduction to Swing is a somewhat different approach than is typically found in Swing tutorials. Chapter 6 ties everything together with a case study of a small Java application. The fundamental OOAD concepts covered in Chapter 4 are used to design the application, and the Java and Swing concepts covered in Chapter 3 and 5 are used for the implementation. The remainder of the book is less comprehensive in its treatment. The goal is to give you a good overview of the practical aspects of object- oriented programming. Chapter 7 introduces Design Patterns, a recent development that uses previously developed software design patterns to help make designing new software easier. Chapter 8 covers Refactoring, which is a disciplined object-oriented approach to revising and enhancing existing software. Chapter 9 gives brief overviews of some of the current software development methodologies for both large and small-scale object-oriented software projects. Chapter 10 covers some of the current software tools available for developing object-oriented software. Finally, Chapter 11 gives some of my personal guidelines for developing better software. file:///C|/oobook/Preface.html (3 of 6) [13/03/2003 02:55:04 }Ç Why This Book? About the Author I wrote my first program more than 30 years ago, and I have been developing software ever since.