The University of Western Australia
School of Computer Science and Software Engineering
 
 

School of Computer Science and Software Engineering

CITS1001 Object-oriented Programming and Software Eng

Why BlueJ?

The feature that distinguishes BlueJ from other Java IDEs is that the user can interactively create objects and then call the methods of the created objects. In other words, the BlueJ user can play the role of an object in the running program. In fact, the BlueJ user is a "super-object" because they have powers that other objects do not have. For example, the BlueJ user can inspect any other object, even if its instance variables have been declared private. BlueJ is essentially an interpreter of Java programs; while this approach is common in some language paradigms, it is relatively unusual in OOP.

There are many advantages in being able to create objects and call methods interactively.

  • There is no need for a main method

    The user can directly start the program by creating an initial object and if necessary calling one of its methods. In other IDEs it is necessary to write a special method called main whose only purpose is to start the program running.

  • Testing can be performed interactively

    The user can directly call methods with different arguments in order to ensure that they are working as expected. In other IDEs it is necessary to write additional methods or classes to test the code. While class-based testing is better in many circumstances, interactive testing is quick, it is completely natural, and it can be performed directly on each method as it is completed.

  • It allows the complexity of input/output to be deferred

    Learning Java is often made unnecessarily complex by the problems of input/output. Java's I/O mechanism is extremely general, and it relies heavily on inheritance, exceptions, and other sophisticated concepts. However input is necessary to avoid every program simply performing a "hardwired" calculation of some sort, so students are inevitably asked to use something that they do not initially understand. With BlueJ, input is completely natural - whenever a method is called, the user is prompted for the arguments for that method call. BlueJ performs the role of a black box input device, but it is easier for students to comprehend because it is clear that BlueJ's prompt is logically part of the IDE, rather than part of their program.

  • It encourages OO thinking and programming

    A program written in BlueJ consists only of the classes directly relevant to the problem at hand. This means that there is a direct relationship between the problem and the computational model used for its solution. There need not be any of the overhead normally associated with small OO programs.

  • BlueJ programs are standard Java

    A program developed in BlueJ is standard Java. It can be run separately from BlueJ simply by adding a main method that creates an object and calls a method. This avoids the danger that students might code an entire program in the main method, but later realize that the only purpose of main is to start the real program running.