Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Teaching boolean functions...
Old
Jeremy
Guest
 
Status:
Posts: n/a
Lightbulb Teaching boolean functions... - 06-13-2006, 11:40 AM

I don't think the way the book approaches user-made functions is clear.

You should simply teach the user NOT to create a new function for a one liner.

For example

Code:
if ( alice.height < 10) then
  alice.moveUp ....

Your book and most of the exercises tells the students to do it this way:

Code:
if (alice.smallerThan10) then
  alice.moveUp ....
Then my students have to go through the unneccesarily complicated task of creating a method called smallerThan10 which is just

Code:
T/F function alice.smallerThan10
  return alice.height < 10
No one really codes this way. While I understand that you are trying to write a book that gently shows them functions, I think it's better to leave this chapter until after you have discussed variables and arrays.

I doubt that Alice's Java code has boolean functions defined this way. I do remember seeing bad programmers code:

if (x == y)

if (x.isreallyequaltoInValue(y))

and then make a method called isreallyequaltoInValue, but who does this?

A couple of other opinions:
  1. Variables should be taught earlier
  2. for loops should be taught in one chapter as opposed to two
  3. More practice problems with while loops should be added, not just the while event handler
  4. Fix the dotogether bug in the while event handler..... (please fix at least one bug before sims)

Just my 2cents.
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 06-13-2006, 08:16 PM

You may wish to re-read Pages xiv - xv, Preface, to the book. The authors are NOT telling anyone the order in which to teach the material, instead they have arranged the material in a manner they believe is helpful. I personally believe any mention of variables and loops should come AFTER recursion.

As far as when a person should write a method, I was of the opinion decomposition was an important subject to instil early on when teaching OOP? Otherwise you run the risk of students writing 200-line Main methods. If I am writing a program that constantly compares the values of Dice1 with Dice2 then I would not write 10 or 23 If (Dice1 > Dice2) statements. I would write, as you refer to it, a one-liner method which does the comparison. Should I later decide to modify the program should Dice1 value be greater than Dice2 value more than 10 times, then I would only have to add the code in a single place, not every place that I coded If(Dice1 > Dice2). Again, I believe the goal is to teach decomposition of problems.

Loops are in Chpt 3 and 7 of the book. I teach all loops after Chpt 8, Recursion.

Every one codes differently, but I like that I can pick and choose when to teach what from the Learning To Program with Alice book.

As far as more samples of while loops, email me and I will share some that I have developed for my students as well as those harvested from the internet.

Good luck. (just my 2 worth)

Last edited by lanceA; 06-13-2006 at 08:22 PM.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.