Welcome!

Java Authors: Lori MacVittie, Yeshim Deniz, Mike Kavis, Elizabeth White, Liz McMillan

Related Topics: Java

Java: Article

Teaching Kids Programming: Even Younger Kids Can Learn Java

One day my son Dave (10) showed up in my office with my rated 'R' Java tutorial in his hands

My solution to the problem? I've written my own e-book on it: Java Programming for Kids, Parents and Grandparents. Dave became my first kid student and this has helped me a lot to understand the mentality of the little people.

This is what I've learned while working on this project:

  • Most of the programming tasks require minimal knowledge of arithmetic and algebra skills. To start programming, a kid needs to understand what x = y+2 means. Another important concept to understand is an if statement.

     

  • Kids develop the abstract reasoning abilities by the fourth-fifth grade, and they also easily perform such tasks as browsing the Web, downloading and installing software. Dave have learned how to type, compile and run Java programs in Eclipse IDE in no time.

     

  • Kids learn much faster than adults, but they do not have "previous programming experience", which may actually be a good thing, because they do not have to switch from a procedural to object-oriented way of thinking. After learning about inheritance, Dave called my wife a superclass.

     

  • Adults are responsible creatures, and they can keep doing boring operations much longer that kids. Programming lessons with kids have to be short. One or two 45-minute lessons per week is enough. High school kids should be able to study more, but I do not have such experience yet.

     

  • Some people suggest using Logo as a first programming language for kids, mainly because it has a tool that lets you program with pre-drawn shapes like dogs and turtles. There is an opinion that REALbasic is also good for young programmers. Yes, this language has such concepts as objects, inheritance, casting and overloading, but who uses this language in the real world? Some recommend using Python. The syntax of these languages is not that much easier than Java. There are also plenty of people who write nostalgically about their first Atari computer...

     

  • Illustrations help. In my book I've included lots of color cartoon-like characters that are like a Java-fabric softener .

     

  • Kids like to see immediate results and enjoy playing with shorter programs, for example a class Fish has a method dive(int howDeep). Let me try to call this method several times with different arguments...

     

  • Graphical programming is the most fun, and even a fairly large program like Calculator, Tic-Tac-Toe or Ping Pong can be explained to children.

     

  • There is a middle school in Berkley, CA where six graders start learning Java. This school is equipped with Sun Server and multiple workstations. There is a long waiting list of kids that want to get accepted into this school.

Now I'd like to offer you a fragment from my e-book Java Programming for Kids, Parents and Grandparents. I hope you'll agree with me that even younger kids can learn Java.

Java programs consist of classes that represent objects from the real world. Even though people may have different preferences as to how to write programs, most of them agree that it's better to do it in a so-called object-oriented style. This means that good programmers start with deciding which objects have to be included in the program and which Java classes will represent them. Only after this part is done, they start writing Java code.

Classes and Objects

 

Classes in Java may have methods and attributes.

Methods define actions that a class can perform.

Attributes describe the class.

Let's create and discuss a class named VideoGame. This class may have several methods, which can tell what objects of this class can do: start the game, stop it, save the score, and so on. This class also may have some attributes or properties: price, screen color, number of remote controls and others.

In Java language this class may look like this:

 

class VideoGame {
String color;
int price;

void start () {
}
void stop () {
}
void saveScore(String playerName, int score) {
}
}

Our class VideoGame should be similar to other classes that represent video games - all of them have screens of different size and color, all of them perform similar actions, and all of them cost money.

We can be more specific and create another Java class called GameBoyAdvance. It also belongs to the family of video games, but has some properties that are specific to the model GameBoy Advance, for example a cartridge type.

 

class GameBoyAdvance {
String cartridgeType;
int screenWidth;

void startGame() {
}
void stopGame() {
}
}

In this example the class GameBoyAdvance defines two attributes - cartridgeType and screenWidth and two methods - startGame() and stopGame(). But these methods can't perform any actions just yet, because they have no Java code between the curly braces.

 

