Tutoring Java

My lovely wife is always trolling Craigslist, looking to put me to work doing odd jobs.  My latest odd job is a Java tutor.

I never took a formal Java class. I bought a book, trolled the web, and was given a project.  The good news is that I don’t have a lot of cruft to unlearn (i.e. I never used the Vector class before, and I still can’t figure out why anyone would choose an Array over an ArrayList).  On the other hand, I was never introduced to some standard classes, like NumberFormat or DecimalFormat .  That said, I’ve never used them in a Java program before, either.

Early on, I asked my student if they were using Eclipse, NetBeans, etc. in the class. She had never heard of them.  I gave her an assignment to download Eclipse and play with it some.  When we met last next, we used Eclipse to write the homework.  She was amazed how easier it was than Notepad.  It tells you right away when you have a mistake!  If you use a class that it doesn’t know about, it will offer suggestions and add the import statements!  And it has auto completion!

The IDE suggestion was difficult for me. I’m not always a fan of IDE’s.  But I think that everyone pretty much uses an IDE to write Java so also knowing a little about Eclipse will help her in the end.  And the fact that Eclipse can take care of some of the annoyances in Java while she can concentrate on realizing what a for or while loop is as apposed to trying to figure out where the DecimalFormat class is located in the standard library.  In the long run, knowing how a for statement works is more important than knowing all the parameters for DecimalFormat.

When we starting over over the next assigment, I was quickly reminded on how inane the programming assignments are in an introductory class. I’m not frustrated because there are easier/better way to do some things (and there are!) but in the fact that you can’t always use the most straightforward methods.  In this last, the instructors give sample output, and then a laundry list of things that he wants to see in the code.  Example: we needed to round some numbers to two decimal places and put commas in numbers above 999.  My student had an example from class that used NumberFormat and had notes on Locale.  Excellent!!  We implemented it and it worked flawlessly.  Then we got to the bottom of the laundry list and it said, “I don’t want to see hide nor hair of NumberFormat in your program!” 

So we used DecimalFormat instead. Only that DecimalFormat.getInstance() returns a NumberFormat object!  Hide nor hair, huh?  How do we do that?  Oh, yeah — you just just use DecimalFormat’s constructor. Then things were working fine.

Huh, that was an awful lot of work to fix already working code.



Powered by ScribeFire.

Leave a Reply

You must be logged in to post a comment.