Tuesday, June 12, 2012

Capacity Focus, 50: Notes on a Java based, objects early "Hello world" intro to programming course sequence for digital productivity empowerment for the Caribbean (with a side word or two on Python)

For some months now, through the KF Capacity series, we have been looking at how to develop an Associate degree level cyber college that emphasises digital productivity, towards empowering our people to thrive economically and otherwise in today's bits and bricks world. 

That is why, last November, we looked at a Hello World approach to doing an intro to computer programming course. Today, let's broaden and deepen our view, especially given how we now know that there are open source Java Integrated Development Environment [IDE] apps for Android devices.

Before going further, I should note that Python must also be reckoned with.

The Python Logo
That is because of the clean design of this scripting language, because it accommodates structured, object oriented and functional programming approaches, and because of the presence of powerful extensions for math and science, including impressive virtual instruments. Python is probably competitive -- certainly on bang for buck -- with Matlab or MathCad etc. Python is a highly favoured web programming language. It is not to be overlooked that the open source software I have been tracking for animation and non-linear editing, Blender, seems to be Python-based. Indeed, I learned by the way that the local Volcano Observatory uses Python. Numpy, here, Scipy here. And, there is a surging wave of interest that pushes for Python as the first language for intro to programming.

I nearly said, why not just go for Python, then?

Then, it hit me: use both.

Java and Python are not competitors, they complement.

Especially because, given its clean code style, Python code looks a lot like the pseudocode that was popular twenty five or so years ago as the way to lay out structured programs in preference to the older flowcharts. (I ask, am I the only one who preferred flowcharts and -- honest injun -- used them in software design, because of their visual pattern and relative simplicity? [The standard joke was that the code was written, then you went back and drew up flowcharts as a documentation requirement. I hope that is not happening with UML, etc.])

That way, we could exploit the advantages of each, and -- using the Pareto principle of putting in the 20% of effort that gets 80% of results -- equip students with enough to do something useful and "plug-in" extensions to their knowledge base as needed to go on in the areas of interest they have. Then also, we can exploit educational visual programming environments like Greenfoot and educational IDEs like BlueJ or Dr Java, to get reasonably productive fairly quickly. And hovering out there is the Apps Inventor for Android developed by Google then passed over to MIT Media Lab. (Cf a first look, here.)

Let's look at a Greenfoot introductory vid:




Now, it is worth noting that there is such a thing as gradual cognitive development, so we have to be age-/stage- appropriate. That boils down to, on tests, 10 year olds could get the concept behind Greenfoot, but ran into trouble managing the exacting nature of coding in Java -- Hello.World is different from Hello.world, for instance.  So, Alice may be better at that level -- I hope the version 3 (which bridges to Java) gets beyond beta testing to real release soon. And, maybe, once we get to that stage, Alice may be the best way to do the introductory stuff.

However, in the end we do need to learn how to churn out, test and fix, and to read code. Indeed, once we looked under the hood to control our Greenfoot crab in the over the shoulder vid, we were looking at Java code, the blocks on the right were taking care of housekeeping stuff.  As a start to understanding what is going on in coding, the good old fashioned Hello World type example helps us see how different languages set up the computer to do what is wanted.

In that context, we can compare a C style Hello World:
/* Hello World program */

#include

main()
{
    printf("Hello World");
}