In addition to the word class, you'll have to get used to the new meaning of the word object.

The phrase "to create an instance of an object" means to create a copy of this object in the computer's memory according to the definition of its class.

A factory description of the GameBoy Advance relates to an actual game the same way as a Java class relates to its instance in memory. The process of building actual games based on this description in the game factory is similar to the process of creating instances of GameBoy objects in Java.

In many cases, a program can use a Java class only after its instance has been created. Vendors also create thousands of game copies based on the same description. Even though these copies represent the same class, they may have different values in their attributes - some of them are blue, while others are silver, and so on. In other words, a program may create multiple instances of the GameBoyAdvance objects.

Creation of a Pet
Let's design and create a class Pet. First we need to decide what actions our pet will be able to do. How about eat, sleep, and say? We'll program these actions in the methods of the class Pet. We'll also give our pet the following attributes: age, height, weight, and color.

Start with creating a new Java class called Pet in My First Project. Now we are ready to declare attributes and methods in the class Pet. Java classes and methods enclose their bodies in curly braces. Every open curly brace must have a matching closing brace:

 

class Pet{
}

To declare variables for class attributes we should pick data types for them. I suggest an int type for the age, float for weight and height, and String for a pet's color.

 

class Pet{
int age;
float weight;
float height;
String color;
}

The next step is to add some methods to this class. Before declaring a method you should decide if it should take any arguments and return a value:

 

  • The method sleep() will just print a message Good night, see you tomorrow - it does not need any arguments and will not return any value.
  • The same is true for the method eat().It will print the message I'm so hungry…let me have a snack, like nachos!.
  • The method say() will also print a message, but the pet will "say" the word or a phrase that we give to it. We'll pass this word to the method say() as a method argument. The method will build a phrase using this argument and will return it back to the calling program.

The new version of the class Pet will look like this:

 

public class Pet {
int age;
float weight;
float height;
String color;

public void sleep(){
System.out.println("Good night, see you tomorrow");
}

public void eat(){
System.out.println(
"I'm so hungry…let me have a snack, like nachos!");
}

public String say(String aWord){
String petResponse = "OK!! OK!! " +aWord;
return petResponse;
}
}

This class represents a friendly creature from the real world:

Let's talk now about the signature of the method sleep():

public void sleep()

It tells us that this method can be called from any other Java class (public), it does not return any data (void). The empty parentheses mean that this method does not have any arguments, because it does not need any data from the outside world - it always prints the same text.

The signature of the method say() looks like this:

public String say(String aWord)

This method can also be called from any other Java class, but has to return some text, and this is the meaning of the keyword String in front of the method name. Besides, it expects some text data from outside, hence the argument String aWord.

How do you decide if a method should or should not return a value? If a method performs some data manipulations and has to give the result of these manipulations back to a calling class, it has to return a value. You may say, that the class Pet does not have any calling class! That's correct, so let's create one called PetMaster. This class will have a method main()containing the code to communicate with the class Pet. Just create yet another class PetMaster, and this time select the option in Eclipse that creates the method main(). Remember, without this method you can not run this class as a program. Modify the code generated by Eclipse to look like this:

 

public class PetMaster {

public static void main(String[] args) {

String petReaction;

Pet myPet = new Pet();

myPet.eat();
petReaction = myPet.say("Tweet!! Tweet!!");
System.out.println(petReaction);

myPet.sleep();

}
}

Do not forget to press Ctrl-S to save and compile this class! To run the class PetMaster click on the Eclipse menus Run, Run..., New and type the name of the main class: PetMaster. Push the button Run and the program will print the following text:

 

I'm so hungry…let me have a snack like nachos!
OK!! OK!! Tweet!! Tweet!!
Good night, see you tomorrow

The PetMaster is the calling class, and it starts with creating an instance of the object Pet. It declares a variable myPet and uses the Java operator new:

