14-SeriousOOP

14-SeriousOOP - Chapter XIV Serious OOP Topics Chapter XIV...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter XIV Serious OOP Topics Chapter XIV Topics 14.1 Introduction 14.2 OOP Terminology 14.3 Default Constructors 14.4 Accessing Attributes and Methods 14.5 Constructor Overloading 14.6 Accessing Multiple Files 14.7 Set Methods 14.8 Copy Constructors 14.9 Scope of an Object 14.10 Objects Are References 14.11 Using the "this" Reference 14.12 Nesting Classes with Composition 14.13 Static Attributes and Methods 14.14 Summary Chapter XIV Serious OOP 719
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14.1 Introduction What kind of a chapter title is Serious OOP ? Have we not been serious about Object Oriented Programming before? Frankly, the whole OOP business with Java presents some unique challenges in writing a textbook and teaching the topic. Just take a look at this really simple program, in figure 14.1, which was one of the first programs shown in the beginning of the course. Figure 14.1 public class Java0202 { public static void main (String args[ ]) { System.out.println("Plain Simple Text Output"); } } At the first introduction of this short program you did not learn all of its features. You did not know what a class was, why public or static is used and you did not know anything about an args array. All you really learned was that it was possible to display text with a println method, but then you also did not know what a method was. Languages like Pascal and C++ that support OOP are simpler to teach because it is possible to ignore OOP in the beginning until such a time that it is desirable to change gears and introduce Object Oriented Programming. Java has no such comfort because every statement must be placed inside a class. Even the simplest variable declaration or the shortest program, such as the one above, will require a minimum of one class. Important Java Reality A Java program consists of one or more class declarations. Every program statement must be placed inside a class. 720 Exposure Java 2009, APCS Edition 08-08-09
Background image of page 2
It may be tricky to teach a programming language, like Java, where you feel that everything needs to be introduced in the beginning, but that actually is one of it appeals as a computer science introductory language. During the last couple of decades, Object Oriented Programming has gained steady ground as the proper approach to program design. It is possible with C++ to skirt around OOP or postpone this OOP business for a considerable length of time. As you can tell by our little program example in figure 14.1, you cannot even blow your nose in Java without using a class. A full-fledged treatment of OOP involves showing the encapsulation of data (attributes) and methods (actions), but wait . .. students do not know anything about data types or variable declarations yet. In the very early chapters you learned various concepts on faith. You were shown many Java program features, told to use them and not ask too many questions with the promise that there will be future explanations. As time went on, you learned more and more about Object Oriented Programming and you have already seen a chapter on class methods , object methods , inheritance and composition .
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 58

14-SeriousOOP - Chapter XIV Serious OOP Topics Chapter XIV...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online