Book Description

About the Author

Table of Contents

Source Code

Send Comments

Author's Homepage
 

Object-Oriented Software Development Using Java

Xiaoping Jia, Ph.D

Chapter 4: Classes and Inheritance

Objectives
This chapter is intended to provide an overview of the object-oriented software development approach. We start with a general discussion on software development and the desirable qualities of software products, followed by a discussion on what makes software development difficult and the difference between software engineering and other, more established engineering practices. Then, we introduce the basic principles, concepts, processes, and techniques of the object-oriented development approach. We also introduce a graphical notation for object-oriented analysis and modeling, and conclude the chapter with a case study of object-oriented analysis and modeling. 


Contents
4.1 Overloading
4.2 Inheritance
      4.2.1 Constructors of Extended Classes
      4.2.2 Subtypes and Polymorphism
      4.2.3 Overriding Methods
      4.2.4 Restriction
4.3 Extending and Implementing Interfaces
4.4 Hiding Fields and Static Methods
4.5 Designing Classes
      4.5.1 Avoiding Public Fields
      4.5.2 Separating Interface From Implementation
      4.5.3 File Organization
      4.5.4 The Canonical Form
      4.5.5 Class Organization
      4.5.6 Documentation
      4.5.7 Unit Testing
4.6 Applications --- Animation Applets
      4.6.1 Getting Parameters
      4.6.2 An Idiom for Animation
      4.6.3 Using Double-Buffering
      4.6.4 Reading Files In Applets


Source Code

  • 4-1: Enhanced DigitalClock applet 
  • 4-2: Scrolling Banner applet 
  • 4-3: Enhanced Scrolling Banner applet 
  • 4-4: Bouncing Ball applet 


  • Other Chapters

    Example 4.1: Enhanced DigitalClock applet 
    Like the DigitalClock example from chapter three, this applet displays the current time in hours, minutes, and seconds in the following format: 


                  HH:MM:SS 
     

    However, this example allows the foreground color to be set as a parameter. 

    Example 4.2: Scrolling Banner Applet 
    This is a simple animation applet. It displays a text banner that moves horizontally from left to right. When the banner moves completely off of the left end of the viewing area, it reappears at the right end. 

    Example 4.3: Enhanced Scrolling Banner Applet 
    This program extends the ScrollingBanner applet. It adds double-buffering to eliminate the flickering that occurs in the ScrollingBanner applet. 

    Example 4.4: Bouncing Ball Applet 
    This program illustrates the Animation Applet Idiom, graphics drawing, and double buffering. This applet shows a ball moving inside a rectangular box. The ball reverses direction when it touches any of the four sides of the box. 

    Book Description - About the Author - Table of Contents
    Source Code - Send Comments - Author's Homepage

    Webmaster: rpasenko@shrike.depaul.edu