Python boek nu verkrijgbaar

July 18, 2016

Ik heb een Nederlandstalig boek over programmeren in Python voor beginnelingen gratis beschikbaar gemaakt via de website die ik voor dit boek gelanceerd heb.

De titel van het boek is “De Programmeursleerling.” Er is ook een Engelstalige versie beschikbaar die “The Coder’s Apprentice” heet.

Het boek is gericht op middelbare scholieren en studenten, en met name bedoeld voor degenen die nog niet eerder een programmeertaal geleerd hebben. Je kunt het gebruiken als een Python 3 zelfstudie cursus. Ik heb de afgelopen jaren Python programmeren gedoceerd aan honderden studenten voor wie programmeren iets nieuws (en soms zelfs iets engs) is, en de ervaring die ik hierbij heb opgedaan heb ik in dit boek ondergebracht. Ik heb het boek gebaseerd op een cursus die ik vorig jaar ontwikkeld heb, en die ik met groot succes heb gebruikt.

Mijn belangrijkste drijfveer om dit boek te schrijven is het feit dat ik stellig geloof dat het in de nabije toekomst voor vrijwel iedere studie en vrijwel ieder beroep een noodzaak zal zijn om creatief om te kunnen gaan met computationele technologie. Daarom vind ik het belangrijk dat mensen al jong leren programma’s te schrijven; niet omdat ze programmeur moeten worden, maar omdat leren programmeren ze kennis en een denkwijze verschaft die ze heel hard nodig gaan hebben.

Python is een uitstekende computertaal om te leren programmeren. Er zijn voldoende Engelstalige boeken beschikbaar die leren programmeren in Python, maar in het Nederlands was er eigenlijk nog niets. Aangezien zeker voor veel scholieren het Engels nog een iets te groot obstakel is, zag ik een grote behoefte aan een Nederlandstalig boek over Python. Vandaar dat ik het nu beschikbaar heb gemaakt.

Mijn hoop is dat het boek door velen gebruikt gaat worden.


Python book released

July 18, 2016

I have released my Python book, aimed at beginning programmers. It is freely available as a PDF from the website I created for the book.

I know that there are already many Python books available for beginners, but the main reason I created this one is because there is, as yet, no Python book in Dutch. I wanted to make a Dutch one available. As I already had created an extensive Python course in English, which I have been using with my students to great success, it took me only two weeks to convert that one into a book. I then translated this book into Dutch, which took a period of about two months. But now I have two versions of the book: an English one and a Dutch one. Both you can download for free.

Their titles are, respectively, “The Coder’s Apprentice” and “De Programmeursleerling”.


No way back

July 12, 2016

New British Prime Minister Theresa May says that she will make the BrExit a success, and that the majority has spoken so there is no way back. This is one of the most silly things that a Prime Minister can say, and one seriously wonders whether she herself believes what she is saying.

First of all, is it really true that the majority has spoken? You can put serious doubts next to that statement. The votes were close, already many voters for a BrExit have shown regret in their vote, and it has been found that many voters actually had no idea about what the consequences of a BrExit would be. And perhaps worst of all: a rather high percentage of BrExit voters said they did so solely because the BrExiteers promised that if they won, they would spend the 350 million pounds that the UK pays the EU weekly on the National Health Service — which the BrExiteers, after they won, admitted had been a blatant lie, and that people who voted for the BrExit for this reason had made a big mistake. If instead of voting between “yes” and “no” for a BrExit, two more options had been added, namely “if 350 million more will go to the NHS weekly after a BrExit, then yes, otherwise no,” and “if we will send all the immigrants home after a BrExit then yes, otherwise no,” then clearly the “no” camp would have had an overwhelming majority as the two extra choices would have been picked a lot and would amount to “no,” as the condition for the “yes” could never be reached.

But even if the majority actually thinks it is a good idea to leave the EU, does that mean that the government has to follow that advice? The answer is a definite “no.” The government of a democracy is appointed to protect the interests of the country, and not follow the mob rule that allows the oppression of any minority as long as there is a majority that wants to do that. It is the responsibility of the government to act in the best interests of the citizens it governs. From the perspective of the UK citizens, is it a good idea to leave the EU? Considering that the EU is for the most part a trade agreement that functions well and that benefits the UK enormously, it is highly likely that staying in the EU is in the best interests of any of the UK citizens.

So there is a way back: if the government believes that it hurts the people to take a particular decision, not only does the government have the power not to take that decision — according to its responsibilities it actually is obliged not to take that decision.

