Learning Java …

How do you learn something new? … especially something that seems rather confusing and complicated? Learning how to learn is essential when working with computers and technology. Rarely is there a book, web site, course, or person that can explain everything that you want to know. Really learning something takes a lot of effort on your part, reading books, asking questions, and trying it. You almost always have to learn more than you may have wanted to.

I am currently teaching an introductory programming course that uses the Java programming language. So how can a student begin to learn Java (or any new concept)?

A good first step is to read a book. You may need to read a chapter two (or even three) times until you begin to comprehend the material. In reading the text you need to try the examples. Most authors will provide the source code to their textbooks so that you do not need Once the example is working (it may take a while just to “run” the example) you should modify the examples to verify your understanding of the material.

There are hundreds of Java books in print today. Finding a second book (or third or fourth) is also helpful. Take “field trip” to your local bookstore and browse the selection of books on Java. You should quickly find that some books “speak your language” better than others. You may also find on-line textbooks helpful such as Bruce Eckels “Thinking in Java, 3rd Edition” or David Eck’s “Introduction to Programming Using Java”. The bottom line is “Don’t be afraid to look at more that one book”. Most libraries also have Java books. When I am learning a new programming language I try to read as many books as possible on the subject.

Taking a course can help to structure your learning. In addition to reading the recommended text, make sure that you try the examples given during class. Instructor’s will generally cover examples that they think will help you learn the material. These examples may not be part of the textbook. Make sure that you take notes during class and ask questions. Don’t be afraid to ask questions when you do not fully understand something.

When writing programs work incrementally. Start with a program shell, in other words the bare minimum amount of code needed for the program to compile and run. Then begin adding features to your program. Compile and test your program as you go. I often see students type their entire programs and then try to compile and debug their code. This rarely works well or takes an incredibly long amount of time. If you find that your program will not compile, start commenting out code until it will compile.

Add comments to your program as you type your code. Rarely will you want to go back and add them. Labeling bracket can be useful to new programmers to prevent errors. Format your source code with proper line spacing and indentation. Many IDE’s (such as eclipse) will have this feature built-in.

Make sure you understand what you trying to accomplish. Many programs can be understood in terms of Input, Processing, and Output. Input happens first, then Processing, and finally Output. Know what you are trying to accomplish. A little bit of planning will go a long way. The worst possible way to complete a programming assignment is to “start typing”. Spend some time understanding the problem and designing your solution. Define the steps you will use to solve the problem. Define the variables and structures you will need.

The more books you read and examples you work with the better your understanding will be. It takes time. Tiger Woods has spent hours and hours on the golf course perfecting his game. He didn’t just sink one put and say “I got it”. He keeps practicing …

Learning how to program can be very frustrating at times. I remember spending an hour and a half on a True BASIC program where I had used the word “imput” rather than “input”. The more you program, the better you will get at finding errors. Think like a detective. Try to narrow down where the error might be. Verify the value of variables as you go with print statements or by using a debugger. Marathon programming sessions are usually not as productive as working a little bit at a time.

Windows XP Color Problems

I ran into an interested tech support problem this past weekend. A family member had a laptop running Windows XP. The colors in Word had a dark gray background. Some backgrounds were strange and buttons would not appear within web pages in Internet Explorer.

I first installed the Opera Web browser. No problem with web pages using Opera, thus it must be a Microsoft software issue. After installing all of the Windows updates, checking program defaults, checking for a virus, and checking registry entries, I resorted to Microsoft tech support forums.(hmm… maybe this should have been the first step). Found that all that was needed was to un-check the “Use High Contrast” settings under Accessibility Options in the control panel. Apparently there are multiple “Use High Contrast” settings. This computer used “Maple” which caused the colors in Word and Explorer to be rendered incorrectly.
accessibility.png

The GIMP

The GIMP is an open source photo editing and image manipulation program.  The home page is http://www.gimp.org/  An on-line book “Grokking The GIMP” is available at http://gimp-savvy.com/BOOK/

To install GIMP on Windows you will need to down load and install two files from http://gimp-win.sourceforge.net/stable.html  The first is the GTK+ Runtime Environment, the second is “The GIMP for Windows (version 2.2.17)”

Versions of GIMP are also available for Linux and Mac.  You can support this project by purchasing their software on CD.

OpenOffice

OpenOffice is a open source (ie. free) alternative to Microsoft Office. It includes the “Writer” word processor, “Calc” spreadsheet, and “Impress” presenter (ie. PowerPoint). It also includes a database, math equation editor, and vector graphics program (ie. Visio). You can download the latest version (for free) at http://www.openoffice.org/

It can open and save Microsoft Word, Excel, and PowerPoint files. Occasionally some of the formatting is off, especially with tables, but overall it does a great job. I have been using OpenOffice as my main (95%) word processor and spreadsheet at work since the spring of 2005 and at home (100%) since the fall of 2006.

I do not find the Impress presentation program as easy to use as PowerPoint, mostly because of the lack of built-in templates, although many can be downloaded at http://ooextras.sourceforge.net

Overall OpenOffice is a great product and the price is right.

-Prof. Lehman

Always something new to learn (Welcome)

One of the things I enjoy (usually) about teaching computer science is that their is always something new to learn. Things never stay the same.

I have been using the Internet since the fall of 1991 when I learned how to ftp, telnet, and e-mail (I only knew two people at the time with e-mail outside of the university). Gopher appeared soon after and then the world wide web. Archie & Veronica searches gave way to yahoo, Altavista, and then Google.

The first computer we owned at home was a Radio Shack Color Computer II (about 1984) with 16K of memory (yes that is K, not MB, not GB). It used the TV as a monitor and cassette tapes for storage. I used to type-in programs that came in a monthly magazine. I remember thinking “if I just had 32K I could run anything!”.

Blogs have been around for quite a while it was time for me to give it a try.

-Prof. Lehman