Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 364 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
364
Dung lượng
1,68 MB
Nội dung
Contents The Essenceof Object Oriented ProgrammingwithJavaandUML 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, andJava Introduction Object Orientation Object-Oriented Languages Object-Oriented Design andtheUMLThe Payoff of Objects Chapter Summary Chapter 2: TheEssenceof 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 TheEssenceofObject-Oriented Analysis Object Discovery Evaluate Candidate Objects Determine Object Hierarchies Discover Object Attributes Discover Object Operations TheEssenceofObject-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 theUML 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 withJava 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 ofthe 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, andUML 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 ProgrammingThe 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 theessenceof what you need to know to develop object-oriented software using Javaand 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? programmingwith Java, and now want to understand the fundamentals ofobject-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 ofJava 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 andthe benefits of object- oriented software development. Chapter 2 covers the fundamental concepts of object orientation. Object orientation has many important concepts, andof course, its own vocabulary. It is very important for you to understand the main concepts, and to be familiar withthe 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 }Ç [...]... item the user selects, or what the user does withthe mouse, different parts ofthe program will be executed The messages corresponding to a menu pick or mouse gesture originate withthe GUI system, and are sent to the appropriate program objects, which then have the responsibility to respond with some action The order and timing of these messages is determined by the actions ofthe user, and not by the. .. solve all the problems of software development, it makes the development easier, andthe long-term maintenance much easier The result is a real gain in programming productivity It is well worth the effort to learn object-oriented software development The goal of this book is to introduce you to the essenceof object orientation without overwhelming you with all the details of a specific object-oriented. .. 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 theJavaand Swing concepts covered in Chapter 3 and 5 are used for the implementation The remainder ofthe book is less comprehensive in its treatment The goal is to give you a good overview ofthe practical aspects of objectoriented programming. .. includes the means of accessing and changing the state of individual object members of that class A common representation of color is called RGB, where the color is specified by the values of its red, green, and blue components One possible design of a class called Color could provide the means of manipulating the color by both retrieving and setting the RGB values of a Color object In an object-oriented. .. community TheUML has become the de facto standard object-oriented notation TheUML is designed for discussing object-oriented design Its ability to show objects and object relationships is especially useful, and will be used in examples throughout this book The various features oftheUML will be introduced as needed The Payoff of Objects Object orientation can lead to big payoffs in the software development... theJava garbage collector The creation point of an object is under program control, but the exact moment when an object ceases to exist cannot be determined because ofthe way theJava garbage collector works Basic UML Class Notation The basic UML notation for a class is a rectangle with three horizontal parts The top part is used to hold the name ofthe class The middle part shows attributes, and the. .. each Java class is defined in a separate file The attributes of a class are defined by the declaration of variables of various types such as int or boolean A Java class includes the definitions ofthe methods used to implement the behaviors ofthe class The method definitions are integral parts ofthe class definition Communication via messages Messages are how objects communicate with each other Any... design and maintain over time Object-Oriented Languages There are several object-oriented programming languages available to choose from, including Smalltalk, Eiffel, C++, Objective C, Objective Pascal, Java, Ada, and even a version of Lisp There are two clear marketplace winners, C++ andJava Today, Java is the emerging object-oriented language of choice for many programmers and software projects One of. .. of 7) [13/03/2003 02:55:04 }Ç Chapter 1 TheUML originated in the mid-1990's from the efforts of James Rumbaugh, Ivar Jacobson, and Grady Booch (The Three Amigos) There is a standard specification oftheUML coordinated by the Object Management Group (www.omg.org) OMG is an industry sponsored organization devoted to supporting vendor-neutral standards for theobject-oriented development community The. .. Encapsulation is one ofthe most important aspects of OO It is what allows each object to be independent The exact implementation of attributes andof object behavior is hidden from the rest ofthe world through encapsulation The class definition is the main programming tool that is used to implement encapsulation A class is a description of a collection of objects with common attributes, behavior, and responsibilities . }Ç Contents Java Chapter 4: Object-Oriented Analysis and Design Software Methodologies The Elements of a Software Project The Essence of Object-Oriented. Sun Forte Other IDEs Source code control CASE, Modeling, and UML Tools ArgoUML MagicDraw Rational Software TogetherSoft Other UML Tools Other Java Tools