But maybe Theresa May believes that leaving the EU is a good idea? The answer is “no.” Theresa May was actually a strong proponent of staying in the EU. That means that by invoking article 50 she not only does something that is bad for the UK — she actually does something that she personally believes is bad for the UK. It means that she is relaying her responsibilities to the mob rule.

An elected Prime Minister is appointed because the majority of the country believes that he or she will guard the interests of the country to the best of his or her abilities. The PM is not supposed to blindly follow everything that the majority says — if that would be done, the majority would pay no taxes, the majority would retire at 45, the majority would get free health care, and the country would be bankrupt within a year. The point of a democracy is not to let the majority decide on everything, but to let the majority decide who would protect the interests of the country the best.

Theresa May may argue that she is not the elected Prime Minister, that she is appointed because David Cameron retired from office and that she is holding the post only until the next elections. If that is the case, then she should definitely not invoke article 50, as she should know that deferring responsibility to the result of the BrExit votes is not what the office she holds is supposed to do.

I am pretty sure that if the invocation of article 50 is postponed until after a new British government has been elected, it will never take place. Because the only parties who have a chance of being elected are those that will make it part of their program to ignore the BrExit votes. Because if there is anything that a majority wants, it is for the UK citizens to live in peace and prosperity, and staying in the EU provides the best means to accomplish that.

If Theresa May, as she claims, really wants to “make a better Britain,” she should not start by making it worse.


Welcome to the barbarians

June 21, 2016

So there was this little village that was run over by barbarians every year. The barbarians stole the cattle and burned down the harvest, bringing the village to the brink of destruction. And because resources were scarce, even when the barbarians skipped a year, the villagers were still fighting among themselves. Poorer inhabitants stole from the richer ones. People viewed each other with suspicion. Life was harsh and not much happiness was found.

At some point the elders of all the village’s families came together, and decided that they needed to cooperate to keep the barbarians out. They decided to all pitch in and raise a fence. All the families contributed to a common resource pool, from which they supported armed soldiers that from then on guarded the surroundings of the village.

The barbarians tried to attack several more years, but the village was now well defended and managed to keep them at bay. The barbarians, no longer having the village as an easy source of sustenance, went to seek their luck elsewhere.

The village prospered. Now the problems with the barbarians were solved, the villagers were able to make life a lot better for themselves. They started trading, and created a welfare system that helped everybody to have better and more secure lives. The elders decided that each family should contribute to the good of everybody, the stronger and richer ones contributing a bit more than the weaker and poorer ones. Maybe the contributions were a bit unbalanced in that sense, but in the end everybody was better off by this organized cooperation.

The years went by and many villagers forgot why they had come together in the first place. Few remembered how things were before they banded up. Some of the richer families started to grumble: why were they supposed to contribute so much for those lazy, poor, third-rate families? And what about that council of elders? Were they really needed? Sitting on their lazy behinds, making rules that were obstructing freedoms, and getting fed for doing that and not much else. Who needs them?

One day, one of the richer families decided to drop out. They had taken a vote amongst their family members, and the majority had decided that they no longer were going to contribute to the village. They did not need the others. They had plenty of stuff for themselves, and they could collaborate with whomever wanted. And why not drop out? The village was safe, the fence was up, the guards were parading, and it was not as if that all would end if they decided no longer to be involved with the rest of the village.

“Basically,” they reasoned: “cooperation is a good thing, so it is great that the others are cooperating, but we gain much more if we do not contribute to the cooperation, as we will still reap almost all the benefits of the cooperation of the others, while bearing none of the costs!”

Of course, you can guess what happened. After the first family withdrew from contributing to the village, and evidently did not seem to suffer much from it, the next family which considered itself a net contributor dropped out as well. Quickly followed by the next, and the next, and the next. Trade became a hassle, the poorer families started to steal from the richer ones, nobody paid for the guards anymore, and the fence fell into disrepair. The barbarians, who were still in the neighborhood, took up their old habits, and plundering started all over again.

And sitting in the ruins of their village, which only recently had been prospering, the remaining villagers wondered why they had not bothered to ask themselves whether they had been better or worse off before they started cooperating.


Google translate infiltratie

May 12, 2016

Ik ben momenteel bezig met het schrijven van een Nederlandstalig boek over programmeren, en was op zoek naar een goede vertaling van de term “multi-branch decision”. Ik kwam hierbij terecht op de Linguee site die vertalingen aanbiedt, en trof daar de volgende tekst:

“If we wish to have more than one statement following the if or the else, they should be grouped together between curly brackets.”

die vertaald werd als:

