Objects First with Java
A Practical Introduction using BlueJ
This document describes the goals, contents and main pedagogical
concepts of this book. It is largely identical with the preface
in the book.
Contents of this description:
Java
BlueJ
Real objects first
An iterative approach
Project-driven approach
Concept sequence rather than language
constructs
Chapter sequence
This book is an introduction to object-oriented programming for beginners. The main focus of the book is general object-oriented and programming concepts from a software engineering per-spective.
While the first chapters are written for students with no programming experience, later chapters are suitable for more advanced or professional programmers as well. In particular, programmers with experience in a non-object-oriented language who wish to migrate their skills into object orienta-tion should also be able to benefit from the book.
We use two tools throughout the book to enable the concepts introduced to be put into practice: the Java programming language and the Java development environment BlueJ.
Java
Java was chosen because of both its language design and its popularity. The Java programming language itself provides a clean implementation of most of the important object-oriented concepts, and serves well as an introductory teaching language. Its popularity ensures an immense pool of support resources.
In any subject area, having a variety of sources of information available is very helpful, for teach-ers and students alike. For Java in particular, countless books, tutorials, exercises, compilers, en-vironments, and quizzes already exist, in many different kinds and styles. Many of them are online and many are available free of charge. The huge amount of high quality support material makes Java an excellent choice as an introduction to object-oriented programming.
With so much Java material already available, is there still room for more to be said about it? We think there is, and the second tool we use is one of the reasons . . .
BlueJ
BlueJ deserves some comment. This book is unique in its completely integrated use of the BlueJ environment.
BlueJ is a Java development environment that is being developed and maintained by the Programming Education Tools Group at King's College London, UK, explicitly as an environment for teaching introductory object-oriented programming. It is better suited to introductory teaching than other environments for a variety of reasons:
- The user interface is much simpler. Beginning students can typically use the BlueJ environ-ment in a competent manner after 20 minutes of introduction. From then on, instruction can concentrate on the important concepts at hand—object orientation and Java—and no time needs to be wasted talking about environments, file systems, class paths, or DLL conflicts.
- The environment supports important teaching tools not available in other environments. One of them is visualization of class structure. BlueJ automatically displays a UML-like diagram rep-resenting the classes and relationships in a project. Visualizing these important concepts is a great help to both teachers and students. It is hard to grasp the concept of an object when all you ever see on the screen is lines of code! The diagram notation is a simple subset of UML, tailored to the needs of beginning students. This makes it easy to understand, but also allows migration to full UML in later courses.
- One of the most important strengths of the BlueJ environment is the user's ability to directly create objects of any class, and then to interact with their methods. This creates the opportunity for direct experimentation with objects, with little overhead in the environment. Students can almost "feel" what it means to create an object, call a method, pass a parameter, or receive a re-turn value. They can try out a method immediately after it has been written, without the need to write test drivers. This facility is an invaluable aid in understanding the underlying concepts and language details.
- BlueJ includes numerous other tools and characteristics that are specifically designed for stu-dents of software development. Some are aimed at helping with understanding fundamental concepts (such as the scope highlighting in the editor), some are designed to introduce addi-tional tools and techniques, such as integrated testing using JUnit, or teamwork using a ver-sion control system, such as GIT, once the students are ready. Several of these features are unique to the BlueJ environment.
BlueJ is a full Java environment. It is not a cut-down, simplified version of Java for teaching. It runs on top of the OpenJDK Java Development Kit, and makes use of the standard compiler and virtual machine. This ensures that it always conforms to the official and most up-to-date Java specification.
The authors of this book have many years of teaching experience with the BlueJ environment (and many more years without it before that). We both have experienced how the use of BlueJ has in-creased the involvement, understanding, and activity of students in our courses. One of the au-thors is also the development lead of the BlueJ system.
Real objects first
One of the reasons for choosing BlueJ was that it allows an approach where teachers truly deal with the important concepts first. "Objects first" has been a battle cry for many textbook authors and teachers for some time. Unfortunately, the Java language does not make this noble goal very easy. Numerous hurdles of syntax and detail have to be overcome before the first experience with a living object arises. The minimal Java program to create and call an object typically includes
- writing a class;
- writing a main method, including concepts such as static methods, parameters, and arrays in the signature;
- a statement to create the object ("new");
- an assignment to a variable;
- the variable declaration, including variable type;
- a method call, using dot notation;
- possibly a parameter list.
As a result, most textbooks typically either
- have to work their way through this forbidding list, and only reach objects somewhere around the fourth chapter; or
- use a "Hello, world""-style program with a single static main method as the first example, thus not creating any objects at all.
With BlueJ, this is not a problem. A student can create an object and call its methods as the very first activity! Because users can create and interact with objects directly, concepts such as classes, objects, methods, and parameters can easily be discussed in a concrete manner before looking at the first line of Java syntax. Instead of explaining more about this here, we suggest that the curi-ous reader dip into Chapter 1—things will quickly become clear then.
An iterative approach
Another important aspect of this book is that it follows an iterative style. In the computing educa-tion community, a well-known educational design pattern exists that states that important con-cepts should be taught early and often. It is very tempting for textbook authors to try and say everything about a topic at the point where it is introduced. For example, it is common, when in-troducing types, to give a full list of built-in data types, or to discuss all available kinds of loop when introducing the concept of a loop.
These two approaches conflict: we cannot concentrate on discussing important concepts first, and at the same time provide complete coverage of all topics encountered. Our experience with text-books is that much of the detail is initially distracting, and has the effect of drowning the im-portant points, thus making them harder to grasp.
In this book we touch on all of the important topics several times, both within the same chapter and across different chapters. Concepts are usually introduced at a level of detail necessary for un-derstanding and applying to the task at hand. They are revisited later in a different context, and understanding deepens as the reader continues through the chapters. This approach also helps to deal with the frequent occurrence of mutual dependencies between concepts.
Some teachers may not be familiar with the iterative approach. Looking at the first few chapters, teachers used to a more sequential introduction will be surprised about the number of concepts touched on this early. It may seem like a steep learning curve.
It is important to understand that this is not the end of the story. Students are not expected to un-derstand everything about these concepts immediately. Instead, these fundamental concepts will be revisited again and again throughout the book, allowing students to get a deeper understanding over time. Since their knowledge level changes as they work their way forward, revisiting im-portant topics later allows them to gain a deeper understanding overall.
We have tried this approach with students many times. Sometimes students have fewer problems dealing with it than some long-time teachers. And remember: a steep learning curve is not a prob-lem as long as you ensure that your students can climb it!
Project-driven approach
The introduction of material in the book is project driven. The book discusses numerous pro-gramming projects and provides many exercises. Instead of introducing a new construct and then providing an exercise to apply this construct to solve a task, we first provide a goal and a prob-lem. Analyzing the problem at hand determines what kinds of solutions we need. As a conse-quence, language constructs are introduced as they are needed to solve the problems before us.
Early chapters provide at least two discussion examples. These are projects that are discussed in detail to illustrate the important concepts of each chapter. Using two very different examples sup-ports the iterative approach: each concept is revisited in a different context after it is introduced.
In designing this book we have tried to use a lot of different example projects. This will hopefully serve to capture the reader's interest, and also illustrate the variety of different contexts in which the concepts can be applied. We hope that our projects serve to give teachers good starting points and many ideas for a wide variety of interesting assignments.
The implementation for all our projects is written very carefully, so that many peripheral issues may be studied by reading the projects' source code. We are strong believers in learning by read-ing and imitating good examples. For this to work, however, it is important that the examples are well written and worth imitating. We have tried to create great examples.
All projects are designed as open-ended problems. While one or more versions of each problem are discussed in detail in the book, the projects are designed so that further extensions and improve-ments can be done as student projects. Complete source code for all projects is included. A list of projects discussed in this book is provided in the next section.
Concept sequence rather than language constructs
One other aspect that distinguishes this book from many others is that it is structured along fun-damental software development tasks, not necessarily according to the particular Java language constructs. One indicator of this is the chapter headings. In this book you will not find traditional chapter titles such as "Primitive data types" or "Control structures." Structuring by fundamental development tasks allows us to present a more general introduction that is not driven by intrica-cies of the particular programming language utilized. We also believe that it is easier for students to follow the motivation of the introduction, and that it makes much more interesting reading.
As a result of this approach, it is less straightforward to use the book as a reference book. Intro-ductory textbooks and reference books have different, partly competing, goals. To a certain extent a book can try to be both, but compromises have to be made at certain points. Our book is clearly designed as a textbook, and wherever a conflict occurred, the textbook style took precedence over its use as a reference book.
We have, however, provided support for use as a reference book by listing the Java constructs in-troduced in each chapter in the chapter introduction.
Next:
A short description of each chapter
|