Pet myPet = new Pet();

This line declares a variable of the type Pet (that's right, you can treat any classes created by you as new Java data types). Now the variable myPet knows where the Pet instance was created in the computer's memory, and you can use this variable to call any methods from the class Pet, for example:

myPet.eat();

If a method returns a value, you should call this method in a different way. Declare a variable that has the same type as the return value of the method, and assign it to this variable. Now you can call this method:

String petReaction;

petReaction = myPet.say("Tweet!! Tweet!!");

At this point the returned value is stored in the variable petReaction and if you want to see what's in there, be my guest:

System.out.println(petReaction);

Inheritance - a Fish is Also a Pet
Our class Pet will help us learn yet another important feature of Java called inheritance. In the real life, every person inherits some features from his or her parents. Similarly, in the Java world you can also create a new class, based on the existing one.

The class Pet has behavior and attributes that are shared by many pets - they eat, sleep, some of them make sounds, their skins have different colors, and so on. On the other hand, pets are different - dogs bark, fish swim and do not make sounds, parakeets talk better than dogs. But all of them eat, sleep, have weight and height. That's why it's easier to create a class Fish that will inherit some common behaviors and attributes from the class Pet, rather than creating the classes Dog, Parrot or Fish from scratch every time.

A special keyword extends that will do the trick:

 

class Fish extends Pet{
}

You can say that our Fish is a subclass of the class Pet, and the class Pet is a superclass of the class Fish. In other words, you use the class Pet as a template for creating a class Fish.

Even if you will leave the class Fish as it is now, you can still use every method and attribute inherited from the class Pet. Take a look:

Fish myLittleFish = new Fish();
myLittleFish.sleep();

Even though we have not declared any methods in the class Fish yet, we are allowed to call the method sleep() from its superclass!

Not all pets can dive, but fish certainly can. Let's add a new method dive() to the class Fish now.

public class Fish extends Pet {

int currentDepth=0;

public int dive(int howDeep){
currentDepth=currentDepth + howDeep;
System.out.println("Diving for " + howDeep +" feet");

System.out.println("I'm at " + currentDepth +
" feet below sea level");
return currentDepth;
}
}

The method dive() has an argument howDeep that tells the fish how deep it should go. We've also declared a class variable currentDepth that will store and update the current depth every time you call the method dive(). This method returns the current value of the variable currenDepth to the calling class.

Please create another class FishMaster that will look like this:

 

public class FishMaster {

public static void main(String[] args) {

Fish myFish = new Fish();

myFish.dive(2);
myFish.dive(3);

myFish.sleep();
}
}

The method main() instantiates the object Fish and calls its method dive() twice with different arguments. After that, it calls the method sleep(). When you run the program FishMaster, it will print the following messages:

Diving for 2 feet
I'm at 2 feet below sea level
Diving for 3 feet
I'm at 5 feet below sea level
Good night, see you tomorrow

Have you noticed that beside methods defined in the class Fish, the FishMaster also calls methods from its superclass Pet? That's the whole point of inheritance - you do not have to copy and paste code from the class Pet - just use the word extends, and the class Fish can use Pet's methods!

One more thing, even though the method dive() returns the value of currentDepth, our FishMaster does not use it. That's fine, our FishMaster does not need this value, but there may be some other classes that will also use Fish, and they may find it useful. For example, think of a class FishTrafficDispatcher that has to know positions of other fish under the sea before allowing diving to avoid traffic accidents :)

More Stories By Yakov Fain

Yakov Fain is a co-founder of two software companies: Farata Systems and SuranceBay. He authored several technical books and lots of articles on software development. Yakov is Java Champion (https://java-champions.java.net). He leads leads Princeton Java Users Group. Two of Yakov's books will go in print this year: "Enterprise Web Development" (O'Reilly) and "Java For Kids" (No Starch Press).

Comments (41) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Jasmine 09/22/07 02:28:14 PM EDT

I'm in my third week of my Java class in college. I just could not understand how to call to a method. Yes, I was having programmer block. This was simple explain and the "real life" examples help visual the layout. Now lets see if I can get my assingment done.

snoobab 06/05/06 04:07:12 AM EDT

Hi Yakov

You are way off in trying to teach kids proggramming by teaching them in Java. Or to be more accurate by teaching them in plain Java without some form of framework withh graphics and sound built in.

My suggestion is teach them in Smalltalk! To be more specific a smalltalk dialect named Squeak. Take a look at http://www.squeakland.org/.
I have been a Java addict for over 6 years, reading, learning, read blogs after blogs and have come across Smalltalk once in a while and just thought 'This is such an old language and must be really terrible compared to Java in terms of features and potential'.
Well now I know Java is a disabled version of Smalltalk with no new ideas and some evil twisting of others.
By no means is Smalltalk the best a language will ever get to but in my opinion it probably is in the top 3 if not right at the top.

Why teach kids how to compile? In Smalltalk as soon as you change the code IT IS COMPILED. Go take a look at Seaside web framework. Look at how you can change the code at runtime through the web interface and see your changes immediately. (By no means are these the best points of these products but just some that jump to mind, take a look at http://www.seaside.st/ http://www.opencroquet.org/index.html http://squeak.org/ http://www.whysmalltalk.com/ )

Kids don't need to see the complexity but should see a powerful tool in the form of a computer, and in my opinion Smalltalk (Squeak) opens up a childs imagination and potential.

I am hoping to leave Java and start some form of Smalltalk based consultation firm in South Africa.
All the best
Cheers
Smalltalk convert

SYS-CON Brazil News Desk 10/30/05 02:46:23 PM EST

Teaching Kids Programming: Even Younger Kids Can Learn Java. One day my son Dave (10) showed up in my office with my rated 'R' Java tutorial in his hands. He asked me to teach him programming so he could create computer games. By that time I've already written a couple of Java books and have taught multiple classes on programming, but all of this was for grownups! A search on Amazon could not offer anything but books for dummies! After spending hours on the Internet, I could only find either some poor attempts to create Java courses for kids, or some reader-rabbit-style books on our friends computers.

JDJ News Desk 10/29/05 06:01:44 PM EDT

Teaching Kids Programming: Even Younger Kids Can Learn Java. One day my son Dave (10) showed up in my office with my rated 'R' Java tutorial in his hands. He asked me to teach him programming so he could create computer games. By that time I've already written a couple of Java books and have taught multiple classes on programming, but all of this was for grownups! A search on Amazon could not offer anything but books for dummies! After spending hours on the Internet, I could only find either some poor attempts to create Java courses for kids, or some reader-rabbit-style books on our friends computers.

JDJ News Desk 10/29/05 05:50:17 PM EDT

Teaching Kids Programming: Even Younger Kids Can Learn Java. One day my son Dave (10) showed up in my office with my rated 'R' Java tutorial in his hands. He asked me to teach him programming so he could create computer games. By that time I've already written a couple of Java books and have taught multiple classes on programming, but all of this was for grownups! A search on Amazon could not offer anything but books for dummies! After spending hours on the Internet, I could only find either some poor attempts to create Java courses for kids, or some reader-rabbit-style books on our friends computers.

Alex 04/11/05 08:51:10 AM EDT

If you want to teach a child to use programming, I would seriously recommend you start them off with ActionScript, the language of Macromedia Flash. It's just about the easiest and most flexible language there is. I started using it when I was 9, and now have a complete understanding of the language. Most of the stuff I knew was self-taught, too. Because with Flash, you get the option of not typing out everything manually. The Actions panel can do most of the work for you - all you've got to do is drag in a script from a nearby list, and then specify the parameters it asks for. All the syntax you've missed out is done for you. Granted, Macromedia removed this feature in Flash MX 2004, due to the introduction of ActionScript 2.0, but if you pick up a copy of Flash MX from eBay or Amazon, you'll be able to learn the language with ease.

Flash is a lot simpler than most languages, since you can declare new variables whenever you want, you don't have to say how much data they store (int, long, double, etc.), a variable that started off as a value can be changed into a boolean, string, object, or any other data type, whenever you want. It's also VERY easy to produce results from a script quickly in Flash. Also, Flash is a vector art and animation program, so doing graphical stuff is a breeze.

I'm 13 now, and just starting to explore the realms of Java. Flash gave me a basic knowledge of classes, and I'm hoping to expand on that by learning a language that revolves around them a bit more. I'm trying to use Java to bridge the gap from ActionScript to C, and I've definitely learned something just from skimming your tutorial (what the 'extends' keyword does).

Teaching a child how to program is definitely possible, but if you use Flash to do it, there's a lot less for them to learn. Syntax highlighting can aid children such as myself immensely, even if it's just showing us when we've missed out a capital letter for a function name or something. Auto-indentation can't hurt, either, so make sure you've got a decent code editor.

Dave Adams 03/22/05 03:55:06 PM EST

I also agree that there are very few books out there for teaching kids programming and I commend the author for writing it.

One little secret is that if you write a book for kids, it will be adults that will read it. This is the best way to learn.

Andrew Wolfe 03/22/05 11:35:42 AM EST

Excellent points on "programming readiness" and interesting examples.

That said, I feel Java syntax is a little cryptic for kids (and adults too, actually). I'm urging Java on my math-major son-in-law strictly as a professional recommendation. However, in the case of my 14-year-old son, I would really prefer he have a more readable language available to learn programming. Let's face it -- in Java, the closure of braces and parentheses frequently and invisibly zangs across forty lines of code.

I'll note my 14-year-old son sometimes doesn't know the difference between runtime environments. He will pop up a bash window on one of our Macs, and code 'cout {{ "Hello, World!"'. (Board won't allow regular less-than sign.) (Granted that's C++ but you get the idea.) He's actually pretty much into Flash right now.

The commentary on wife being a superclass is hysteric.

Bill Tschumy 03/05/05 11:45:08 PM EST

A couple of years ago I taught a programming elective in Java to 7th and 8th graders. I quickly found out that all the IDEs were too complex for them. They needed something really simple. They also needed some fun programming tasks.

I end up writing a simple IDE call Jurtle. It combined an editor with a graphics area where you could program a Turtle to move around as in the Logo language. It was a big enough success that I wrote a programming tutorial to go with it and turned it into a commercial product.

You can find out more about Jurtle at http://www.otherwise.com/Jurtle.html.

faroza shamsi 01/25/05 06:38:28 AM EST

wow its gr8 well i was searching for a site that could teach me programming . ah well am new to java and have boards nest year .n itz really gud to begin it like a kid when u r using it for the dirst time .......thnx ur da best

Dave Yang 10/16/04 03:11:27 PM EDT

I was searching for "Teaching kids programming" and came to this page. As a parent (with an 8 year old son) I'm beginning to look for software and languages that are appropriate for his age. Although I'm a multimedia and rich internet application developer, figuring out where to start my son on programming is a new challenge. We looked at Lego Mindstorms a few years ago and thought it's too difficult for him (box label says for age 12+), and I'm also looking at all the classical first programming languages such as Logo and Pascal, but I feel that perhaps something more visual and instant would generate more interest. On the other hand, I want my son to learn the concept of object-oriented programming, which is natural and applies real-life concepts.

Perhaps I'd start him off learning ActionScript (Macromedia Flash) because it is:

1) simpler than Java/C#...etc.
2) object-oriented with a syntax very similar to Java (ActionScript 2.0)
3) easy to create visual elements and animations
4) instant gratification (not sure if this is always a good thing!)
5) popular as a standard web format so he can reuse and show them easily

