Object Oriented Programming in primary education

Irena Krajnović, senior student of class education

Ljubica Bakić-Tomić, Ph.D.

Vesna Markovac, engineer

The Faculty of Teacher Education of the University of Zagreb
Summary:

Informatics (computer science) as a subject in elementary schools is rather new. In Croatia it is a faculty subject for children between 5th and8th grade although there is a tendency to introduce this subject in lower grades as well. Some elementary schools have introduced informatics from the 1st grade so that the pupils would be as early as possible introduced with media which surround them and that they learn how to use them in a correct way. According to the official program computer science for elementary school pupils have computer programming lessons as late as in 8th grade. Research studies in the world have shown that computer programming is not conditioned with mathematical knowledge but promotes development of procedural, algorithmic thinking and stimulates the spirit of exploration. To achieve this, problems from others, already known fields of education, are being used. Experience from USA indicate that children from the age of 7 years old should be introduced in objective programming in a funny and acceptable way so that they learn to think in procedures and algorithms.

On the foundation of education through games for development of procedural and algorithmic way of thinking ability we can, from the 5th to the 8th grade,continue to build up with real object oriented programming language.

This paper speculates on replacement of procedural programming languages (Pascal, Basicand Logo) and traditional forms of education with object oriented programming languages and modern approach to IT education. According to comparison of characteristics of programming languages assistant toolswe can choose corresponding technical implementation in process of teaching. Elementary school educational applications have not changed for several years. Therefore the potential of new technologies and adequate methods has not been utilized. With this paper we suggest replacement of contemporary educational program with new and more remunerative one.

Key words:programming, children, elementary school, computer science (informatics), program, object-oriented approach, creativity, correlation, programming languages, C#, Scratch, education.

Introduction

We have been inspired to write this paper by the whish to make programming in schools more popular, to educate young people to be able to use this knowledge and to make present curriculum more interesting and creative for the benefit of every pupil.

Programming is creative process which stimulates pupil. (Based on HNOS – Croatian national education standard for elementary schools.) This should be achieved by connecting other classes with the process of programming.

Contrary to the general conviction, computer programming is not conditioned by mathematical knowledge but promotes development of procedural, algorithmic thinking and stimulates the spirit of exploration. To achieve this, problems from others already known fields of education are being used.

Object oriented programming in easier and in a more simple way achieves the goal – determined definition of programming – in a way that the creativity of pupils from various fields (classes) can be used in a better way. Also there is an opportunity for betterment of communication (better cooperation between pupils) on multidisciplinary problems by using natural interest for specified class (field) of every pupil.

Discussion

Historic retrospective on the creation of program languages - Current situation

Problem connected with present day education programin informatics (computer science) is seen at the beginning of creation of programm languages. It shows that the present school curriculum is outdated. For instance Logo was created in 1967, then Pascal in 1970. (Theseprogramming languagesare presently being lectured in Croatian schools.) Era of procedural programming for programmers stops with the creation of C++ in 1985,and the development goes to object-oriented programming. In 1995 new programming language Java emerged, and then in the year 2001. C# was developed.

The difference between procedural and object-oriented programming

