[Bluej-discuss] bluej-discuss Digest, Vol 53, Issue 20
TJ Evert
tjevert at gmail.com
Mon Nov 26 14:52:43 GMT 2007
Ah, a thread that can really get us all talking...
IMHO, objects should be "introduced" early and "taught" later.
We want out students to have access to certain object classes ASAP
("Scanner" for user input, etc.) So, I introduce objects right after
primitives in a chapter on "Data Types". It's apporpriate here to discuss
objects as a data type (aliasing, casting, autoboxing, etc.) I then go on to
cover object methods using the analogy:
operators: primitives
methods : objects
This way, students know what objects are, what they can do, and their basic
limitations. This allows me the freedom to finish up all the "procedural"
topics (static methods, control structures, recursion, arrays, etc.)
I wait much later to talk about *writing *object classes. This is where the
OO-early people miss the boat. It makes no sense to spend a lot of
time early on about writing object classes when the methods we use with them
are "weak". Here OO-early advocates might point out that an early stress on
nitty-gritty (read "difficult") procedural topics is a "turn-off". However,
I find most of my first-year students actually prefer the concrete and
difficult to the abstract and simple.
I also deeply believe that an introductory course must relect the history
and evolution (for good or bad) of the material it covers. The idea of OOP
evolved out of the need to encapsualize data and procedures. The only way to
fully appreciate that is to understand *data and procedures *(procedural
programming).
Modern liturature can't be fully appreciated without understanding
"classical" liturature. The same can be said with art, physics, music,
history, math and any other subject. Programming should be taught with it's
history, good or bad, in mind. I think "OO-early" will be thought of much as
"new math" was - a well-meaning but short-sighted attempt to get students
from "A" to "C" while skipping "B".
TJ Evert
PS - This is why I think it would be nice to have "Compile and execute main
class" feature in BlueJ
On Nov 21, 2007 7:00 AM, <bluej-discuss-request at bluej.org> wrote:
> Send bluej-discuss mailing list submissions to
> bluej-discuss at bluej.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.bluej.org/mailman/listinfo/bluej-discuss
> or, via email, send a message with subject or body 'help' to
> bluej-discuss-request at bluej.org
>
> You can reach the person managing the list at
> bluej-discuss-owner at bluej.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of bluej-discuss digest..."
>
>
> Today's Topics:
>
> 1. Re: bits of syntax to expose, and OO-early (was How to call
> an accessor method...) (Stephen Bloch)
> 2. Re: bits of syntax to expose, and OO-early (was How to call
> an accessor method...) (Lon Levy)
> 3. Re: bits of syntax to expose, and OO-early (was How to call
> an accessor method...) (Aryeh M. Friedman)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 20 Nov 2007 09:52:00 -0500
> From: Stephen Bloch <sbloch at adelphi.edu>
> Subject: Re: [Bluej-discuss] bits of syntax to expose, and OO-early
> (was How to call an accessor method...)
> To: bluej-discuss at bluej.org
> Message-ID: <a06240800c3689b6ffc7f@[10.84.36.241]>
> Content-Type: text/plain; charset="us-ascii" ; format="flowed"
>
> Ian Barland writes:
> >After I was noticing that each semester one or two students will spend
> hours
> >and hours thrashing because they wrote (what seems reasonable to them)
> >`i=i++`, yes I now avoid using ++ for at least two weeks after
> introducing
> >loops. (Still, some students have seen ++ on their own, and still fall
> into
> >that trap.)
> >
> >I don't actually *require* students to spell out `this.` or `i = i + 1`
> or
> >always use getters/setters, but the code I show in class does these
> things.
>
> I would certainly introduce "i = i + 1" BEFORE "i++" or "++i",
> because the former is built from syntax rules they've already seen.
> And really, the only reason to mention the autoincrement operators
> (or the automatic "this.") at all in a first-year course is so the
> students can read code written by other people.
>
> >(Over time, I'm becoming less and less convinced that OO is any less
> >confusing for
> >beginners than procedural programming.)
>
> and Aryeh Friedman adds:
> >OO is great in professional hands and sucks otherwise... I mentioned
> >to a former boss of mine who accused me of falling into the OO trap
> >... that you shouldn't be allowed to use OO until your out of school.
>
> Class-based OO is a terrific way to organize a multi-KLOC program.
> But first-semester programming students don't write multi-KLOC
> programs. Which means they have to pay the price of OO (in syntactic
> complexity and levels of semantic abstraction) without reaping much
> benefit -- at least at the time. An argument could be made that
> they'll reap the benefit later, when they DO need to write multi-KLOC
> programs and are already fluent in the syntax they need to do OOP...
> but the delayed gratification at least makes one question the
> effectiveness of OOP in a first course.
>
> What exactly is it about OOP that we WANT to teach in a first course?
> Is it simply that students need to start learning the syntax early so
> they've actually got it down by the time they need it? If so, then
> we'd better start in the same language in which we plan to eventually
> use OOP, no matter how horrible that language is.
>
> OTOH, is it the idea of defining data types to represent important
> aspects of the problem, and then writing algorithms and code based on
> those data types? That's a large part of the TeachScheme approach:
> we teach a data type, then how to write code (and tests) for that
> data type, then another data type, then how to write code for it,
> lather, rinse, repeat. By the end of a semester, my non-majors with
> no programming experience have learned to define and write code for
> primitive types, classes with fields, variant/polymorphic types,
> self-referential types such as linked lists and trees, parameterized
> types (e.g. Java templates), and higher-order types such as
> functions. (Admittedly, we don't spend a lot of time on the
> parameterized and higher-order types in a first course for
> non-majors.)
>
> Aryeh again:
> >At least you have the good sense to not start the Java vs. Scheme
> >debate again.
>
> The approach I've described above could in principle be done in
> Scheme, Java, C++, Pascal, Python, C, Smalltalk, etc. -- probably any
> high-level language invented in the past forty years. I've done it
> in Scheme a number of times, and once or twice each in Java and C++.
> In my experience it was easier in Scheme, but YMMV.
>
> The other reason to favor a functional-first approach is that it's so
> much easier to write tests for a functional program than for a
> stateful one. If you want to inculcate good testing habits in your
> students from the beginning, that's a significant incentive. Again,
> a functional-first approach CAN be done in almost any language; it's
> just a bit more natural in Scheme than in many other languages.
>
> --
> Dr. Stephen Bloch
> Math/CS Department
> Adelphi University
> sbloch at adelphi.edu
>
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 20 Nov 2007 10:03:38 -0600
> From: "Lon Levy" <LXL at oregon.k12.wi.us>
> Subject: Re: [Bluej-discuss] bits of syntax to expose, and OO-early
> (was How to call an accessor method...)
> To: <bluej-discuss at bluej.org>
> Message-ID: <4742B0FA.293A.008B.0 at oregon.k12.wi.us>
> Content-Type: text/plain; charset=US-ASCII
>
> Hi Stephen,
>
> It is time, once again, for me to try to cure a little more of my
> ignorance. What does multi-KLOC mean?
>
> Thanks,
>
> Lon.
>
> Lon Levy, MS-CSEd
> Computer Science Teacher
> Volunteer Computer Club Advisor
> Oregon High School
> 608-835-1316
>
> Lon.Levy at oregonsd.org
> LXL at oregon.k12.wi.us
> cs at levytree.net
>
> non somnos requiem
>
>
> >>> Stephen Bloch <sbloch at adelphi.edu> 11/20/2007 8:52 AM >>>
> Class-based OO is a terrific way to organize a multi-KLOC program.
> But first-semester programming students don't write multi-KLOC
> programs. Which means they have to pay the price of OO (in syntactic
> complexity and levels of semantic abstraction) without reaping much
> benefit -- at least at the time. An argument could be made that
> they'll reap the benefit later, when they DO need to write multi-KLOC
> programs and are already fluent in the syntax they need to do OOP...
> but the delayed gratification at least makes one question the
> effectiveness of OOP in a first course.
>
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 20 Nov 2007 13:31:17 -0500
> From: "Aryeh M. Friedman" <aryeh.friedman at gmail.com>
> Subject: Re: [Bluej-discuss] bits of syntax to expose, and OO-early
> (was How to call an accessor method...)
> To: General discussion for users of BlueJ <bluej-discuss at bluej.org>
> Message-ID: <474327F5.1050004 at gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Lon Levy wrote:
> > Hi Stephen,
> >
> > It is time, once again, for me to try to cure a little more of my
> > ignorance. What does multi-KLOC mean?
>
> xLOC = x lines of code
>
> - --
> Aryeh M. Friedman
> Developer, not business, friendly
> http://www.flosoft-systems.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.4 (FreeBSD)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHQyf1J9+1V27SttsRAuMVAJ9/GeL6oZ1838tslfB+lqcJD4IS7wCfc1qF
> SnVKGBd6Ioz0x3KeUpyhsWQ=
> =C4O4
> -----END PGP SIGNATURE-----
>
>
>
> ------------------------------
>
> _______________________________________________
> bluej-discuss mailing list
> bluej-discuss at bluej.org
> http://lists.bluej.org/mailman/listinfo/bluej-discuss
>
>
> End of bluej-discuss Digest, Vol 53, Issue 20
> *********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluej.org/pipermail/bluej-discuss/attachments/20071126/f69f6d9d/attachment.html
More information about the bluej-discuss
mailing list