Objects or Design First - Lehigh CSE - Lehigh University

The first is CIMEL (Blank 2003), multimedia courseware which presents object-
oriented concepts through text, audio, graphics, and interactive exercises. The
second is the Eclipse IDE for Java, augmented with two extensions: a DrJava
plug-in which provides an interactive environment for demonstrating Java code (
Allen ...

Part of the document


Objects or Design First?
Authors (depends on contributions to writing this paper!)
Computer Science and Engineering Department
Lehigh University
Bethlehem, PA 18015 USA
glennblank@gmail.com, sgh2@lehigh.edu

Abstract
Pedagogies for teaching object-oriented programming in an introductory
course are still under much debate. We present a design-first
approach, which teaches problem-solving techniques using elements of
use cases and UML. Objects are still introduced early in the
curriculum. We also present tools supporting our approach: , the
Eclipse IDE with a UML plug-in for class design that we are developing
for novices and multimedia courseware to help students learn the basic
concepts of objects and classes.

Introduction

Though object-oriented programming has been with us for more than a dozen
years, there is still much debate on how and when to teach it. Kim Bruce
(2004) reviews three basic approaches for instructors to try in a CS1
course: teach objects later, after students learn procedural constructs
including loops and arrays; teach objects first, using pedagogical tools
such as BlueJ, DrJava, or microworlds; or use a procedural or functional
language for the first course and save object orientation for CS2.

A heuristic for curriculum development is: students learn best what they
learn first. If that is true, and if object-oriented concepts, such as
modularity and reuse, are more fundamental to modern software development
than the syntactic details or even procedural decomposition, we chose to
try an "objects-first" approach facilitated by the BlueJ environment
(Kölling 2003). Our experimental results demonstrate that students can
learn an "objects-first" approach to Java, especially with the help with
multimedia-guided instruction and exercises (Blank 2003).

An objects-first approach does not, however, address another crucial aspect
of software development-how to analyze a problem or design a solution.
Object-oriented problem solving is a significant obstacle for CS1 students
(Bailie 2003). BlueJ hints at object-oriented design by presenting
beginners with a simple UML-like design with which they interact before
writing any code. But BlueJ does not reveal where these designs come from
or invite students to create their own. Like earlier syntax-oriented
approaches, BlueJ still reinforces a misconception that software
development is little more than coding. In an era of concerns about out-
sourcing programming jobs, as well as ongoing difficulties attracting women
and minorities into computer science, we believe it is a mistake to
continue reinforcing this stereotype in the first course. Before coding,
we believe students should get a glimpse of the big picture of software
development, so that they can better appreciate its challenges and
opportunities.

We therefore propose a "design first" approach in introductory courses, in
which students learn object-oriented analysis and design as problem-solving
skills. In our curriculum, students learn how to develop use cases to
analyze problems, then design solutions using UML, before implementing any
code in Java (Moritz 2005a). Interactive multimedia lessons introduce the
curriculum (Blank 2005a). We have incorporated an initial version of our
new curriculum in a CS1 course at Lehigh University as well as a Java
programming course at a local inner-city high school, and the results are
promising (Moritz 2005a).

We support our curriculum with two tools. The first is CIMEL (Blank 2003),
multimedia courseware which presents object-oriented concepts through text,
audio, graphics, and interactive exercises. The second is the Eclipse IDE
for Java, augmented with two extensions: a DrJava plug-in which provides an
interactive environment for demonstrating Java code (Allen 2002) and a UML
plug-which supports entry of class diagrams and generates Java code from
class designs.

The next section describes our design-first curriculum in detail. The
following two sections introduce the tools we are developing to support
this curriculum. Section 4 discusses results using this curriculum at the
high school level, and section 5 summarizes our future plans, including an
intelligent tutoring system.

2. The Design-First Curriculum

The current curriculum consists of eight units covering: 1) software
engineering, comparing the process of building a software system to
building a house (requirements and architectural design); 2) the concepts
of objects, classes, and instances; 3) use cases and UML class diagrams in
the context of developing a movie ticket machine project; 4) identifying
attributes and methods and designing a class; 5) syntax of expressions and
statements, including assignment, if statements and character output; 6)
designing a character-based input separately from the problem domain
classes; 7) graphical user interfaces using Swing; and 8) applets.

The curriculum is project-based, i.e., new concepts are introduced in the
context of a larger project in which they are immediately applied.
Students work on projects analysis, design and Java programming in pairs,
throughout the course. Each student is assigned a partner with whom he or
she works for the semester. They alternate daily who types and who
observes.

A detailed description of each unit follows:

Unit 1 introduces the idea of software engineering. Building a software
system is compared to building a house. Students list the steps in building
a house from a customer's initial wishes through gathering requirements,
looking at existing plans, creating a blueprint, and so on. Analogous steps
in software development are discussed. Thus, our curriculum first
emphasizes the process of solving a problem.

Next are objects. Unit 2 introduces students to objects as entities with
attributes and behaviors, and to classes as descriptions of categories of
objects. These lessons are supplemented by the CIMEL multimedia, and by
several hands-on exercises in Eclipse. The exercises use an Eclipse project
based on the Shapes classes delivered with BlueJ and referenced in Objects
First with Java (Barnes 2002). Whereas BlueJ gives students a birds-eye
view with a class diagram of the Shapes classes in an idiosyncratic
notation, our setup immediately introduces students to a class diagram in
UML. Interacting with this class diagram and DrJava, students create
instances of Square and call methods to change their locations or colors,
and see the results immediately. Students also examine the attributes of
each Shape and learn about data types. A final exercise invites students to
add their own code to an existing method and view the results.
Unit 3 teaches use cases and class diagrams in the context of developing a
small application: a movie ticket machine (adapted from the idea of a train
TicketMachine class in Objects First with Java). The instructor plays the
role of a theater manager, whom the students interview to determine the
system requirements. Working in pairs, they develop use cases, including a
detailed description of the actions performed and the actors involved. They
go on to design a Ticket Machine class, by entering the class, including
attributes and method signatures, into the Eclipse UML interface. Students
also develop a test plan to be executed after the code for each method is
written. Thus our design-first curriculum borrows the idea of test-first
development from Extreme Programming (XP).

In unit 4, students learn procedural language concepts, starting with
variables, assignment and arithmetic operations, followed by character-
based printing and if statements. They complete exercises that give them
practice in each new concept, then immediately apply what they've learned
in coding the Ticket Machine's methods. They execute their test plans by
creating a Ticket Machine instance and calling methods from DrJava's
Interactions Pane. Thus the syntactic details of Java have been deferred
until after students have begun to learn about object-oriented software
analysis and design. They learn just enough syntax to implement a solution
to the problem they have been working on. Test their solution
incrementally in DrJava encourages an appreciation for an iterative
approach to software development

In unit 5, students learn how to build a character-based interface for the
Ticket Machine. A class called "EasyReader" is provided to simplify reading
character input. (We plan to replace EasyReader with the Scanner class when
Eclipse supports JDK version 1.5.) Students also learn how to convert
String data to integer or double data types using the parseInt and
parseDouble methods from the Integer and Double classes. They code a simple
interface that presents a menu of options to the user, and based on the
user's input, performs the requested function, such as displaying the movie
title and price, accepting money for tickets, or printing tickets. The
interface design is kept in a separate class from other classes, so that
students learn the principle of separation of concerns-keep problem domain
and human interaction separate, or loosely coupled. They will soon see
this principle pay dividends when they learn how to create a graphical user
interface.

Unit 6 introduces loops. Students apply while-loop logic to allow the user
to enter