Thanks for the article. I think more such tutorials for kids are needed.

Thomas 05/11/04 03:52:39 PM EDT

a fun read end-to-end. parenthetically,I got Legos Mindstorms for my birthday last month, and fretted about getting a "kids" toy that costs...etc, etc, until I saw my son (7)following the tutorials over my shoulder and when questioned, explaining concepts like variables,loops and conditionals to me. I thought about leaving the Legos language on there for his sake(the lego block metaphor for a 7 year-old is compelling), but after two weeks, updated the firmware to leJOS- My son loves making things out of legos and I am hoping that his interest in seeing these little robots do things (in java) will prompt him to learn more about how to make them do things he wants them to.

Chad Woolley 05/10/04 05:32:53 PM EDT

Great article. However, you are teaching a bad habit with this method:

public int dive(int howDeep)

This is a prime candidate for the "Separate Query From Modifier" refactoring:

http://www.refactoring.com/catalog/separateQueryFromModifier.html

You should have:

public void dive(int howDeep)
public int getDepth()

Small focused methods are good, and easier to understand - especially for beginners, I would think. Focus on one thing at a time (something many "good" programmers have a hard time with)!

Thanks,
Chad

Yakov Fain 04/29/04 05:44:30 PM EDT

Mark,

I''m not the one who prepared the HTML for this article :(
My e-book has the proper indentation - see the sample chapter over here: http://www.smartdataprocessing.com/java4kids.htm

Mark 04/29/04 04:37:34 PM EDT

Having taught Java at the Community College level in both "Computer Science 1" and "Intro to Java Programming" contexts, I applaud your efforts to bring an Object Oriented language to grade schoolers.

However, I only wish I had the words to express the HORROR I felt on seeing your white-space cramped, left-justified 1TBS code examples. Surely a properly indented Allman-style example would be a better, easier to read example.

Shouldn''t the first lesson of programming should be "Make it readable, because YOU are going to have to read it."

And yes, they should learn this early, just as they learn capitalization and punctuation and penmanship early.

Julie 04/29/04 01:35:44 PM EDT

Forget about kids, I MYSELF (an adult beginner wanna-be programmer) want that book!

Simon 04/29/04 10:13:12 AM EDT

A few years ago, when my daughter was 7-8, I started to teach her C++. I quickly discovered that was too tough, and started with Java which was also too difficult. Next I considered HTML/JSP as a better start. Then I thought - "She hasn''t written emails yet" , maybe she should start there? Finally, I realized she''d never written a letter with pen and paper.... Maybe I should slow down a bit!
On the other hand, my son could touch type before he could write the alphabet so there are some things we can get them started on!

JASON 04/28/04 12:13:55 PM EDT

Very interesting and good article, not only for younger kids, I even can clear my mind at some OO theory, be a damn VB program too long.
By the way, where I can get a copy of this e-book?

Barb Carver 04/27/04 05:53:34 PM EDT

I loved you tutorial on Java. I don''t know anything about Java so this was a great start for me. I''m ready for lesson 2.

giuliano carlini 04/27/04 01:02:35 AM EDT

Love your turorial. Has just the right amount of "flash" to capture a kids interest.

One suggestion. Eclipse is a great IDE, but having taught Java to 12 year olds, I can say from experience it''s too much. It gets in their way. By the time you''ve explained how to use it, you''ve lost them. This isn''t as big a deal when your teaching one kid, but when your teaching 10, you need to cut to the chase ASAP.

Check out DrJava at drjava.org. It''s a great IDE for kids, or even for adults who are put off by big IDE''s. It runs on Windows, OS-X, Linux, Solaris, or anywhere you have a 1.4 JDK.

Llaurick 04/26/04 05:27:21 PM EDT

I should specify that I am not from France, but from Quebec, Canada. 80% of people living in Quebec are francophones. I am very glad to hear the book will be translated. I will surely get a copy when it''s done. But the translator should take into account that many of the readers may not be from France and kids may not use the same expressions. I may be willing to verify that the translation does not use any expressions kids here may not understand ;)