“Als wij wensen om meer dan één verklaring na te hebben als of anders, zouden zij tussen krullende steunen moeten worden gegroepeerd.”

Vinden vertaalsites het tegenwoordig voldoende om teksten linea recta door Google translate heen te loodsen?

EDIT: Google translate blijkt betere resultaten te geven…


The digital overlords are here

May 6, 2016

I read a very nice statement of prof. Pedro Domingos of the University of Washington in the Dutch newspaper NRC of May 4, 2016. In answer to the question “What do you tell people who are afraid that self-learning computers are getting so smart that they will take over the world?” he said: “Computers are stupid and they already took over the world. It would be better if they would be smarter.” That’s going to be my stock answer to this question from now on.


21st century skills

May 2, 2016

Computational technology causes the world to change rapidly.

Almost 30 years ago I got my first job as a computer programmer. At the time, only larger companies with a big administrative overload used computers. Or rather, “a computer”, because it was rare for a company to have more than one. There were no personal computers, no Internet, no mobile phones. People still used typewriters.

In those 30 years, the way people work and live has undergone huge changes. That is exceptionally clear when looking at the kind of work that people do. Mailmen, for instance, delivered the mail twice per day when I was a kid — now they deliver mail twice per week, which means that the contingent of professional mailmen has been decimated. Bank offices are closed because banking can be done much easier online. Information desks can be manned by digital avatars or be replaced by online information systems. Large department stores go out of business because people make their purchases online, leading to an enormous decline in the need for having salespeople. And though this has currently caused a small increase in the demand for people who work in transportation, we can see self-driving cars on the horizon, replacing the need to have any chauffeurs at all.

These are all “low profile” jobs, but “high profile” jobs aren’t safe either. I have taught programming to professional journalists, who told me that computers are taking over large parts of their jobs, writing basic articles and doing automated background research — they wanted to take my courses because they realized that without skills in digital technology, they would be out of a job in a few years time. Programs have been developed that take over a menial but oh-so time consuming part of lawyers’ jobs, namely researching case histories. Computers can write music, produce paintings, and even sculpt — why would you have someone hammer away at a block of granite for six months when a 3D-printer can produce a sculpture with a few hours of work? Even designing and running scientific experiments has been offloaded to computers in some research domains.

In the 30 years in which I have been a professional worker, I have seen the job market change from hardly incorporating computers at all, to a situation in which the need for human employees has been reduced considerably — regardless the job. And that change has not come to an end yet.

This does not mean that there is no place for humans in the job market. It does mean, however, that only humans who can make contributions that a computer has a hard time making on its own, can be assured of a job. In the near future, employability will be invariably linked to the ability to integrate the power of humans and computers in a way that enhances both of them.

The problem is that to be able to use computers to improve the quality of one’s work, it does not suffice to be able to use a word processor or spreadsheet. One should actually be able to expand the capabilities of computers from the perspective of one’s chosen profession. For example, a journalist who can only run a fact-finding computer program that someone else wrote, is not needed. However, a journalist who is able to expand a fact-finding program so that it can come up with facts from new sources, is an asset.

To be able to employ computers in such a way, one needs the skills to think and solve problems like a computer programmer. Having taught students computer programming for many years, I know that this does not come naturally to most. To acquire the necessary skills, students need to spend several intensive courses on the topic.

Considering the fact that universities and colleges are supposed to prepare students for the job market in which they have to function for 40 or more years, and considering the fact that in the very near future (if not right now already) the ability to incorporate the power of computers in any job is a necessity to being a valued worker, one would expect that “computer programming” is one of the basic courses that any student needs to take. Unfortunately, it is not. Typically, basic required courses are “scientific writing”, “philosophy of science”, and “statistics”, but “computer programming” is still seen, by most education programs, as an optional skill. It is not.

In my view, any course program that does not make “computer programming” a required course, is doing its students a disservice, as it is not preparing them for the job market. Actually, I would prefer it if secondary, or even primary schools would incorporate such courses, as programming skills tend to be easier to learn at a younger age. The reason is that they need a particular way of creative thinking, which is harder to acquire when one is already used to solving problems in the reproductive ways that are normally taught at schools.

All students, regardless of their chosen topic, need to learn how to program. Not because we should raise a generation of computer programmers — professional programming is a specialization that only a few people need to be able to do. But the ability to create programs provides students with the skills to think and solve problems like a computer programmer, to gain insight in the possibilities and limitations of computers, and to leverage the power of computers in a particular domain in a uniquely human way.


Project GAMR is live!

October 21, 2015