Object-oriented programming (OOP) is a programming language model organized around "objects" rather than "actions" and data rather than logic. The first step in OOP is to identify all the objects you want to manipulate and how they relate to each other, an exercise often known as data modeling. Once you have identified an object, you generalize it as a class of objects (think of Plato's concept of the "ideal" chair that stands for all chairs) and define the kind of data it contains and any logic sequences that can manipulate it. Each distinct logic sequence is known as a method. A real instance of a class is called an "object" or an "instance of a class." The object or class instance is what you run in the computer. Its methods provide computer instructions and the class object characteristics (properties) provide relevant data. You communicate with objects - and they communicate with each other - with well-defined interfaces called messages.

Some important features of object-oriented programming are as follows:

  • Emphasis on data rather than procedure
  • Programs are divided into Objects
  • Data is hidden and cannot be accessed by external functions
  • Objects can communicate with each other through functions
  • New data and functions can be easily added whenever necessary
  • Follows bottom-up approach

Object-Oriented Programming has the following advantages over conventional approaches:

  • OOP provides a clear modular structure for programs, which makes it good for defining abstract data types where implementation details are hidden and the unit has a clearly defined interface.
  • OOP makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones.
  • OOP provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly useful for developing graphical user interfaces.

The focus of procedural programming is to break down a programming task into a collection of data structures and subroutines, whereas in object oriented programming it is to break down a programming task into objects. Either method can be valid for accomplishing a specific programming task. (Object orientation is often referred to as OO and object oriented programming as OOP.)

The most popular programming languages usually have both OOP and procedural aspects.

Some differences (Table 1) between pure object-oriented languages and non-OO procedural languages:

Object Oriented / Procedural
methods / functions
objects / modules
message / call
member / variable

Table 1.: differences between object-oriented languages and procedural languages

The advantages of object-oriented programming are more efficient graphic interface and web development, where one could recognize inspiration with object-oriented programming in implementation of XML and HTML program languages. They write (serialize) objects and through them define how the objects will be instanced.

Procedural programming is used on lower levels of operating system (OS) (kernel, drivers, modules), and higher levels of OS and additional applications (tools) are here to give us advantages of object programming. If OS gives us this opportunity, why not use it?

Appearance of complex object code, compared to procedural code, is much easier to read and memorize and it is easy to be inherited – i.e. to create class inside class. Also, object-oriented programming easily discerns between data and program procedures.

Because OOP uses polymorphism it is easier to use the same functions/methods in different environments. Two classes that inherit one base class can have a method which both subclasses override in their own way. For example, if we have a base class Animal with method speak(), and two subclasses Dog and Pig which override it with bark() and oink() representatively, when we call an object instance method speak(), it will call the method bark() if the object is a dog, and method oink() if the object is a pig. This will happen without using any conditional functions as we would have to do in procedural programming languages. This is very useful if we are working within complex systems and in multi-developer environments.

Difference between other approaches which focus on actions which are being performed on data structures, and this approach is in focus on building application as group of objects which exchange messages.

We understand the world as a group of objects, and not through procedures; therefore objects comprehend procedures and properties also. It is easier for children to understand a real example which happens to them everyday. For instance, we can tell to a child to sit down (command). During the process of sitting down a child will not think of moving the chair, bending and all other procedures in to-sit-down process. It will comply with one simple command. The sameexample can be used to explain to the children how the object programming looks like.

Programmer methods of procedural programming will not be completelyomitted with transition to object programming. They are used inside the method of class to execute procedural tasks over objects or their properties. Children would continue to study basic conditions, logic comparison, loops etc.

Programming languages

Most of the PC's in Croatia use Windows XP [1] OS, therefore, up to date PC's are being used. It is easier to start C# applications on these PC's because they are equal to any Windows application. Applications developed in C# demand only .Net framework which comes as a supplement when updating Windows or it is distributed together with the application.

C# is an Object Oriented Programming language and has at its core many similarities to Java, C++ and VB. In fact, C# combines the power and efficiency of C++, the simple and clean object oriented design of Java and the language simplification of Visual Basic.

Like Java, C# also does not allow multiple inheritance or the use of pointers (in safe/managed code), but does provide garbage memory collection at runtime, type and memory access checking. However, contrary to Java, C# maintains the unique useful operation of C++ like operator overloading, enumerators, pre-processor directives, pointers (in unmanaged/unsafe code), function pointers (in the form of delegates) and supports the concepts of properties.

Big advantage among most of recent programming languages is that programs are written in Java and can perform tasks without changes on any OS for which JVM (Java Virtual Machine)already exists.

Development environment exists in free versions for both (Visual studio C# Express, Eclipse for Java and other).

C# offers attractive and popular possibilities such as for instance development of games (XNA – also exists express version similar to Visual studio which is intended for nonprofessional development of games) for X-box (popular gaming consolewhich competes with PS2) or robotics control (Robotics studio) for which we need a good grip on physics and technology. Such created programs could be used in their education. For instance, multi-userforeign language PC dictionary application with already known words, could be made. With further development this project could grow into a web database or application for easy translation. Many other similar examples already exist which can catch children’s' attention and stimulate them to develop their skills and explore other subjects.

Detailed resolution between adequate object-oriented programming languagesmust be left to experts from IT and educational sciences.

Application in elementary school

We believe that pupils in elementary school should study computer science from 1st or 2ndgrade.

Reasons for that are, first, to develop abstract-thinking skills from the concrete to the general. If we would ask children to solve one problem, they would have one answer, but if we tell them to provide a method for solving all problems like this one, children would make an algorithm for solving problems.

Second, developing systematic ways of thinking about process (describing processes precisely and abstractly, reasoning about the correctness of processes, analyzing the efficiency of processes), data and relationships (types: hierarchies, containment, composition; structures: arrays, trees, directed graphs, mappings; patterns: delegation, data flow, publish/subscribe) and the ability to create custom software which provides a practical advantage in almost every field.

Thirdly, research shows that students make career choices as early as 8th grade. If a student has no exposure to a discipline, they are unlikely to think about it as a career. Also, underrepresented groups, particularly women, may enjoy computer science but need encouragement. Student experience is needed to counteract media portrayal of computing professionals. Moreover, our country needs more computer scientists.

Not everyone becomes a physicist or biologist, but we teach these subjects in elementary school so people have a basic understanding of the world around them. Citizens and elected officials with even a limited understanding will make better decisions about the use of technology. Demystification is an important goal for education.

Fact is that software is everywhere. If students do not learn computer science in elementary school, they will live their lives surrounded by technology that they do not understand.

Learning and playing

Creation of a computer game may demand several disciplines like:

  • linguistic subjects (talk between characters, theme, novel, story, communication in various languages)
  • visual arts (drawing, animation)
  • musical arts (creation of sound and music)
  • physics (interaction of characters, mechanics)
  • physical education (sports rules)
  • history, geography, chemistry and biology (facts from real life).

Pupils through exploring various disciplines expand their knowledge about that subject and get insight of the way the discipline works through logical and objective thinking about the discipline.

Linguists will have better understanding of functioning of spoken language and in this way a predisposition for easier learning of program language. Better knowledge of literature will make better themes for program. Visual artists get new dimension of animated characters, musicians create music for the course of the story, and in cooperation they can connect speech and intonation with the characters. Pupils interested in history can get in the realistic situation of the age they are interested in and for which they are creating the game in a way that they must get all the facts of that period (for instance – was there electricity in the 17th century?) and in this way they can understand passed times better. Geographers will have to learn facts to be able to study a terrain, climate or soil composition. Chemistry and biology will give more means to explain complex things like chemical reactions or birds flying by using 3D animation.

In our attempt to introduce basics of programming to children we know that it is very important for expression and creation in a world ofcomputers to teach them the code in a creative way.In the Prix Ars Electronica festival[2]competition children from the age group of 8 compete in creating programs/media thus showing that they are not just consumers but creators as well.

Program Scratch

In developed countries basics of programming are being tough in elementary schools from the age of 8 years. This IT learning will be useful to them in their future education.In some schools teaching is done through Scratch application(„EXPOElementary School in St. Paul“).

Picture 1.: Scratch - application interface

Scratch was developed by MIT (Massachusetts institute of technology) from which Logo originates. It is intended for children from 8 to 16 years of age, but younger children can use it also. By using this program, children acquire knowledge which will help them in creative thinking, systematic analysis, use of technology, efficient cooperation and permanent learning. This programm we would intend for children from 2nd to 4thgrade of informatics (computer science) to acquire relevant base knowledge of object in funny and particular way.

This new tools (and associated activities) can be used successfully and productively because:

• youth sees the tool/activities as “cool,” resonating with their interests and passions

• youth sees the value and potential of the tool right away

• youth can create a first project with the tool quickly and easily

• youth can create “products” that they can show off to others (pride of authorship)

• the tool supports a wide range of different types of activities

• the tool/activities appeal to youth of different backgrounds and cultures

• youth can learn features of the tool gradually and incrementally

• youth can continue to use the tool in ever more complex ways over time

Programming in Scratch is based on putting together blocksin which pupil puts together procedures to graphically connect depicted blocks (just like LEGO Bricks). When kids use programmable LEGO Bricks, for instance, they can create anything from a robotic creature, a “smart” house, an interactive sculpture to a musical instrument.

Picture 2.: Snapping graphical blocks together

Different types of data are shown in various forms of blocks where parts fit in a way that they connect together in a correct syntactic order. In the second picture the program is shown which will be executed in a way to make the chosen character in the game make 150 steps. After it moves for that value in two seconds it will say „Good day to you!“ and will play a sound No. 58 for half a second.

Picture 3.: Programm in execution

This approach blocks syntax mistakes and makes children focus their attention on the problem they want to solve, and not on the mechanic of programming itself.