And java IS hot here.

Thanks again
Llaurick.

Yakov Fain 04/26/04 04:07:01 PM EDT

Surprisingly enough, I?ve got several requests to translate this book to French, and one translator is willing to do this. Java must be hot in France!

Thanks,
Yakov

Llaurick 04/26/04 03:18:10 PM EDT

This book is simply wonderful. It''s the first time I see an object oriented programming book targetted at kids. I would buy it for my boy but there is sadly one major problem: He does not speak English (we are francophone). So I was wondering:
Do you have any project of having this book translated?

Thanks.

I.Kladko 04/26/04 09:43:33 AM EDT

Great book and article ... Will find its young, talented and very potential audience very soon.

Stu L 04/23/04 01:14:58 PM EDT

I was trying to get my son (age 8) started and we fooled around with the Robot Wars game from IBM(?) some. It had enough of a framework to make getting started easy, and he could pick up the concepts of calling things to change colors or the actions of the tanks. But this seems like a better approach to start actually "teaching it" rather than just trying to jump into the middle. I agree that a book for "kids" would be a great idea.

James H 04/23/04 10:31:40 AM EDT

Start your kids with Java. As you mentioned not having any prior programming knowledge can be a benefit. They don't have to learn to "translate" things from the first language learned. The approach to learning is the key. Kids usually learn faster than adults, but differently.

