Object Oriented Programming in primary education

carenextΛογισμικό & κατασκευή λογ/κού

18 Νοε 2013 (πριν από 3 χρόνια και 6 μήνες)

63 εμφανίσεις


















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


2

Summary:


Informat
ics
(computer science)
as a subject in elementary schools is rather new. In
Croatia it is a faculty

subject for children between 5
th

and

8
th

grade
although

there is a
tendency
to introduce this subject in lower grades
as well
. Some elementary schools have
introduced informatics from t
he 1
st

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 sch
ool pupils
have
computer
programming

lessons as late as in 8
th

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 stimula
tes 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 acc
eptable 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
5
th

to the
8
th

grade
,

continue to
build
up
with real
object oriented programm
ing

language.

This paper
speculates on replacement of procedural programming languages
(Pascal,
Basic

and Logo
)
and traditional forms of education with object oriented programming
languages and modern approach t
o IT education. Accor
ding to
comparison
of characteristics
of programming languages

assistant tools

we can choose corresponding
technical
implementation in process of teaching.
Elementary school educational applications have not
changed for several years.
Therefore the potenti
al 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 (inform
atics),
program
,
object
-
oriented approach
,
creativity, correlation, programming languages
, C#,
Scratch,
education
.



3

Introduction


We have been
inspired

to write this paper by the whish to make programming in
schools more popular, to educate young people t
o 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 school
s
.
)
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

al
ready known
fields of education

are being used.

O
bject oriented
programming

in easier and
in a more simple way achieves the

goal


determined definition of programming


in a wa
y 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 specifie
d class (field) of every pupil.


Discussion


Historic retrospective on the creation of
program

languages
-

Current situation


Problem
connected with present day
education
program

in

informatics

(computer
science)

is seen at the beginning of creation of pro
gramm languages
. It shows that the present
school curriculum is outdated. For instance Logo was created in
1967,

then
Pascal

in 1970.
(
These

programming languages

are

presently being lectured in Croatian schools.
)

Era of
procedural programming for programm
ers 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
o
bject
-
oriented program
ming

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 othe
r, 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 sequen
ces 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 instruct
ions 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:

o

Emphasis on data rather than procedure


4

o

Programs are divided into Objects

o

Data is hidden and cannot be accessed by external functions

o

Objects can communicate with each other through functions

o

New data and functions can be easily added whenever nece
ssary

o

Follows bottom
-
up approach

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

o

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.

o

OOP makes it easy to maintain and modify existing code as
new objects

can be
created with small differences to existing ones.

o

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 progra
mming 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 langua
ges 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.:

d
ifferences between

object
-
oriented languages and procedural languages


The advantages of object
-
oriented programming are more efficient graphic interface
and web develop
ment
, where

one could recognize inspiration with object
-
oriented
programming in impleme
ntation 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
), a
nd 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 di
scerns 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 w
e 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

5

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 under
s
tand 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 t
hem 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
sa
me

example

can be used to explain to the children how the object
programming looks like.

Programmer

methods of procedural programming will not be
completely

omitted

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 ea
sier to start
C#
applications on the
s
e

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
operati
on 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 o
n 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#
of
fers 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 console

which competes
wit
h

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
-
user

foreign

language PC dictionar
y application with already known

words
,

coul
d be made. With
further development this project could grow into a web database or application for easy



1

http://www.w3schools.com/browsers/browsers_os.asp



6

translation.
Many other similar examples already exist which can catch
children’s
' attention
and stimulate them
to develop

their skills and explore othe
r subjects.

Detailed resolution between adequate object
-
oriented programming
languages

must 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 1
st

or
2
nd

grade.

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 pr
oblems 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 efficienc
y
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 prac
tical advantage in almost every
field.


Thirdly, research shows that students make
career choices as early as 8
th

g
rade. If a
student has no exposure to a discipline, they are unlikely to think about it as a career. Also,
underrepresented groups, particula
rly 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 w
e 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 import
ant 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, mec
hanics)



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 logi
cal 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

7

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 situ
ation
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 17
th

century?)
and in this way they can understand passed times

better
. G
eographers 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

of

computers
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 th
em in their future education
.

In
some schools teaching is d
one through Scratch application

(
„EXPO
Elementary School in St.
Paul“)
.





2

http://www.aec.at/en/prix/
index.asp



8

Picture

1.: Scratch
-

application

interface


Scratch was developed by
MIT

(Massachusetts institute of technology
) from whic
h
Logo originates. It is intended for children from 8 to 16 years of age, but younger children can
use it also.
By u
sing this program
,

