Programming with AppInventor

If your students are already familiar with Scratch, they are now ready to move to AppInventor.

 

Using AI Companion is the best way to test apps in real time on any Android device. Here is a short video that explains how to download and use AI Companion.

 

 

It is very easy to use AppInventor for group projects and partner programming. Here is how students can export/import their code.

 

Here is a video that explains how to install an app created in AppInventor to any Android device. This is NOT the same as using AI Companion to test the app in real time! Here we actually download the app permanently on the Android device.

 

For more details about AppInventor check out this presentation.

H”app”y inventing!

Advertisements

Recursion

Recursion is one of the hardest computer programming concepts to understand.

Recursion is when a function calls itself. 

A classic example that almost every Computer Science teacher uses is the “Factorial program”. (Factorials are used in Math (e.g. to calculate probability))

Factorial definition: (! is the factorial symbol)

1!=1

n!=n*(n-1)!

This is a recursive definition, because we use “!” to define “!”

(Similar to defining “writing” as “when you are writing something”)

5!= 5 * 4!

= 5 * 4 * 3!

=  5 * 4 * 3 * 2!

= 5 * 4 * 3 * 2 * 1!

= 5 * 4 * 3 * 2 * 1

= 120

Example of factorial program in Python.

# factorial.py  (recursive factorial)

def fact(n):

if n==1: #base case

return 1

else:

return n * fact(n-1) #recursive function call

print fact(6)  #calling the function “fact” from the main program (it will display 720)

 

After this program the teacher would usually talk about “call stack” and “stack frames” and some students would understand how recursion works (“pushing” and “popping” stack frames).

 

If students learn Computer Graphics before recursion, they can also see the power of recursion with the following 2 programs. With the graphical approach (visualizing recursion) more students understand the concept of recursion. In the following 2 examples there is some math included.

Sierpinski triangle

 

Fractal Tree

 

Extensions for the “fractal tree” program

 

Am I too old to learn to program?

“Am I too old to learn computer programming if I am 37…45…62…70??? ” This might be a very common question nowadays.

The short answer is NO! There is no age limit for learning programming!

(Education has no age limit)

On the other hand, some people in their 20’s are not ready to continue learning. As soon as they graduate from high school or college/university, they think they have achieved all their goals and they don’t want to learn new skills.

It is true that someone that started to learn coding in elementary/secondary school will have the edge over someone that starts programming in their 50’s, but with the ‘visual coding’ programs that are available today, the gap is narrowing.

A person that starts coding in their 50’s might never work for IBM, Apple, Microsoft…but they can make their life easier by “Automating the boring stuff“.

Even if you never work as a programmer/software developer, you will learn a very important skill called “Computational Thinking”. Computational thinking will help you in your everyday life, it will help you become a better problem solver and it will make you a happier and smarter person in general. In the future, with the rapid development of the technology computational thinking will be the most important skill to have.

Programming now and then

iwritecode

My father and my uncle were programmers and they had a positive influence on me when I had to decide which high school to attend. In Macedonia there are no academic and applied courses in every school. Instead, there are ‘Academic Schools’ and ‘Applied Schools’. Furthermore, there are ‘Math’, ‘Language’, ‘Science’,…schools.

I decided to attend Rade Jovcevski Korcagin – ‘Academic Math and Computer Science’ secondary school in Skopje, Macedonia. My favourite course was Computer Science (obviously). In Gr.9 we started learning GW BASIC (a dialect of the BASIC programming language). BASIC stands for Beginner’s All-purpose Symbolic Instruction Code.

It took almost a month to write my first program, because we spent about 4 weeks learning to “think like programmers” by learning some basic algorithms and writing flowcharts.

My first line of code was PRINT “HELLO WORLD!” and even today when students learn to program they write the same line of code. (e.g. print(“Hello World!”) in Python)

Here is what a program in GW Basic looks like:

GOTO statement is probably the one thing that every BASIC programmer will remember forever.

e.g.

10 CLS

20 PRINT “MARJAN”

30 GOTO 20

Nowadays, students can learn to program even in elementary schools through visual drag-and-drop programming. Even though later they will understand that they will have to learn to actually write real code instead of just dragging-and-dropping, programs such as Scratch or AppInventor are excellent introductory languages.

When I started programming it would take weeks or months to write a simple game with bad graphics. Twenty-five years later, a ten-year old kid can create a ‘pong game’ in less than an hour. Talking about progress!