Dale 04/23/04 10:12:03 AM EDT

A very good article! I really like the way you present the information for the younger programmers (in all of us).

Bob W 04/23/04 09:59:12 AM EDT

Oops, in my post earlier, I just realized someone may think there is such an IDE/learning environment for Python, or that BlueJ would work with it. BlueJ is strictly for Java. Python has no BlueJ-equivalent IDE/learning environment that I am aware of. If anyone knows of one, I''d love to hear about it.

Howard Parks 04/23/04 09:51:59 AM EDT

Interesting idea. Several years ago I tried to teach a class of junior high age students programming. I found the DJGPP set of tools and used them because Pascal was at that time the best language to learn programming in. If I were to attempt that today, I would use Java without question. I would probably go the BlueJ route rather than the Eclipse route, though I would want to show them Eclipse as part of the class.

The wife is definitely a superclass, not an interface, because she was once a kid herself. Besides, it never hurts to use the words "super" and "wife" together in a sentence, just in case she happens to browse to this page.

Bob W 04/23/04 09:51:45 AM EDT

The article was informative, and the book looks pretty good compared to many others I''ve seen.

But, as one poster already noted, there is an IDE called BlueJ that is oriented towards learning Java and OOP. BlueJ is targeted towards first-timers, including children. It hides the syntax, allowing creation of objects and methods with windows/popups. It is easier for many people, especially children, to learn concepts first rather than syntax. As they progress, they can review and change the syntax that was generated earlier. There is also a book for learning Java using BlueJ (I purchased it at Borders Books). In addition, BlueJ also has a syllabus for high-schoolers that aims towards taking the AP Computer Science Exam in Java for college credit.

