-
Java is not a pure object-oriented programming language
as some primitive types are used for some values.
-
Andreae et al,
Surprises in Teaching CS1 with Java,
say that they
‘were surprised at just how difficult this was to teach’.
http://www.mcs.vuw.ac.nz/comp/Publications/
CS-TR-98-9.abs.html
-
To teach OO, one could ignore the primitive types.
You would also have to ignore Java's Core APIs,
and for and while
statements.
-
This is not Java.
Key feature is its well-stocked library of
already written code,
i.e., the Core APIs.
If primitive types have to be taught reasonably early,
how do we teach both primitive types and class types?
My own view is that they can be taught in the following order:
-
introduce primitive types;
-
demonstrate that operations can be performed on values of a
primitive type by using methods (and operators);
-
point out that the primitive types
are not sufficient to represent real-world objects;
-
introduce some of the class types of Java's Core APIs
as a way of representing
other real-world objects.
During this process it is important to use the
WWW pages that document Java's Core APIs
in order to show what is possible
with these class types.
So, although some may argue that my course is
not an object-first course:
-
using the classes of Java's Core APIs,
it introduces objects early;
-
it does this by giving examples that use classes like
java.awt.Point,
java.lang.String
and
java.util.StringTokenizer;
-
it does this by referring the students to the descriptions of these classes
given in the
WWW pages documenting the Core APIs.