children acquire knowledge which will help them in
creative
thinking
, systematic analysis, use of technology, efficient c
ooperation and permanent
learning. This program
m

we would intend for children from 2
nd

to 4
th

grade 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 an
d 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 fe
atures 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 blocks

in which pupil puts
together

procedures to graphically connect depicted bloc
ks
(
just like

LEGO
Bricks
).
When
kids use p
rogrammable 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


Diffe
rent 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 ma
ke 150
steps. After it moves for that value in two seconds it will say „Good day
to you!“ and will
play a sound N
o. 58 for half a second
.



9


Picture 3.: Program
m

in execution


This approach blocks syntax mistakes and makes children focus their atte
ntion o
n the
problem they want

to
solve
, and not on the mechanic of programming itself.

The most popular projects will contain manipulation of images, video, and music.
Youth will be able to share objects at all levels (from procedure blocks to animated characte
rs
to full projects) and to exchange them between all types of devices (desktops, laptops, tablets,
handhelds, mobile phones, embedded devices).

Through these activities, it is expected that an
ecosystem of Scratch

creations
will develop, with youth consta
ntly trading and modifying one

another’s creations.



10

Programming

for life


We will explain exactly what is considered by object
-
oriented programming, through
programmer’s eyes, in a way in which children from
5
th

to
8
th

grade will understand.

The world a
round us can be divided up into different
classes

of things such as “cats”
or “houses” or “trees”. These classes can be thought of as categories or labels for grouping
similar things. We need a way to describe these classes to the computer so it can solve
problems about them.


In each
class

of things are some specific
objects

that we are interested in. For example,
within the class “cat” is my cat Fluffy who is an object of the cat class. Similarly, the pink
house on the corner of my street is an object of

the “house” class and the oak tree outside my
bedroom window is an object of the “tree” class. When there is a specific object we want the
computer to work with, we must write some description down for the computer that
represents that object.

Objects hav
e a variety of
properties
. Properties are the things that describe the objects
more clearly.


If you remember your English classes, properties are like adjectives in the
English language. For example, my cat Fluffy may be described with properties such as
height
,
weight
, etc.

Events

are things that happen to an object. In the real world, events occur around us all
the time.
For example, when I pet my cat Fluffy, it is an event that happens to Fluffy.
Similarly, the wind blowing through the branches of the o
ak tree outside my window is an
event that happens to the tree. Events are usually actions that affect the specific object, but
which the object has no control over. In the computer's world, the events are usually things
like "a button was clicked" or "the

mouse was moved".

Actions

are things that an object does. For example, my cat Fluffy licks
its

fur


that is
an action. In the computer’s world, sometimes when certain interesting events occur, we want
to fire off certain actions, like "when this button i
s clicked, draw me a picture of a cat".

Computers, unbelievably, are really dumb. A computer has no idea how to draw a cat.
So we have to write down, in a way the computer can understand, the
method

for drawing a
cat. This is a set of step
-
by
-
step instruct
ions that tells the computer how to do it, like a recipe.

In C#, we describe a class to the computer like this:

class
Animal

{


}

From just this little bit of code it now knows:



we want to talk about a
class

of things



we will be calling that class
Animal



everything we tell it about this class will be written between the curly braces
{ … }
.




11

Animal
fiddleSticks;


The computer understands this to mean “This human wants to talk about something in the
Animal class and wants to call it "fiddleSticks".


fiddl
eSticks

= new Animal();

This is called "instantiating the object". In this example, "

fiddleSticks
" is now an
instance of "Animal". Another way to say this is
fiddleSticks

is an "object" of type "Animal".
Either way, we know clearly that we are talking ab
out a specific Animal now.

Next, we have to add some fields to our class definition:

class
Animal

{


string
kindOfAnimal
;


string
name
;


int
numberOfLegs
;


int
height
;


int
length
;


string color;


bool
hasTail
;


bool

isMammal
;


bool
spellingCorrect
;

}

We have explained to the computer that ALL Animals have these fields. Now, let’s
ask it to create an instance representing a specific one of these animals and then let us tell the
computer some things about that sp
ecific animal
-

by giving values for each field.

Animal fiddlesticks
;

fiddlesticks

= new
Animal
();


fiddlesticks.kindOfAnimal

= "
Cat
";

fiddlesticks.name

= "
Fiddlesticks The Cat
";

fiddlesticks.numberOfLegs

=
4
;

fiddlesticks.height

=
50
;

fiddlesticks.length

=
80
;

fiddlesticks.color

= "
Black
";

fiddlesticks.hasTail

= true;

