domingo, setembro 17, 2017

Programming is Like Music: "Python - Become A Master In Python" by Richard Dorsey

Just what is the fascination with spreadsheets? I played with them on my Spectrum in the 80s, but it wasn't very useful. I used a spreadsheet on a Psion handheld in the 90s to keep track of some data. And nowadays I have a spreadsheet in LibreOffice to keep track of my expenses and work out my tax (estimate, since obviously, you need to use a proper package to get it right). I've worked in places in the meantime where bosses think that Excel is a suitable tool for project planning. It isn't. But if you only give people a hammer, everything looks like a nail to them. As a programmer, myself, I'm finding this whole thing fascinating. The quality of the kid's programming output (and yes, it is programming, not 'coding') is going to be directly proportional to the teacher's ability who's teaching them. I have a big worry that this will go the way of foreign language learning in school though, even without this concern over the quality of teaching. It's a subject that needs self-determination and a lot of time spent outside of the class room to truly get to grips with. Without these two things pupils, will probably grow to despise the subject - and we may even start to put off future would be programmers. Children as young as four have been learning programming skills in the classroom for many years with programmable toys: Big Trak, Roamers and BeBots are some examples which have been whirring around on the floor. Disguise a robot as a sheep and get it to run away from the farmer or program a lifeboat to reach a sinking ship etc.

But programming is hard; very hard. Heartbleed and the concurrent Apple invalidation of security certificates in their software demonstrate how bloody hard it is. Teaching children to code is analogous to teaching them to make nuclear bombs. Though I think it’s not so much like teaching them to make nuclear bombs; it’s more like doing physical education with the goal of teaching them all to be fast bowlers. Or music with the idea of trying to make them all composers of classical sonatas.

Python is the right choice, and it really is easy as languages go. But for most people even learning Python is going to be frustrating to the point of impossibility. You could try LiveCode - also open source. A bit like the old Hypercard. Or you could try learning the Bash shell or Awk - both restricted purpose non-GUI languages which may be more accessible because they have very clearly defined purposes and limits. Or you could try the Gnome package Zenity. Python is very general and it has the complexity of having lots of IDEs...The problem most people have is conceptual. Their minds simply do not work like that. There is no particular reason why they should. Most people will not be able to be good fast bowlers either. They are perfectly fit, healthy and intelligent people. Inability to programme is no bar to learning or achievement of all sorts. It is much more important to know how to set up an OS, how to set up a network, to understand something about security and servers, permissions, users, all that stuff. Python really is simple when you compare it to a language like C. For example, to create an array with even integers from 1 to 100 in just one line in Python, you can do list comprehensions:

myArray = [x for x in range(1, 101) if x % 2 == 0]
Try doing that in C, you'll end up with something like this:
main() {
int myArray[100], i, index;
index = 0;
for (i = 0; i < 101; i++) {
if (i % 2 == 0){
myArray[index] = i;
index ++;

Wait! Why would I want that in an array I have no idea...

This looks much better:

for (i = 0; i < 51, i++) array[i] = i*2

In any case, what does the length of the code matter?

What matters is the readability and clarity of the code and how fast the programs runs.

Having learned both basic, Z80 machine code and assembler in the early 1980s I would say that the revised mental processing I needed to master to be able to create programmed solutions to problems using any of these coding methods has proven very useful in all manner of situations requiring clear thinking since that time. The big problem with learning this stuff is getting over the jargon and meeting the standard of prior assumed knowledge. They will also need to teach kids quite detailed machine architecture otherwise this scheme will fail.

Programming is like music or creative mathematics. Only 10 or 15 percent of the population are going to be able to do it. An even smaller percentage of current teachers is going to be able either to do it, or still less teach it. The idea that we take a year, teach all teachers to be programmers, and then have them teach all children to programme? It’s simply mad. Not only is it impossible, it is squeezing out from the curriculum the teaching of something that is much more useful and which is possible to teach everyone. That is systems management. Setting up computers and networks, trouble shooting, installing operating systems, servers and the like. Files and file management. The command line. Elementary scripting to the extent necessary to use the command line properly. In short, how to manage computers and networks. Not how to write programmes in two languages. Teach this, and you will be giving a valuable general purpose skill children will use in employment and private lives. And it is possible to teach it to almost everyone.

We don't try to give all teachers a knowledge of music composition next year, and have them then teach it to all children the following year. This is as crazy an idea as that would be. The only result is that we will prove once and for all by a wonderful national experiment that programming is a very specific and comparatively rare ability. And in the process, we will make a lot of perfectly intelligent and able people feel totally stupid and frustrated, when we could have given them useful and enjoyable instruction in things they could learn and would use.

Having this stuff ingrained young means it’s part of the way you think for life, and it’s hard for today's adults to estimate how much of this knowledge is going to be needed in the future just to be able to have access to decent jobs. Almost in the same way that typing was appropriate in the age before computerisation so that people could get higher paid clerical, administrative, and executive roles.

School should be as much about teaching kids to learn as it is teaching them what to know. The distinction is subtle but important.

Bottom-line: Will Dorsey’s book help on this road to computer literacy? Nope. Too short and without the stuff one needs to learn how to program in Python, but I’m not even sure that was the author’s intention. I don’t really know what kind of rationale these type of programming books fulfill, to be honest. How can anyone become a master at Python programming without the use of classes (strangely absent in the book)? Mind-boggling to say the least…

Sem comentários: