You are on page 1of 9

Easy Java Simulations

An easy-to-use tool to create scientific simulations in Java

Francisco Esquembre
Universidad de Murcia. Spain

Abstract. We introduce in this paper Easy Java Simulations, a tool that we have
created to help Physics teachers and students create their own interactive simulations
of physical phenomena. The tool honors its name in that it tries to turn this process
into an easy task, providing specialized editors and ready-to-use graphics
components that help the user complete the high-level tasks of describing the model
of the phenomenon under study and the design of the interface of the simulation. The
tool is based in Java and automatically creates all that is needed to publish the
generated simulation on the Internet.

Introduction and pedagogy


Computers have proven themselves to be very useful tools to improve the teaching and
learning process in Science, and particularly Physics, classrooms. We only need to add
to this assertion that this is true only when computers are used in a pedagogically sound
way.

On the one hand, computers can help us create learning environments that extend the
possibilities of traditional teaching tools (blackboard, books, laboratories,…). But, on
the other, they also offer brand-new possibilities, not accessible before: [1]

• Bringing exciting, real-world based curricula into the classroom.


• Providing new tools to enhance teaching.
• Giving students and teachers more opportunities for interaction.
• Building local and global communities.
• Expanding opportunities for teacher learning.

Among all different possibilities offered by computers, computer simulations stand as


one of the best tools to enhance the educational process. Simulations can be open
learning environments that allow students to: [2]

• Develop their understanding about the phenomena and physical laws through a
process of hypothesis-making and idea-testing.
• Isolate and manipulate parameters and therefore help students to develop an
understanding of the relationships between physical concepts, variables and
phenomena.
• Employ a variety of representations (images, animations, graphs, numerical
data) that are helpful in understanding the underlying concepts, relations and
processes.
• Investigate phenomena that would not be possible to experience in a classroom
or laboratory.

Simulations help us reach a deeper level of conceptual learning, which usually also
helps uncover students difficulties of a more subtle nature.

1
Using computer simulations can be very useful for the teacher if (and only if) he or she
uses them in a pedagogically sound way. In this context, we like to cite the following
list of recommended behaviors (extracted from [5], which list them in a more general
setting) considered best-practices to facilitate learning through engaging students in
explorations that reflect real science:

• Students do science. Students actively engage in doing science versus learning


about science.
• Students engage in inquiry. Students are given open-ended problems to solve
or questions to answer through doing an investigation that involves collecting
and analyzing data.
• Students communicate. Students communicate findings through laboratory
reports, oral reports, discussion, and in journals or logs. Students listen to one
another and build on one another's comments during discussions.
• Students collect, manipulate, and use data. Students manipulate data collected
through their own laboratory investigations and through library and other
sources of information. They use this information to provide evidence to support
claims in reports and during discussions.
• Students work collaboratively in groups. Students engage in
cooperative/collaborative learning through small-group projects, investigations,
and other activities.
• Teachers use authentic assessment. Teachers use forms of assessment
consistent with "best practice" learning, i.e., testing for understanding and ability
to inquire/solve problems versus multiple-choice or short-answer tests that probe
for knowledge of facts and definitions.
• Teachers facilitate learning. The teacher acts as a facilitator by asking students
open-ended questions, encouraging students to explain and predict in order to
increase their understanding, and by asking probing questions that encourage
discussion.
• Teachers emphasize relations to real-life. Teachers use examples and
applications of the subject matter content in daily life, and/or use instructional
resources that relate to real-life.
• Teachers integrate science, technology and mathematics. Teachers integrate
subject matter areas to exemplify how the different disciplines co-exist in actual
practice.
• Teachers offer depth versus breadth. Teachers involve students in fewer
topics that they cover in depth in their courses rather than briefly considering
many topics.
• Teachers build on prior understandings. Teachers relate what students have
already learned or what they already know to new understandings.
• Teachers use a variety of materials for learning. Teachers use a variety of
materials and resources rather than rely solely on the assigned textbook for the
course.

The need for new tools


If these pedagogical benefits are so well recognised by the community of researchers in
Science education, why aren’t computer simulations more frequently used in our
classrooms? We can provide the following tentative answers:

2
a) The classical resistance to change, which, as to any other human, also affects to
Science teachers.
b) Simple ignorance of the results of Physics Education Research.
c) A particular resistance of science educators and researchers to accept solutions
coming from other people.
d) A certain reluctancy to use a technology they, the teachers, don’t fully
understand or control.
e) The fact that existing simulations don’t quite fill the needs of the teacher or of
his or her students.

Since there is a great potential of creative teachers that can contribute to make the use of
computers in our classrooms more ubiquitous, all of the reasons above compel us to
think that a new set of tools is required. Tools that are open, reconfigurable, and multi-
purposed. Tools that will: [4]

• Lower the technical level required.


• Increase teacher’s abilities
• Make the software accessible in terms of size and effort.
• Allow a different focus on the curriculum.
• Allow an active interchange of experiences.

With the objective to address this need, we introduce Easy Java Simulations.

Description of the tool


Easy Java Simulations (Ejs, for short) is a software tool specifically created with these
considerations in mind. It was designed and created by science teachers, for science
teachers and students, and its main purpose is to allow users to create simulations using
their knowledge of the underlying scientific model.

The user needs to provide his/her knowledge of the scientific process and decide on
what type of graphical interface is required for the desired pedagogical goal, and the
computer helps (and it helps a lot!) by taking care of all the computer-specific tasks.
This helps the science teacher or student concentrate on Science, not on the computer.

The generated simulation is an independent, high quality Java application or applet


ready to be published in a Web server. The design principles of Ejs make it possible to
serve as an effective teaching and learning tool if used in an appropriate pedagogical
setting.

As Figure 1 shows, Ejs has a very simple user interface (the simplicity of it was actually
a design principle), and structures the simulation into Model and View, to which it adds
a first introductory part. Each part has a dedicated editor that helps the user build it.

3
Figure 1. Interface of Easy Java Simulations

The Introduction
For the introduction of the simulation, the textual part that introduces what the
simulation does and how to interoperate with it, the tool provides a WYSIWYG editor
of HTML pages for the simulation. Each of the introduction pages created with this
editor will turn into a real HTML page when the simulation is generated. This set of
pages will be completed with another HTML page that will contain the simulation itself
in form of Java applet.

Figure 2. The introduction for a simulation

4
The Model
The interface for the model provides up to five dedicated editors. Obviously, this part of
the simulation is where the user needs to contribute more. However, the tool provides a
simple left-to-right procedure where the user needs to complete a short sequence of
descriptions of the model which the system uses to generate the final computer model.

This sequence includes defining the variables of the model, initializing these variables,
specifying how they evolve in time, making explicit internal relationships between the
variables (which we call constraints) and creating (if necessary) custom functions or
routines that will be used in other parts of the model. Each of these task is assisted by a
dedicated editor that simplifies the process as much as possible.

Figure 3 shows the editor for the declaration of variables of a given simulation. It takes
the form of a table of variables where the user specifies the name, type, and initial value
for the variables.

Figure 3. The editor for the declaration of variables

Some models completely initialize their variables using this table. Others may require
additional computations to completely determine the initial state of the system. In these
cases, the user needs to write additional pages of Java code in the editor provided for
the initialization of the model, displayed in Figure 4.

Yes, this means that the user needs to learn to specify his or her algorithms in terms of
expressions and sentences of Java language. This is not exactly learning to program in
Java, it is actually much simpler than this. Our experience is that even teachers without
much programming experience can reach this level after a few introductory sessions.

The editors for the constraints and custom parts of the model are very similar to the
editor for the initialization and we will not display them here.

5
Figure 4. The code editor for e initialization of the model

Of particular interest is the editor for the evolution of the model. This actually takes
two forms. The first one is, again, a plain code editor for the situations in which the user
needs or wants to provide directly the algorithms that describe the model. A second,
much more advanced, editor is provided for the cases in which the evolution of the
model can be specified by means of a system of ordinary differential equations (ODE).
This editor is displayed in Figure 5.

Figure 5. The dedicated editor for ordinary differential equations

The equation displayed in Figure 5 corresponds to free-fall motion and illustrates how
easy and natural it is to write a differential equation using this editor. After typing the
equation, the editor will automatically generate (when required) all the Java code
needed to numerically solve the equation using one of the most popular algorithms for
solving ODE, such as the Mid-Point, Runge-Kutta or Adaptive Runge-Kutta algorithms.

6
But this editor offers much more, since it is able to edit and solve equations where the
term differentiated is a one-dimensional array (or vector, as we would call them), and
can also handle state events. A state event is a situation where the system is asked to
automatically detect that a given expression of the state variables reaches a certain value
and then apply a correcting action. In the example displayed in Figure 6, the free-fall
equations of motion are completed with a state event that detects when the falling object
reaches the ground and applies the effect of an inelastic rebound.

Figure 6. State event for an inelastic collision with the ground

The View
Creating the graphical interface (or view) of a simulation is usually the most technical
part of the process. One that can require previous expertise in computer graphics and
also intensive use of the set of graphic libraries provided by the computer language.

Ejs greatly simplifies this task by providing off-the-shelf, ready-to-use graphical


components that can be combined, as if they were building blocks, to construct a tree-
like structure of view elements that conforms the interface (see Figures 7 and 8). Each
view element is specialized in a particular visualization or input task, and the whole set
offered always provides a solution for the vast majority of user needs.

Figure 7. Tree-like structure of view elements for the view of a simulation

7
Figure 8. Graphical user interface corresponding to the tree of Figure 7

Thus, the user is only required to design how the visualization will take place and what
interfacing mechanisms he or she wants to supply the student with. Once this is decided,
the user selects and adds the required view elements from the set offered in a simple
click-and-create procedure. (Of course, the user needs some training in order to get
acquainted with the different types of view elements offered and what each of the types
can do.)

The behavior of the view elements is greatly determined by their type. However,
elements can be customized editing their so-called properties. Properties are internal
values that specify how the element looks and behaves. Properties can be set to constant
values but, more interestingly, they can also be associated to model variables.

This way, as the model evolves, the visualization changes dynamically according to the
association between model variables and properties of view elements. And viceversa, if
the user interacts with any view element changing any of its properties, the model
variable associated to this property will also be affected. This creates a two-way
communication mechanism between model and view that turns the simulation into a
real dynamic, interactive visualization.

Generating the simulation


And this is all that is needed! Once all the high-level information has been provided,
clicking on a single icon makes the miracle. Ejs generates all the Java code needed for
the additional technical tasks, compiles it, packs it into a compressed JAR file and even
generates the batch and HTML files needed to run it both as a stand-alone application
and as an applet.

This ensures easy distribution of the generated application and is where Java shows to
be most useful. The final user, most likely a student, has three ways of using the
simulation. He or she can run it as an application distributed on a CD, download it from
a Web server embedded in HTML pages, or (recommended) use Ejs itself to run the
simulation, but also to inspect it, thus learning from the code created by his or her
instructor, which adds a new level of instruction of evident pedagogical interest.

Conclusion
Easy Java Simulation is a software tool specifically designed to help teachers and
students with not much knowledge of programming create their own simulations. This
makes the use of simulations a more interesting and user-friendly technology for the
educational process because:

8
• Teachers feel they control the lecture because they understand what the
computer is doing.
• Students are motivated because of the pleasure of the creation process.
• Students are motivated by the possibility to publish their work (serious work) on
the internet.

Ejs is certainly a tool that helps students play a more creative role in front of a computer
and can therefore be used to create learning environments that use the recommended
best practices cited above.

The software and its documentation can be downloaded for free from the Web server at
http://fem.um.es/Ejs. Examples of simulations created with Easy Java Simulations can
also be found in this server.

Acknowledgements
We would like to thank the organizers of the MPTL meeting held in Graz in the summer
of 2004 for their kind invitation to give a plenary lecture and for the wonderful
organization of the meeting.

Easy Java Simulations is part of the Open Source Physics project (see
http://www.opensourcephysics.org).

References
[1] Brandsford et al. “How People Learn”. National Academy Press (2000)
[2] Jimoyiannis, Komis. “Computer simulations in physics teaching and learning”.
Comp. Educ. 36 (2001)
[3] Lederman. “American Renaissance in Science Education”. FERMILAB-TM-
2051 (1998)
[4] Di Sessa, “Changing minds”. MIT Press (2000)

You might also like