fiddlesticks.isMammal

= true;


In C#, a method is a piece of code that describes to the computer the way that it should
do something. When we later call that method, the computer runs throug
h the code, doing
exactly what we wrote.



12

void
SayHello
()

{


Console.WriteLine("
Hello
");

}


If we were to call this method now, it would write the word “Hello”
into

the screen.
By writing down the code above, we have taught the computer HOW to write
hello to the
screen, but we have not yet told it to actually do this.


SayHello();


What we have mentioned before is just an example of using basics of
C# program
ming
language. Of course,
C#
is much more complex and has much more possibilities than what i
s
shown here.


The development surroundings of Visual Studio 2005 is shown in the picture bellow.
Programm
code

simulate an example shown before in Scratch

(picture no.2)
.
Code depicts
class
Human

which inherits

Character

and two new methods. In the examp
le of the first
method (do
-
while)

endless loop is being used. Thi
s loop is often used in procedural
programming. The
MyAction
method is similar in functions to procedural programming and
the
difference

is that we had to call it with the prefix
„this.“
so t
hat we could order it to be
used inside present class.




Picture 4.: Visual Studio
-

program
m

interface


13



Picture 5.:
Java

-

program
m

interface


Application on the internet



By class
es

already implemented in the
.
Net Framework,
pupil

can

make their own

dynamic web applications.
This gives their programming work „international life“
pl
us
interaction with other pupil

work.
Web ap
plications c
an have much larger public than usual
PC applications. Web tools like forum, blog, social network webpage and system

for content
management give

the

children opportunity to
realize

earlier t
he

advantages of Internet for
spreading and alleviation of

communication with other pupil

and schools.


Modern programming languages and their developing surroundings support group
work of more computer
programmers
. Pupils can cooperate on team projects through servers
for code publishing. This technology connects pupils from various classrooms and schools so
that they could cooperate on unique projects
independently from time and sp
ace in which the
programming takes place. Also, homework from computer science can be made easier if pupil
have access to server via internet.


Communication with pupils who need extra explanation or those who missed some
lecture could be made easier thro
ugh online
multimedia

presentation of the subject. Using
tools like Adobe Captivate, Techmsith Camtasia Studio or some free screen
-
capture
,

teachers
could save all their lectures with demonstrations, slides and soundtracks included. Publishing
of presentat
ions could be integrated with the rest of the web application.





14

Conclusion


Through this simp
le procedures and introduc
tion

of

new
technologies

a wide potential
for development of whole information
society

is being opened.
Pupils in elementary school
w
ill get a better idea on how programming looks like in reality and higher educational
institutions will get more focused and experienced students.
If in the equation we put
enormous potential of the Internet
-

net of all resources


time and place will no
longer be a
problem not even for the most far away islands as it is not for the
centers

of the big cities.


15

Literature


http://hr.wikipedia.org/wiki/Objektno_orijentirano_prog
ramiranje

15.08.2007.

http://en.wikipedia.org/wiki/Object
-
oriented_programming

16.08.2007.

http://hr.wikip
edia.org/wiki/Java_%28programski_jezik%29

15.08.2007.

http://msdn2.microsoft.com/en
-
us/library/bb330920(VS.80).aspx


30.
04.2007.

http:
//scratch.mit.edu/


20.08.2007.

http://scratch.mit.edu/pages/research


20.08.2007.

http://searchdata
management.techtarget.com/sDefinition/0,,sid91_gci211902,00.html

16.08.2007.

http://www.bestsoftware4download.com/download/t
-
free
-
c
-
school
-
ebook
-
do
wnload
-
llijghlw.html


17.08.2007.

http://www.eclipse.org/


16.08.2007.

http://www.startvbdotnet.com/oop/default.aspx


17.08.2007.

http://msdn2.micro
soft.com/en

21.06.2007.

http://llk.media.mit.edu/projects/scratch/papers/Scratch
-
21stCenturySkills.pdf


15.07.2007.

http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java

28.
06.
2
007.

http://public.mzos.hr/Default.aspx?sec=2225


28.
08.2007.

http://en.wikipedia.org/wiki/C_sharp

12.
08.2007.


Kiš Mir
oslav; (2000.) Englesko
-
hrvatski i hrvatsko
-
engleski informatički rječnik, 1. izd.

Naklada Ljevak, Zagreb

Mayo Joseph (prijevod s engleskog Zoran Juras); (2002.) C# programski jezik, Miš, Zagreb

Peppler, K. i

Kafai, Y. (2005). Creative coding: The role o
f art and programming in the K
-
12
educational context