1 Prolog

Rudolf Pecinovsky

Contents of whole series

I want to learn programming. My friend told me that the best language for a beginner is Java.

I agree with him that Java is one of the best languages for this purpose. In addition, according to many statistics it is also by far the most used language. I will not mention all its advantages – you can find them in many places. I will be glad if I can help you with your entry into the cosmos of program development

He also advised me not to choose a textbook or a course, which concentrates on the language rules and library overview and which supposes, that I will learn programming as a side effect.

I know that this is a common problem of many courses and textbooks, but don't worry. We will concentrate on the programming itself. The language rules and library offers I will not explain until we really need them.

However you should not worry when you discover that I teach programming in a little different way to most textbooks. I teach according the Design Patterns First methodology. It is relatively young (it arrived in 2004). With other methodologies you often get in beginners courses some habits that you have to reject in advanced courses

So why do they teach it in such a way when one knows, that this way is not the best one?

Many teachers believe that it is impossible to teach the program design, when the students are not able write and verify their designs. Therefore the courses for beginners teach how to write previously designed programs. The art of how to design the program is therefore mostly not taught until the advanced courses. The disadvantage of this approach is that in beginner courses many students pick up some bad habits and in the advanced courses they have to abandon them.

For a long time a methodology didn't exist that was able to change this disagreeable state. Fortunately at the turn of the century new teaching tools appeared that allowed new methodologies to develop which almost eliminate this problem.

However now is not the right moment to explain all the details. When we run into a subject that by the classical approach causes problems for beginners, I will tell you.

I don't want to race against time to see how quickly I can pass the course. I have several friends, who wanted to learn programming quickly and who then for several following months have been discovering the subjects that the course or textbook omitted because of limited time. They had to learn everything anyway; however it has taken much longer.

There is a true well known expression Quickly learned, quickly lost. We will not hurry. Whenever you are in doubt, you can ask immediately. We will not try to teach you something quickly but we will try to teach you it well.

I am pointing out ahead that several of the first lessons probably won't seem like lessons in programming, but like sort of playing with computer. It is not true. In these early lessons you have to learn and master many terms, rules and relations that are necessary for deep understanding of future subjects.

In almost any course I lead there are several students who underestimate this starting phase and afterwards they blame themselves for their problems because they have not paid sufficient attention to the starting lessons.

Accompanying animations

Do you think that you can get everything through to me? I need to try everything several times before I get it.

I will try. In addition several early lessons will be accompanied by animations. You can open them in your favorite browser and alongside on the screen you can try out everything that the animation shows.

Allow me therefore to start with some advice on how to control these animations. They have two sets of controls:

  • The green buttons with arrows located in the bottom corners of the animated picture.
  • The silver control bar under the animated picture.

After some demonstration the animation always stops to allow you to see the result or to read some information about the action shown or about the action the animation is going to show.

The green button with the right arrow runs the next part of the animation. The green button with the left arrow returns the animation to the previous breakpoint. You use them when you want to run the last part again.

The silver control bar allows you to stop animation at any moment and to let it continue. For this purpose you use the button on the left side of the control bar.

You can also move to any moment in the animation – it is enough to click on the control bar where the pointer moves. The pointer then jumps to the place where you clicked and the animation jumps to the corresponding moment, too. You then run the animation by pressing the button at the left side of the bar.

Click here to run annimation

Animation 1: Animation describing the control of its own

What will we need?

I am looking forward to it. What I will need for it?

Besides wanting to learn OOP you will need some development tools which allow you to analyze demonstration programs and especially to develop programs of your own. The good news is that all the tools you need you can legally download for free.

You have said “all needed tools”. Does it mean that we will need more than one tool?

Your guess is right. At the beginning we will need JDK and BlueJ, later we add the NetBeans.

File manager

Don't throw abbreviations at me; you have to explain its meaning.

Don't worry; down the road you will learn everything. However before I concentrate on tools needed for proper programming, I want to mention an important tool that you use in almost all work with a computer. This tool is a file manager.

I thought for a long time, how to show the creating and destroying of files on the disk as the result of certain actions. I wanted to use a file manager that is free, but I didn't want to use the manager from the operating system because it would be disadvantageous to the users of other systems.

Finally I discovered the file manager muCommander which is written in Java and therefore runs on all platforms and furthermore is free. So I will use it for my excursions into the disk and for investigating which files are present there and which are absent.

You can find it at address http://www.mucommander.com/. I won't force you to download it. You can use your favorite file manager. I only wanted to tell you which manager I will use in the pictures and animations.


Well, I take it in my mind. Now you can tell something about the tools you named with the strange shortcuts.

JDK (Java Development Kit) is the name of a set of programs containing everything you need for developing programs in Java. The installation program is about 55 MB and you can download it from address http://java.sun.com/javase/downloads.

By installing JDK you will actually install two Java environments: the development environment containing tools for developing your applications, and JRE (Java Runtime Environment) – the environment that has to be installed on the computer, where your application will be run.

This second environment is significantly simpler. The reason for its installation together with JDK is to allow testing how the developed application runs in the basic Java environment whose equivalent would be installed on computers of users of your brilliant application.