My 16 year old Nephew had a Java class in school that everyone was struggling with. I started him with the BlueJ book and IDE early on, and he was the only one in the class that wasn''t struggling with the concepts. To use a metaphor, because the teacher was pushing them in the standard ''syntax first'' style, I think they were all getting overloaded with memorizing individual trees, and their bark (Java syntax and the meaning of each of those little keywords, all new to them) before getting a good look at the forest. Java is a language with lots of trees.

In my opinion, a language like Python, used with an IDE like BlueJ would be the perfect match. Python has cleaner syntax and fewer keywords than Java, with programs being correspondingly smaller. Not having to worry about data types, return types, function types, void, braces, semicolons, etc, means less things to get in the way of learning the core concepts of programming. Most everyone is going to understand numbers, strings, and lists easily - unlike bytes vs integers vs longs vs floats vs chars (and arrays of chars) vs strings, etc. Being forced to properly indent for blocks teaches good programming style.

AFter learning Python, you can move on to more syntactically complicated languages like Java, if you need to (for a job, or to take the AP exam). Having used many langauges over the years, I can''t imagine actually wanting to switch to Java just for fun (I went the other way, and only go back when I need to).

Mark Fortner 04/23/04 09:37:47 AM EDT

Actually, your wife is more of an interface, since Java doesn''t support multiple inheritance. Basic Kid functionality (play, eat, sleep) would be provided by Aspects. ;-)

