Why Start with Objects?


[Page xiv (continued)]

The third edition still takes an objects-early approach to teaching Java, with the assumption that teaching beginners the "big picture" early gives them more time to master the principles of object-oriented programming. This approach seems to have gained in popularity as more and more instructors have begun to appreciate the advantages of the object-oriented perspective.


[Page xv]

Object Orientation (OO) is a fundamental problem-solving and design concept, not just another language detail that should be relegated to the middle or the end of the book (or course). If OO concepts are introduced late, it is much too easy to skip over them when push comes to shove in the course.

The first time we taught Java in our CS1 course, we followed the same approach we had been taking in teaching C and C++. We started with the basic language features and structured programming concepts and then, somewhere around midterm, introduce object orientation. This approach was familiar, because it was taken in most of the textbooks then available in both Java and C++.

One problem with this approach was that many students failed to get the big picture. They could understand loops, if-else constructs, and arithmetic expressions, but they had difficulty decomposing a programming problem into a well-organized Java program. Also, it seemed that this procedural approach failed to take advantage of the strengths of Java's object orientation. Why teach an object-oriented language if you're going to treat it like C or Pascal?

I was reminded of a similar situation that existed when Pascal was the predominant CS1 language. Back then the main hurdle for beginners was procedural abstractionlearning the basic mechanisms of procedure call and parameter passing and learning how to design programs as a collection of procedures. Oh! Pascal!, our favorite introductory text, was typical of a "procedures early" approach. It covered procedures and parameters in Chapter 2, right after covering the assignment and I/O constructs in Chapter 1. It then covered program design and organization in Chapter 3. It didn't get into loops, if-else, and other structured programming concepts until Chapter 4 and beyond.

Today, the main hurdle for beginners is the concept of object abstraction. Beginning programmers must be able to see a program as a collection of interacting objects and must learn how to decompose programming problems into well-designed objects. Object orientation subsumes both procedural abstraction and structured programming concepts from the Pascal days. Teaching objects-early takes a top-down approach to these three important concepts. The sooner you begin to introduce objects and classes, the better the chances that students will master the important principles of object orientation.

Java is a good language for introducing object orientation. Its object model is better organized than C++. In C++ it is easy to "work around" or completely ignore OO features and treat the language like C. In Java there are good opportunities for motivating the discussion of object orientation. For example, it's almost impossible to discuss GUI-based Java applications without discussing inheritance and polymorphism. Thus, rather than using contrived examples of OO concepts, instructors can use some of Java's basic featuresthe class library, Swing and GUI componentsto motivate these discussions in a natural way.




Java, Java, Java(c) Object-Orienting Problem Solving
Java, Java, Java, Object-Oriented Problem Solving (3rd Edition)
ISBN: 0131474340
EAN: 2147483647
Year: 2005
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net