Why we should download anything else when JDK contains everything that we need?

The reason is that the tools in JDK are not very user friendly. Most programmers therefore use a development tool that is more user#8209;friendly. This “user friendly tool” offers some user interfaces sitting over the tools from JDK or an equivalent.

The programs with comfortable user interfaces offering most of the needed tools are often called IDE – Integrated Development Environment. Their authors and providers thus try to express, by this tag, that these programs have many functions integrated in one program.

BlueJ Environment

So we will download some IDE.

You are right. We will download the IDE BlueJ, which was designed with special focus on Java and OOP introductory courses. We will use it in the first few lessons. You can download it from the address http://www.bluej.org.

The main advantage of this IDE is the fact that its control is so simple that you can learn it in a few minutes. By contrast to learning the control of professional IDEs with all their functionalities and settings is about as difficult as learning Java itself. In addition BlueJ offers some special “teaching/learning functionality” that you will certainly appreciate in your studying and programming.

The downloaded configuration doesn't utilize all possibilities that BlueJ offers. Therefore in my courses I use a slightly different configuration. You can download its file here.

The configuration is simple: you copy the content of the configuration file (ZIP-file) into the appropriate destination folder. On Apple Macintosh the destination folder is the folder


On other operating systems it is the folder

<BlueJ>/lib or for Windows <BlueJ>\lib

Where <BlueJ> represents the folder where you have the BlueJ IDE installed.

Figure 1: Copying the contents of the configuration ZIP-file in Windows

Figure 2: Destination folder with its path on Apple Macintosh

The configuration ZIP-file contains two files and one folder. Copying of its contests adds into the destination folder the subfolder rp_en and replaces there the files bluej.defs a moe.defs (they are emphasized on the figure). If you want to save them, you have to rename them or move them into a secure place.


So we have JDK together with IDE. What is the third program for?

The BlueJ environment is extremely simple; however it lacks much very useful functionality. Many students are therefore willing to spend some time and effort to learn at least the basic functionality of a professional IDE, because they know, that the spent effort will be many times returned in the developing of their programs in future.

After a few lessons we start therefore to use the NetBeans IDE, which is one of the best IDE in the world and which in addition offers a special edition for developers (mostly students) coming from IDE BlueJ.

You can download the NetBeans IDE from the address http://www.netbeans.org. From the address you downloaded the JDK from you can even download the whole bundle JDK+NetBeans, however I suggest you download them separately to be later able to update each of them independently of the other.

How to work with BlueJ

All the programs you have been talking about, I have downloaded and installed. So, we can start.

Before we start to explain programming proper, we will play a little with BlueJ. Download the project saved in the file 01_Shapes.jar. Then run the accompanying animation and try everything it shows. So we can thereafter concentrate on programming and we will not divert ourselves with problems using IDE.

As I said before at the start of our series similar animations will accompany every lesson. You can open them in your favorite browser and alongside on the screen you can try out everything that the animations show.

Click here to run annimation

Animation 2: BlueJ and its basic features


Repeat once more, what we have learned today:

  • For development of programs we use development environments. The basic development tool for developing Java programs is JDK – Java Development Kit.
  • The tools in JDK has not user friendly user interface. Therefore most programmers use some IDE – Integrated Development Environment.
  • At start we will use IDE BlueJ, which was designed especially for teaching of programming. Later we will continue with IDE NetBeans.
  • The BlueJ application window is split up into three parts: button pane, object bench and class diagram.
  • In IDE BlueJ we work with projects
  • The standard project occupied a folder of its own, where are all its files. In an open dialog box we recognize the folder with BlueJ project by its icon.
  • BlueJ is able to open even projects archived in ZIP files. We open such projects as Non BlueJ projects. By opening an archive BlueJ creates folder named after the opened archive and unpacks all the files from archive into this folder.
  • We open an existing project by command File –> Open. BlueJ opens the dialog box, which shows only the folders and doesn't allow us to enter a folder, which doesn't contain BlueJ project. We can recognize the BlueJ projects by its icon, which differs from the icon of standard folders.
  • If the opened project is among the dozen of latest opened projects, we can quickly enter it from the submenu opened by command File –> Open Recent.
  • By opening a project, BlueJ writes its name into the title bar. Simultaneously it loads and shows its class diagram.
  • The rectangles in the class diagram represent the classes in the project.
  • The class rectangle can be dragged by mouse and moved into another position.
  • You can resize the rectangle by dragging and drawing its bottom right corner.
  • We can define a selection box by clicking in the free area and subsequent drawing. All classes in this box together with classes touched by this box will be marked as selected.
  • The selection of a class is marked by its thick border.
  • The selected rectangle we can move or resize together.

Contents of whole series

Rudolf Pecinovsky
(rudolf.pecinovsky@i.cz) is a senior EDU expert in ICZ, Inc. and associate professor of software engineering at The University of Economics, Prague. He has more than 20 years experience in programming education. Rudolf published 39 books in five national languages. His latest book on design patterns was launched in September 2007.

Project Features

Project Links

About this Project

edu was started in November 2009, is owned by Antonin Nebuzelsky, and has 87 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
Please Confirm