/**
 * The HelloWorldApp class implements an application that
 * simply prints "Hello World!" to standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); // Display the string.
    }
}
. . . With a Python style one:
print "Hello, World!"  
. . . and an HTML one:


Interesting, though that is of course not the whole story!

What is happening here, is that the Python language suppresses a lot of the housekeeping (notice, how even humble html has some -- you should see how much is used in a Word document!), which makes it quite useful for roll your own coding for occasional programmers. But Java is a serious general purpose, widely used programming language that will be with us for decades, all the way from close to the metal interfacing and control, up to web server programming. And of course that C is its ancestor should be obvious. (That means that if you know Java you can "easily" access the several C family languages.)

I think it is worth noting, that to get the videos to "stick" and reliably appear in this post, I had to mark where I wanted them with strings of X's: xxxxxxxx, then click the html tab in the blogger editor. I looked for the xxxxx's, then inserted the YouTube embed code, which is also in html, and of course deleted the xxxxx's.  (Usually, an embed works by clipping from the vid site and pasting in the compose window. Not this time, one of the little annoyances that crop up ever so often in working with IT.)

For ideas, here is a free Java for Kids (8 to 80, it seems from the cover pic . . . ) online textbook, and here is a free online intro to Computer Science using Python textbook. (Cf the Java tutorial here on.)

Let's pause and look at Apps Inventor in action, here in a college level degree Math requirement course:


(This course is advertised here. An intro course for AI is here.)

I can see why there is a budding movement of educators who are using it: getting students to make apps straight off and so learning how to think like a programmer, is a very useful approach. Of course, that does not answer the problem that AI is really designed to host on a server (the user-developed AI- on- a- USB- stick is quite demanding of system resources [cf. forum discussion], so go register at MIT and get a Google account to get acquainted, folks).  Eventually we could do hosting on microcampus servers and hopefully the workaround on getting apps set up for the marketplace will be a commonplace by then.

Oh, yes, it is worth citing a remark on the utility of an objects first, Java based approach to programming:
There are certainly some good reasons for using Java in teaching. Firstly, it is object-oriented. It is now generally held that objects-first teaching is better than objects-later. There is evidence that objects-first  students  are  better  able  to  cope  with  solving  real problems  that  their  peers  [7].  Evidence  also  indicates  that objects-early  is  not,  intrinsically,  more  difficult  to  learn  than procedural programming [14] [4].
__________ 
[7] Johnson, R. and Moses, D. Objects-First Vs. Structures-First  Approaches  to  OO  Programming  Education:  an Empirical Study. Academy of Information and Management Sciences Journal, 11, 2 ( 2008), 95. 
[4]  Ehlert,  A.  and  Schulte,  C.  Empirical  comparison  of objects-first  and  objects-later.  In  Proceedings  of  the  fifth international  workshop  on  Computing  education  research workshop. (August 10-11 2009). ACM, 2009, 15-26. 
[14]  Lister,  R.,  Berglund,  A.,  Clear,  T.,  Bergin,  J.,  Garvin-Doxas,  K.,  Hanks,  B.,  Hitchner,  L.,  Luxton-Reilly,  A., Sanders,  K.  and  Schulte,  C.  Research  perspectives  on  the objects-early  debate.  ACM  SIGCSE  Bulletin,  38,  4  (  2006), 146-165. 

[From: Developing a new teaching language for use with the Greenfoot platform]
I suspect the complaints we have had on how hard it is for students to learn objects may in part be about their needing to unlearn a structured style, and also in some cases maybe their teachers too.

So, it looks like we may have a basic framework for a programing course sequence shaping up:
0] Computer literacy is a secondary base or bridging module, preparatory to the programme.


1] Intro to computing, objects early, based on Java with Python as sidekick, and using Greenfoot (or maybe Alice 3?) with Dr Java or BlueJ. A tad of HTML would help. Also, involving Student projects could use the language or platform of choice, but assignments and exercises will force use of all relevant packages.


2] An interfacing course, that introduces industrial control type electronics and systems, with a drip irrigation controller as the featured case study.


3] A web-oriented basic multimedia and video production course, to give a basic level of capacity to produce authored content for presentations, DVDs etc, and the web. One unit should look at the production of e-books.


4] An Apps production course, with an orientation to the Android platform, but with some introduction to the Apple iOS platform.


5] A solid course in electronic bookkeeping, with some elements of accounting.


6] Perhaps a sequence that looks at PC and network technician stuff.


7] Whatever else seems useful.
Courses 1 - 4, of course, would comprise a solid 12-credit block, and those who are looking at more on the digital productivity side, would do more. In short, there is a digital productivity focus for the suggested AACCS programme as an option on the productivity side.

So, let's think about it. 

Especially, let us consider on what it will take to move our region on from being digital consumers, to effective and competitive digital producers. Then, think on the consequences of what may well happen if we do not. END