Pedro Rozo 04/23/04 09:35:55 AM EDT

So good, it is a way to show that Java is not only a powerful language, it is a useful tool to every level people, and could be used for new generations starting for our kids.

Pedro Rozo
Sun Certified Web Component Developer for J2EE
Vancouver/Canada

Gene Myers 04/23/04 09:02:57 AM EDT

"After learning about inheritance, Dave called my wife a superclass."
Assuming have already taught your son that he should not treat woman as objects, I would imfer that your wife, or any woman, could only be an abstract class. Hmmm...I''ll leave that one alone!

Excellent article.

Christy 04/23/04 08:48:26 AM EDT

Maybe I''m younger than I thought! I have a whole slue of Java books, that I just can''t ''get.'' Having cut my teeth in VB, Java is a totally different animal, or so it seemed. I read the article, and actually got it. There is a light at the end of the tunnel!

Carl 04/23/04 07:51:33 AM EDT

Excellent article...

Mark Crocker 04/23/04 06:44:41 AM EDT

Sorry about that... the posting filter chopped my message. The rest goes...

...simplifies things like Blue (http://www.bluej.org/). When you use BlueJ, you can get right into the main ideas of object orientation without having to deal with the emparrassment of having to explain things like ''public static void main (String[] args)'' and other administrivia. Teaching core concepts first is very important and BlueJ makes that easy... and yes, it''s free too.

Mark Crocker 04/23/04 06:42:23 AM EDT

Sure and IDE can help, but most are ridulously over complicated. For something like this, you should consider an environement that actually simplifies things like BlueJ. When you use BlueJ, you can get right into the main ideas of object orientation without having to deal with the emparrassment of having to explain things like ''public static void main (String[] args)'' and other administrivia. Teaching core concepts first is very important and BlueJ makes that easy... and yes, it''s free too.

Yakov Fain 04/23/04 06:26:11 AM EDT

Thank you, Andrew. The only way to keep the interest of a kid is to use very simple examples and show them how they can quickly get results. You should also use game-like approach - all kids like to play games.

Using an IDE is a must, and Eclipse is the best FREE professional IDE available.

Speaking of publishing this book in paper... This book must be printed in color, which is really expensive. I''ll be happy to do this if some publisher will take care of the bill...

Andrew Yeomans 04/23/04 03:22:12 AM EDT

Looks great! I too searched for such books and found nothing that would keep the interest of a teenager.

I''m glad you decided to use an IDE. Some other books just use the Java SDK command-line approach. Nostalgic, but hardly likely to impress a generation brought up on WYSIWYG GUIs and video games. I started teaching my son using BlueJ (www.bluej.org) - a simple but good teaching IDE - but found it hard to sustain interest without examples he could relate to.

Hope you can get this published in paper form as well as e-book.

Fadi 04/23/04 02:54:11 AM EDT

Interresting. Unfortunately, this kind of tutorials is very cultural oriented. It is hard to adapt it to cross-culture

Great work

PRABHAKAR 04/23/04 02:28:56 AM EDT

eXCELLENT AND iNTERSTING