Occasionally I have written on these pages on my ideas on understanding players of games through analysis of their playstyles as expressed in all kinds of gameplay variables. These ideas have been the basis of research I have been doing with some of my PhD students.

One of the most visionary and challenging approaches to research in this area was construed by my PhD student Shoshannah Tekofsky — she aims to collect all kinds of data from hundreds of thousands of players of triple-A games, encompassing their demographics, personality, motivation, and psychological state, and combine this with data gathered from their actual game-playing, to gain insight in what drives game players, what they get out of games, and how their playstyle reflects their person. Her vision is that you can gather such data if you manage to really connect to players and offer them something that they value.

She has been working on this concept for over a year now, not just at our own university, but mainly at the famous MIT Media Lab, in close collaboration with people from Riot Games (League of Legends), DICE (Battlefield), and Blizzard (World of Warcraft). She calls it “Project GAMR”.

And today Project GAMR went live!

You can visit it at http://projectgamr.com. A Facebook page is found at https://www.facebook.com/projectgamr. Twitter handle is @ProjectGAMR (#ProjectGAMR).


You Are Now Banished To Programming Hell…

July 5, 2015

…And You Will Enjoy It.

SpaceChem is a game that I recently discovered. It is a wonderful puzzle game of fiendish difficulty. The game has you construct molecules by disassembling other molecules and reassembling them in a different form. The crux is that you cannot do that by hand; you have two “waldo’s” (which you can think of as graspers) which follow a line that you set out. You can place instructions along the line, and the waldo’s will execute them when they encounter them. Typical instructions are: unload a new molecule from a particular input, grab a molecule, rotate it, bond it with a neighboring molecule, and dump a molecule in an output. The game starts out with some easy puzzles to teach you the ropes, but quickly ramps up the difficulty and has you construct factories that deal with the greenhouse effect, fuse atoms to create new elements, and even construct laser defenses against Lovecraftian monsters.

For people who like programming, SpaceChem is a wonderful experience. It requires you to be inventive with a limited instruction set and limited space. It requires you to invent new mechanisms based on simple instructions. It requires you to envision what the solution you are constructing is actually doing without seeing it being executed. It requires you think outside the box. It requires you to come up with ways to use the simple instructions provided to implement common programming tools (SpaceChem has no counter, but it has a flip-flop: a split in the road which the waldo will alternate between the left and right side; with a bit of inventiveness, you can come up with a way to use flip-flops to count to specific numbers, i.e., implement a for-loop).

After playing several levels of SpaceChem, I was convinced that I should use it in my programming classes. Because the main problem I encounter there is that students are unable to think like programmers. They are used to looking up stuff in books, to argue a point, to produce statistical results, to understand what variance entails, and to use software. But they cannot imagine what it means to talk to a machine in a language of basic instructions, and use those instructions to tell the machine how it should solve a problem.

This is what SpaceChem requires you to do. The two waldo’s are stupid; they just follow the line and do exactly what the instructions along the line are saying. They will happily try to rotate a molecule that they are not holding. They will run in an endless loop if you have made one. They make molecules crash into each other if you have not made sure that that cannot happen. They are just doing what you told them to do. But the thing is, even with the very few instructions available, and the very limited space, you can make the waldo’s do grand jobs.

This is what programming is all about. The problem with programming a solution for a problem is that you get confronted with the whole problem at once. You will have to find ways to cut it into manageable chunks, see how those chunks interact, and implement the chunks using the limited toolset that you have. The power that a good programmer has is that he or she can take huge problems, and carve them up into pieces that are all logical, understandable, and possible to implement. SpaceChem provides this experience in an entertaining way.

I am not the only one who came up with the idea of using SpaceChem in programming class. I found that in the UK the game is actively used in high-school programming classes. If it indeed helps students understand what programming is, it is probably the first edutainment game that I have encountered that actually is both fun to play and has educational value.

Of course, I would not be surprised if the main reason that I like SpaceChem is that I like programming and can do a reasonable job of it. And it should be noted that what a programmer has to do is usually much easier than the jobs that you have to do in SpaceChem. Modern programming tools are far more powerful than the simple SpaceChem environment, and the artificial limitations that the game pushes in your face are at least 30 years out of date. Therefore I feel that the following statement is apt:

“SpaceChem does not make you think like a programmer — it makes you think like an assembly programmer.”

2015-07-05_00001


Obnoxious charity

April 14, 2015

There is a poster hanging in the elevator at work, of which the first line reads: “Like this to give a thirsty child in Africa a new pair of shoes.”

Isn’t it kind of insensitive to offer shoes to someone who is asking for water? And how is me liking a poster going to help?