Examples Of Bluej Programs

Posted on  by admin

Interactivity and visualization help beginners learn and form mental models.When you talk with people about learning to program, and especially learning to program in Java, the is often mentioned as a good introductory environment to get started. And with good reason: BlueJ is an excellent environment in which to gain a good understanding of fundamental principles of object-oriented programming. When asked why beginners should not just start by using Eclipse or NetBeans— environments known for their excellent toolset and great functionality—the answer typically points to the great value of BlueJ’s simplicity and interactivity for gaining a thorough understanding of programming principles. Originally published in the May/June 2014 issue of.

  1. Bluej Programs Examples

Today.But what does this really mean?When talking about BlueJ, it is not immediately clear what we mean by interactivity, nor is it clear why that matters. In this two-part series of articles, we will explore and discuss BlueJ’s interactive features in detail to see what they can do for you and why you should care. It’s Not About SyntaxLearning to program is not about syntax.

Well, at least not mainly about syntax. Learners new to programming often struggle to get their semicolons in the right places, match their curly brackets, or remember the syntax of a for loop. They often think that this is what programming is about: learning to get the syntax right. But of course it isn’t. All of us who have been around programming for a while know that syntax is neither the interesting nor the hard part.

In fact, every student at the university where I teach will eventually learn the syntax of their first programming language. It seems hard to some of them at first, but it’s actually the easy part.No; programming—in this case, object-oriented programming—is about learning how to translate your problem into a program structure, how to design your object interactions, and how to structure your classes. It is about designing algorithms and interacting object structures.

Bluej Programs Examples

And this is hard.To do this effectively, it is crucial to have a well-developed mental model of object interactions—both how they work in general and how they are arranged in the particular program you are working on. Beyond SyntaxLearning to program is not about syntax. Well, at least not mainly about syntax. All of us who have been around programming for a while know that syntax is neither the interesting nor the hard part.And this is the crucial difference between beginners and experts: experts have a well-developed mental model of the fundamental principles of object orientation, while beginners do not. Beginners need to develop this mental model, and an educational programming environment must help learners do so. Environments for Experts, Environments for LearnersEnvironments designed for professionals—NetBeans, Eclipse, and the like—work very well for experts.

They provide a great toolset for programmers who know what they are doing, but they do little to help learners develop the mental models they need to become good programmers.The main focus in these environments is on source code. Beginners using these systems stare at lines of code, so it is not surprising that what they think about is lines of code. Yet, what is really much harder, and much more important, to learn are the fundamental abstractions: classes, objects, and interactions. These are not well represented in professional environments. Objects, for example, hardly exist as a tangible abstraction in a typical interface. Students look at lines of Java code and struggle to understand the difference between classes and objects. This is not a problem for practiced programmers, because they have a working model in their minds.

Bluej

However, for beginners this is a fundamental problem—a much harder and more fundamental one than the question of where the semicolons go—and they get no help from the environment.An educational development environment must help learners develop the mental models needed, and it must put the important abstractions—classes, objects, and method calls—in front of the students’ eyes and let them think and talk about them.And this is exactly what BlueJ does. That is why starting with BlueJ will give beginners a stronger foundation in programming principles. Once they have developed a good working model of object-oriented program execution, they are ready to leave BlueJ behind and switch to a professional environment.

But a programmer without a strong foundation in the fundamental principles is a dangerous thing. Starter KitBlueJ is designed to offer just the right toolset for beginning programmers. It appears simple, yet does sophisticated things to help them work and learn. A Few Words About SimplicityAt the beginning, we mentioned simplicity and interactivity as the two important points. Simplicity is the easier one to discuss; it is easy to see, and most people get the point quickly.Professional environments offer many tools that are helpful, and often essential, for experts, but these can easily become a hindrance, rather than help, for learners.

Bluej

Beginners use only a small fraction of these tools, but they initially don’t know which fraction they need to use. Finding the right workflow is made harder by the presence of unwanted options, and orienting yourself in the environment is distinctly difficult on your first encounter.

Choice, for people who don’t need it, is a bane, not a favor.BlueJ is designed to offer just the right toolset for beginning programmers. It appears simple, yet does sophisticated things to help them work and learn. After only a short time, users feel comfortable in the environment and feel they know it well, and BlueJ blends into the background.

Learners don’t need to think about the environment; they think about programming principles. The development environment becomes a silent helper, not a problem to be mastered in itself.Figure 1. The BasicsBlueJ is an excellent environment in which to gain a good understanding of fundamental principles of object-oriented programming.Once an object has been created, a menu offers all the object’s public methods, and any of them can be interactively invoked by selecting it from this menu (see Figure 3).

If the method has parameters, they can be entered; otherwise, the method executes immediately.Figure 3 Why Is This Important?Even the first few simple visualizations and interactions shown so far have a fundamental effect on the understanding of the principles of object orientation.First, the division of a program into classes is illustrated. The diagram conveys the message that an object-oriented program is represented by a set of cooperating classes, and that these parts of a program can be examined and understood separately. Presenting the classes in a diagram illustrates their relationship better than the simple list used in many other environments.Second, the difference between classes and objects is implicitly apparent. Understanding this difference is one of the great problems for beginning students. Most teachers have struggled with this. In traditional environments, students start by looking at source code. What do they see—a class or an object?

Well, the answer is neither or both. Which one it is depends on context: whether the student thinks about the static or dynamic properties of their program. Understanding the difference is difficult.In BlueJ, the distinction is immediately clear: from a class, we can create objects. In fact, we can create as many objects as we like.

In BlueJ, the question never comes up. Students get a feeling for classes and objects almost automatically, with little effort. Both the visualization and the interaction (the act of creating the object) support this understanding.Third, it becomes immediately clear that we can communicate with objects by invoking their methods. Students can experiment with objects, try out what they do, gain experience with parameters and return values, and investigate a project or parts of a project. The understanding developed through these activities will be very useful once students start writing code.Understanding object orientation is about understanding three big concepts that define objects: state, behavior, and identity. Even these first simple interactions already illustrate two of them: behavior and identity.

(We will soon see how state is visualized.) No Test Drivers. One of the important aspects to emphasize about BlueJ is ease of interaction: methods can be executed individually without the need to write any test drivers. No public static void main is necessary. This means that classes and objects (and also students) can become active before writing code. Easier and quicker interaction means more interaction.

More interaction means better understanding.The possibility of interaction fundamentally changes how a learner can approach gaining an understanding of programming principles.