Month: September 2014

Scrambled Eggs

Back when we lived in Brazil, we did not use the television other than as an output device for the video-games and the DVD/blue-ray players. I got rid of tv channels around 12 years ago, for there is not much television add to our lives and there is so much that it takes from us.

It is far too easy to spend many hours, not having fun, not learning, not resting, just burning through time with absolutely no benefit, being spoon-fed with needs we don’t really have and having our brain slowly turned off.

Cable channels are even worse than open channels for they charge you for the disservice.

Now that we moved in to Montreal, we have the need to learn french, and so we figured that it would be good to have the television to rise the language immersion. So we now watch tv, mostly Baby TV, as we thought it would maximize learning for our son and for ourselves.

I would give it, there are some good sketches with some educational value, but I am starting to figure it is targeted more as baby’s time sink than as proper educational.

In particular, there is a sketch that, in my opinion, actively does harm for it helps even that early in the baby’s life to inculcate this wicked culture of the only one right answer and fear of being wrong.

The sketch is named Eggbirds and it is about a flock of painted eggs with feet and beaks, they walk in formation following a boss, differentiated by having hair, as he is the boss, he is “special”, he goes a little further in the front but sometimes he stops and let the flock pass by as he inspect the others.

There is a bland one that is the “intern”, he is an unpainted smaller egg lagging behind the group, walking alone. At some point they find hanged cloths and the boss decide it is time to play, he announces which will be the play from a podium, and he order someone to be the puppet in the play, which of course is thrust upon the intern egg by the others.

The intern then hides behind the clothes and reveal himself slightly painted or with some part of a costume, at which point the others try to guess what is his intended costume, they guess something that always is perfectly plausible and acceptable given the bits shown, the boss looks and patronizingly refuses the answer.

Then the intern hides again and add a little bit more to the custom, show himself again, someone gives another good answer, and this time the boss straight laugh at his/hers face humiliating him/her for not having it “right”.

For the last time the intern hides, and somebody hazard a guess just after he comes back and he is identical to the guess, the boss audits the answer to see that it is EXACTLY the same and then approves it.

All along the sketch reinforces the bad stereotypes that the group must follow and be controlled by the boss, unable to decide on theirs own what to do, with him having the only right answer to the problems, micromanaging people and auditing every single act and trampling those that do not conform to the expected norms and solutions, destroying the very source of creativity and rewarding sameness.

It is even factually wrong for birds flying in formation do that through an emergent pattern with no single bird controlling it and the head of the flock changes over time, as the front birds get tired they fall back and others become the front.

Much more likely to a team where each member is independent and has skills to add to the group and does when the skill is required by the situation than the command and control view imposed.

Slowdown

This September 10th there is a movement that is going to slowdown the internet for one day, as a conscience awakening, so that it does not slowdown for good.

What is it about? Cable operators are trying to be allowed to provide different connection quality based on the source of what you are visiting, if the owner of the site or service has contract with them, they will service it at better speed, if it does not it gets crappy transmission.

If you want to know more and even help, here you can get more pointers.

Just to point the pragmatic absurdity of this, if someone puts up a new service to run, in order to not get crippled it would have to sign contract with every internet provider in order for its users not be slowed down on theirs access.

So a website in Turkey would have to contact the American providers and pay each of them in order that the American visitors do not get crappy speed for accessing them, users that are already paying theirs operators for such speed.

Maps and Abstraction

The entire history of software engineering is that of the rise in levels of abstraction.
Grady Booch, The Limits of Software

That I was always a supporter of the idea that in object-oriented languages there is almost no place for switches is no surprise to those that know me.

A switch statement almost always can be replaced by a map of values, a map of commands or a state pattern making a cleaner code and more versatile, it is the object-oriented way of doing it.

I was even challenged on a class that I taught Java to software developers changing in to Java on this one, people said that there is occasions that it simply cannot be done, but none could come up with an example which I could not turn either into one of those three.

Some people will complain about those not being as optimal as switch, but then again Donald Knuth warned:

“Premature optimization is the root of all evil.”

First and foremost software developers should be concerned, when writing code with two things:

  • Is it correct?
  • Is it easily read and understand?

We write software for computers to run, but also for other human beings to read, for the human beings are the ones that maintain and add to the code, a computer language is not restricted to be a set of instructions to the computer, it is also the language that convey the meaning of the software to people who read it.

Code easy to understand is easier to optimize while a mess of optimization end up rewritten, or worse cut out. If the ones maintaining it can’t understand the code and it’s purpose.

That is not to say I never write switches, everyone has a lazy moment, yet it makes me feel that I have live butterflies in the stomach and usually I end up reworking the code to get rid of the pesky switches.

Lately I started to get the same from maps, every time I see a map I got that feeling that there is an abstraction that failed to be seem. After all, a map in its own nature denotes relationship among the entities mapped.

And the relationship asks for an entity to be born. A good example of that I extracted from a Java discussion list in LinkedIn, the guy asked a way to order a map by its values instead of keys and as some know usually what people ask is not what they need.

His problems were that he needed to sort cars by distance and he had a map from cars to distances that kept being updated. Here the source of his problem was that entity asking to be born, it was the key to solve the problem, once I modelled it for him as a Radar Blip and created a blip comparator that sorted the entries of a simple collection of blips by distance his problem was solved. (source code)