Skip navigation.

The Humane Programmer

Understand your limits, so that you can overcome them. A CC-BY-SA licensed blog.

STICKY POST

Full schedule

, , ,

I'm still having a very intense schedule:

  • Me and Maria are speaking at Agile Eastern Europe 2009 in Kyiv on the 18th of September, on the topic "Developer's Toolkit in an Agile World"
  • We started the preparations for the second edition of Open Agile Romania, the Romanian event dedicated to agile methodologies - see more at www.openagile.ro
  • We extend Agile Works to Timisoara, while we return to Cluj, Brasov and Bucharest. The community is both about management and about development - specifically, software craftsmanship
  • We are working on bringing well known personalities of the industry to talk in Romania. More to come...


So, see you at AgileEE or OpenAgile or AgileWorks. Or, who knows :wink:?

The future is semantic

, , , ...

I have been involved in the last couple of years in a project that uses semantic technology, and I will try in this post to give a feeling about what it is and how it can be used.

I'm sure that we've all heard about semantics, in various contexts: language, parsers and compilers and lately related to web. However, until I've worked and thought of this concept, I didn't have a very good understanding of what semantics is in general.

According to wikipedia, semantics is "the study of meaning in communication", and actually you can substitute semantics with meaning in almost all contexts. Semantic analysis in grammar is looking at a sentence from the point of view of meaning. Semantic analysis in parsers and compilers is looking at the meaning of the programming language constructs put together. The idea of semantic web is to add machine-readable and inferable meaning.

The world we're living in contains semantics, a semantics built by three main characteristics: things, relations between them and actions that you can apply to a thing. Take the following example:

My(relation) name(thing) is(relation) Alex(thing) and(relation) I(thing) write(action) a blog entry(thing) while(relation) sitting(relation) on(relation) a chair(thing).

And that's basically what semantics is.

The problem with semantics is that we have a great tool for processing it, one that machines lack: our brains. The brain evolved along with us in this environment, and it developed special powers that allow it to process and understand the semantics of this world. Machines have no idea about things that to us are very simple to understand, like the fact that "Alex" is the name of a person, or what "writing" means. Therefore, in order to make machines process such information, you need to explain everything to them, or to allow them to evolve. The first solution is very time consuming, while the second may give very strange results as you cannot control the evolution but only the environment and the rules for it.

Despite these problems, people have found ways to build machine-readable and inferable semantics, some of them very familiar to any of us.
The web is the first example that comes to mind. It has a few types of objects (page, image, sound, object), a single type of relation - links to - and one action - follow link. A wiki is the same thing, only that there are rules for the free text content of the page - you know that in wikipedia the page http://en.wikipedia.org/wiki/Semantics discusses "Semantics" and you have additional actions: edit, create, delete.

Video games build their own semantics. In a FPS, you can move, rotate, shoot, and each object may have additional attributes: weight, health, stamina etc. A RPG builds upon a more complex semantics that describes not only your current state but also your possibilities of evolution - nothing more than a kind of metadata. This is only natural, since a game tries to define a world with meaning for the player.

The easiest built semantics that you can find in games is in MUDs. Due to them being text-based, there's plenty of freedom in defining objects, relations and actions very quickly, and obtaining a world where anybody can play and try. This advantage of quick prototyping allows for a lot of user generated content, even if the community is rather small.

Social networks also build semantics. The main object is a person, with various other collateral objects: company, group, awards, schools etc. The main relation is "know": "Person X knows person Y". The actions are add and remove. The problem is that they are limited, because other elements are missing from the picture: trusts, prefers, likes etc.


If we think about technology from this perspective, we realize that the tendency is to add and to enrich the semantics of the applications. However, this is no easy treat. Trying to do too much can only bring failure. It's better to start small, and that's why technologies like the web, wikis, social networks are so successful, despite having very limited semantics.

However, it is clear that adding semantics - new types of objects, of relations and of actions - can significantly enrich the user experience, if done properly. That's why I think that in the long run, the future is semantic.

People love recipes but they shouldn't

,

The more I meet with developer communities, the more I understand (and get annoyed by) a simple truth:

People love recipes.

Recipes don't work in the real world when you're trying to obtain exceptional results or when you're working on something innovative or when you're working in a fast changing environment. Some of us are forced to work in such conditions. For the others, I think that's what we should try to accomplish.

Even the most common meaning for the word "recipe", the meal recipe, is a very good example. If you've ever eaten an excellent meal, do you think it was made after an old recipe? Sometimes, very seldom, yes, but most of the times the recipe is adapted, slightly modified or completely invented by the chef (or by your mother or grandmother). The best meals are the ones that you invent for your own taste. The chefs know that, and so do most of the people who cook tasty meals.

Software development has another kind of recipes: patterns. I definitely recommend knowing the GoF patterns and all the ones presented on Martin Fowler's web site, but only because they are selected patterns and have proven to be the most useful. The literature on software patterns has exploded in the recent years, without providing much added value. Even the GoF patterns need to be adapted to specific situations that we encounter, and they were taken from years of practice. The context can change everything, that's why patterns are only mildly beneficial.

Business recipes could be one of the greatest hoaxes of our times. Their promise is that by applying them you will reduce the risks for starting or for growing your business. Let me tell you one thing: once you start building a business, there's no way the recipes will be useful to you. Reality finds ways to avoid repeating itself, so what was good for one, two, one hundred businesses before you won't be good for you. You will need to adapt, to fine tune and sometimes to rebuild your strategy from the scratch. Recipes mean nothing in the real world. It is more probable that those businesses that succeeded in following a recipe were very lucky. Try reading "Black Swan" to get a feeling of why this happens.

People like recipes because they think they make their lives easier. The intuition is that following a recipe reduces risks by building upon past experience. This intuition is wrong, because reality changes all the time. A meal recipe used to be good at some point because a different type of onions was used that's no longer available. A design pattern worked fine because there were no applications with 10 million users. Copyright law used to work because copying a work was very difficult. Newspapers used to work because publishing was difficult.

So what's left when we take the recipes out? The techniques for making the recipe. You need to boil or fry your ingredients. You need to use classes in OOP languages. You need to tell a story so that customers come to your business. But the number of ingredients, how and when you mix them, how long you keep them together and the seasoning - that's your decision.

It's risky, but with decisive actions, the results will be exceptional.

Brief history of reactions to innovations in communications and publishing

, ,

So everyone will know how to read?
So everyone will know how to write?
So everyone will know how to compute?
So many people will read what's written by certain authors?
So everyone will be able to talk to everybody else?
So everyone will be able to see/hear movies/music made by some people?
So everyone will be able to tape the movies and music from radio/TV?
So everyone will be able to make movies?
So everyone will be able to make music?
So everyone will be able to publish text, images or sound?
So everyone will be able to transfer text, music, videos to a lot of people?
So everyone will be able to publish anything and everyone will be able to see/hear/read/get a copy?
So everyone will be able to do all that without anybody knowing it?

Software development mantra

, ,

I've got inspired today to write this. I hope you'll like it.

What's left after you take out OOP
What's left after you stop thinking about methodology
What's left when there's no manager
What's left when you stop thinking
About principles, patterns, best practices, design, statistics, workload or productivity
What's left after you've cleaned your head
Of all images and diagrams and opinions and views of others
Is the code, and it's all that matters.

A theory about common sense

, , ,

In my many long days (and a few nights) of professional software development, I've had quite a few WTF moments. I'm sure you all know what I'm talking about - that moment when you look to somebody's else piece of code and you realize that he/she/them used the worst possible solution to the problem in hand, one of such devious ingenuity that you could never have created it, and therefore builds into you feelings of both fear and nervous laughter at the same time.

Every time I shared such a solution with one of my fellow developers who have the appropriate stature to understand the point, we were both thinking: this is nonsense! This violates the most basic mechanics of software development! This violates our common sense!

But common sense is a very elusive concept. How do you express it, how do you explain it to those people violating it in such an unimaginable manner? How can they learn it, use it, teach others? How did you get into its possession?

Hard questions, with no answer. Until now, when I have finally developed a theory of common sense. It may be proven right or wrong, but at least it's a theory that is, I believe, worth exploring.

My theory can be summarized as following:
  1. We start learning programming because we are attracted by it
  2. We continue to learn and read more and more because it's more and more interesting
  3. The knowledge pieces we gather connect to each other
  4. The connections solidify in patterns
  5. The patterns become the second nature and the common sense is born


The first empirical evidence of this theory was available to me a long time ago. I realized that the programmers that had common sense also touched a wide area of topics related to software and computers. I could discuss with them about all kinds of things, from the architecture of Linux kernel to functional languages, including topics from telecommunications, networking, assembly, electrical circuits or even unrelated topics like quantum physics, astronomy or genetics. One does not read such topics if forced, so they must have liked it.
On the other hand, the programmers that did those mistakes could not discuss any interesting topic and had almost zero culture in programming. Most of them had learned one programming language and one platform (.NET in my case) and were programming for money.

However, knowledge is not enough. I have also met people who knew quite some things about programming but had a crippled common sense. They weren't as bad as the WTF cases, but they had some repeated glitches. The brain plays a major factor here; the way it filters and organizes information can create very good systems or good enough systems of patterns.

My theory is also supported by some scientific research. A Scientific American article talks about The Expert Mind.


A chess master expert. Photo licensed under a CC license by mysza831

How did he play so well, so quickly? And how far ahead could he calculate under such constraints? "I see only one move ahead," Capablanca is said to have answered, "but it is always the correct one."



The article shows that the mind of an expert is formed by learning, practicing and working for at least 10 years. This helps forming a specialized type of memory that the expert uses for his work and that makes a very big difference between him or her and a beginner.

On the other hand, software development studies have shown that a good programmer is at least an order of magnitude better than a mediocre programmer. This isn't so unexpected when you know about the expert mind, is it?

In programming specifically, many studies have shown order of magnitude differences in the quality of the programs written, the sizes of the programs written, and the productivity of the programmers. The original study that showed huge variations in individual programming productivity was conducted in the late 1960s by Sackman, Erikson, and Grant (1968). They studied professional programmers with an average of 7 years' experience and found that the ratio of initial coding time between the best and worst programmers was about 20:1; the ratio of debugging times over 25:1; of program sizes 5:1; and of program execution speed about 10:1. They found no relationship between a programmer's amount of experience and code quality or productivity. (Code Complete, page 548)



And the final piece of evidence that I can provide at this point is a study on the ability of people to learn how to program. The study was initially called in a very suggestive manner The camel has two humps because it shows a large difference between the people who can learn programming and those who can't.


Expert pattern built by an expert. CC licensed work by Vilhelm Sjostrom.

Abstract: All teachers of programming find that their results display a 'double hump'. It is as if there are two populations: those who can, and those who cannot, each with its own independent bell curve. Almost all research into programming teaching and learning have concentrated on teaching: change the language, change the application area, use an IDE and work on motivation. None of it works, and the double hump persists. We have a test which picks out the population that can program, before the course begins. We can pick apart the double hump. You probably don't believe this, but you will after you hear the talk. We don't know exactly how/why it works, but we have some good theories.



In conclusion, my take on common sense in software development is:
  • Some people like programming and some don't - the camel has two humps
  • The people that like programming study a lot, forming their expert mind
  • The expert mind makes an order of magnitude difference
  • What we call common sense are the patterns found in the expert mind


Until next time, may the common sense become more common!

Another take on the essential problem of software development

, , ,

I discussed in a previous article what I believe is the fundamental issue of software development: the fact that software development works with ideas. Specifically, software development starts with an initial idea, what we call requirements, which is about the resolution of a problem from the real world or an optimization of an activity and goes to a more material idea, the actual implementation of the requirements.
I will present in the following another take on the same discussion.

If we think at the majority of the human projects, you can split the needed work in two categories: think-work and work-work. Take construction for example: think-work is the work of the architect when he imagines a new type of building, or a new bridge; think-work is also the work of the construction engineer who thinks of how to solve practical problems, like ensuring the structural strength and the fire proof quality of the construction; think-work is also the work of the construction crew who solves particular issues or optimizes the work during construction. Work-work is the more mechanical activity that, if we keep the construction example, can be drilling a hole, brick working or nailing boards together.

An example of think-work. CC licensed photo from nelle100

We can find such examples for most human activities, be it cooking (create a recipe vs. slicing the vegetables), music (compose a song vs. playing an instrument), writing (composing vs. typing or handwriting) and so on. The difference lies in proportion; some activities need more work-work (driving) while others need more think-work (painting, writing a novel, solving a mathematical problem).

I believe that software development is at the upper range of think-work. You can easily realize this once you try to give examples of work-work in software development, besides typing or talking. Software requirements and software design are easily excluded from the set of examples. Despite what some companies want you to think, writing code is not work-work - you cannot disconnect your brain while doing it. Solving bugs is like solving a mystery, so it's definitely think-work. Testing is the most repetitive part of software development, so there is work-work there, especially in the execution of test scenarios.

A good software design might assure more work-work and less think work, but in most cases it only obtains easier think-work - if you think of it, that's what it does, by sustaining conceptual integrity and by defining patterns and recipes for specific problems in a limited scope (e.g. how to create a new form in the application). The specifics are however so elusive that nobody can design everything completely from the beginning for any complex enough application. Therefore, you are bound to have a significant amount of think-work in any software project, no matter how good your design is.

An interesting characteristic of software development is that think-work is not easily assignable to one or more members of the team, being spread in all the activities of the project. Trying to do this for economical reasons - pay one or more team members more and let them take responsibility - produces more problems than it solves, by introducing mistakes in the system that need to be tackled afterwards. That's one of the reasons why Lean Methods applied in software are successful - it's better to make something good from the first time rather than making it wrong and then trying to solve it.

Therefore, we have seen that the amount of think-work in the software development endeavors is quite high and spread inside the team. That's another reason why we need to understand our brains better and why we need to try to void their pitfalls.

Until next time, may your think-work and your work-work combine swiftly!

People evolve faster than their genes - part V

, , , ...

Here we are to the last (for now) installment of this series. And what a road it has been! We've talked mainly about brain, about its internal hardwiring and about the limitations and mistakes it is prone to. We discussed about pattern matching, about how great it is and that it tends to be overused, about the (in)ability to predict future, about it being fooled by randomness and about how all those things affect software development.

I will try in this post to draw a conclusion from this discussion. During the writing of this series, I realized that the best practices that we now know and sometimes use in software development are related to the limitations of the brain and are actually means to overcome them. It's a natural process: we noticed some of the things that don't go well, tried to solve them and evolved the solution up to a certain level, but the resulted best practices solve fundamental issues with the brain.

Therefore, we are now in the position to apply the same process, but this time knowing what it's about. There are many studies on the brain, on its limitations and on its super-powers (include only scientifically valid ones please), so we could start from them and derive or improve the current best practices. We would then have a method for deriving software development best practices, which is equivalent to saying that we can end the empirical phase of organizing development teams.

Provided that we use this method, the way of teaching software development must change. We already know that, but we don't really know how to change. I believe that the study of brain's limitations is mandatory for any programming course, because successful software development depends first of all on the team members. In fact I will go as far as to say that the study of brain's limitations should be the cornerstone of any programming curriculum.

It can also be really fun. I provided in my previous articles links towards speeches and books about the brain's limitations and I have to say that they are the most fun scientific materials I've ever come across. It's so easy to find about the brain's limitations, because we all have one, and sometimes we're all tricked in the same way - due to our similar hardwiring of the brain. For instance optical illusions are the best proof that pattern matching is overused. Future prediction games can easily be designed, as well as randomness toys. This is good, because it is really easy to understand and internalize the idea that those issues exist, that you have to find ways to overcome them and that we already know some solutions that you can apply today. The main difficulty lies in finding better ways to overcome limitations, but given a similar mindset and a collective mind, I'm sure that we can get significant improvements faster than expected.

Of course, the beneficial effects of such a lecture are not limited to software development. The reasons I'm talking so much about it are (a) because it's my domain and (b) because software development works with ideas, and the brain is our only tool. Thus, any improvement in the way we work with it will show a dramatic increase in quality, performance, productivity and so on. Despite my personal interest, I am sure that the applicability of a lecture on brain's limitations is beneficial for many other domains, especially creative ones - which become more and more present in our lives due to the Internet and the scientific advances.

Therefore, my conclusion is that we should study brain's limitations, document their relation with software development best practices, derive or improve best practices from our knowledge about the brain and start teaching programmers, present or future, about those issues. This is exactly what I will do from now on, because this topic has captured my imagination and my thirst of knowledge.

Until we talk again, unlimit your brain - it's worth it.

PS: All the articles in this series will undergo a process of review and improvement. New horizons have opened for me during their writing, and new information has appeared - as it does every day. If you happen to have any connection with brain studies and have the time for a critical view on the series, please send me your remarks. If you know of any connected studies, books, speeches etc. please let me know. For me, this is only the beginning - although those are questions I've pondered since long ago. Any help will be appreciated and remembered. Thank you.

People evolve faster than their genes - part IV

, , ,

Nassim Nicholas Taleb is a stock exchange trader who also happens to have a mathematical background. He's a very good trader because he has a secret: he knows how
to take advantage of randomness and how to avoid the traps of applied statistics.

Europeans believed swans can only be white until they discovered Australia. The Black Swan is a sample of a rare event, and also the name of one of Nassim Nicholas Taleb's books. Photo released under a Creative Commons license.

We wouldn't be talking about a stock exchange trader in this series of articles about the issues raised by the internal hardwiring of the human brain if he wasn't special in some way. Mr. Taleb sure is; he wrote a book that was selected by Fortune as one of "The Smartest Books of All Time" and another one that challenged the common view on random events. His main points are:

  • We do not perceive correctly the randomness that surrounds us.
  • Many events in the human history are actually rare and random.
  • We retro-fit to those events a logical explanation that exclude randomness (our brains create causal links where they don't really exist)


As a result, his very successful trading technique is to bet on rare events that create high gains. Instead of removing the maximum and minimum values from the analysis, as most statistical methods do, he is searching for those values, he is betting that they will appear, because they make the difference.

His story is very interesting because this is exactly the way Scrum was created. When Jeff Sutherland and Ken Schwaber thought about a new, simplified and productive way of work, they took inspiration from those software development teams who had excellent results (it's worthwhile to mention that those teams include the IBM "surgical team" designed by Frederick Brooks). Ironically, the same teams were eliminated from the industry-wide statistics because normal statistical distribution is the norm (that's also why scientists didn't see the signs of global warming).
As Scrum proves, following the rare maximums is the way to go, instead of looking at the average. So we can say that for many years, software developers and managers were fooled by randomness - as Mr. Taleb would say.

This is not the only activity in software development where randomness intervenes. Estimation is another one. Not many people know, but an estimate for a task is actually a combination of two factors: how long it will take and the probability that the prediction is correct. The probability evolves over time, creating what is known as the cone of uncertainty. The interesting thing is that a software developer can estimate the probability for his/her estimation when asked, but doesn't think about it if not required. (I don't know how accurate the probability estimations are, but the important point is that anyone will admit that the estimation is not 100% accurate.)

Let's not forget about the influence of the business evolution on software projects. It is well known that requirements change all the time during development, and the waterfall approach tried to turn a blind eye to it - with notorious results. The continuous change of requirements is a very real random factor in the software development process, and it should be treated as such. Maybe with the help of ideas like the ones presented here we will improve the way we manage it. Until then, smart planning of short iterations is the best way to go.

A different view on causality. Photo released under a Creative Commons license.

Another point tackled by Mr. Taleb in "Fooled by Randomness" is that people, especially traders, can be fooled by consequent successes into believing that they always win. This is a direct consequence of the failure of perceiving randomness. Some of you may have met with software developers or project managers who think they are unbeatable, because most of their projects were successful; I sure did. Sometimes they were overestimating their results (on a closer look, the projects were actually close to disaster), other times they were overestimating their contribution to a good result. We know that everyone has a self-evaluation bias, people obtaining worse results thinking they perform better while people obtaining better results thinking they perform worse. But isn't there a random factor (besides the one we know) adding to the success of their projects? Weren't they just lucky random fools? That's difficult to say or measure, but it seems reasonable to assume it's true.

In the end, the main points are that our brains tend to under-evaluate the effect of randomness in our lives and in our projects. A conscious effort is necessary to overcome this limitation, and estimation techniques do just that by narrowing the cone of uncertainty. We need to include the random factor in our planning, and let go the illusion of control.

Until next time, may you achieve the wisdom of randomness.

People evolve faster than their genes - Part III

, , , ...

In the previous installments(first and second) of this article, we talked about the evolution of the brain and about the extraordinary pattern matching ability that we possess and how it can make us take erroneous decisions. We'll continue with another hardwired ability of the brain that is good most of the time and is sometimes bad for software development: the prediction of the future.


If we take a look at what the human race accomplished, we see lots of finalized projects: buildings, transportation, bridges, roads etc., some of them extraordinary, like this water bridge. No other species on Earth seems capable of doing this, so we must have something special.
It turns out that all those projects require a few steps: imagine the end product, plan it and execute it. The first two steps are of the foremost importance for any complex endeavor, and they have a thing in common: the ability to imagine something that doesn't exist yet.

Do we know how we do that? According to existing studies, this ability has a lot in common with the way we store memories: as a compressed lossy version. When we recall a specific memory, the brain fills in the details, using the present.
When trying to predict the future, the brain uses the same mechanism: starting from the present and from a specific piece of information (e.g. I want to build an online ticketing application), it fills it with details and creates an image.

We've learned from history that this ability works good enough, but we also know that sometimes it doesn't. The source of bad predictions is what we call "lack of imagination", and we have lots of examples. Let's see a few, just for fun:

"I think there is a world market for maybe five computers." - Thomas Watson, chairman of IBM, 1943.



"Where a calculator on the ENIAC is equipped with 18,000 vacuum tubes and weighs 30 tons, computers in the future may have only 1,000 vacuum tubes and weigh only 1.5 tons." - Popular Mechanics, 1949



"Radio has no future. Heavier-than-air flying machines are impossible. X-rays will prove to be a hoax." - William Thomson, Lord Kelvin, British scientist, 1899.



"It will be years - not in my time - before a woman will become Prime Minister." - Margaret Thatcher, 1974.



"The abdomen, the chest, and the brain will forever be shut from the intrusion of the wise and humane surgeon." - Sir John Eric Ericksen, British surgeon, appointed Surgeon-Extraordinary to Queen Victoria 1873.



When we analyze these bad predictions, we realize that the authors failed to imagine something that was entirely possible, due to being influenced too much by the present. And so we come to the next question: how do we avoid this influence?

Lucky for us, Arthur C. Clarke stated two laws that help us do just that:

When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.



The only way of discovering the limits of the possible is to venture a little way past them into the impossible.



There are two keys for a more accurate prediction:

  • Details, many details
  • Think what you need to do it, not if it's possible


The lack of imagination takes many aspects in software development.

During my career I have encountered many times the expression: "We can't do that", either in a technical context (e.g. we can't use a custom rule engine with built-in Workflow Foundation activities) or in an organizational context (e.g. we can't use unit testing now). Most of the times, I've proven them wrong by actually doing it. Actually, this is one of those things I constantly struggle with. However, this is the least damaging effect of lack of imagination.

The others, much more damaging in the long term, are:
- failing to imagine risks
- failing to imagine possible security breaches
- failing to estimate correctly

(It would be interesting to find a study showing the contribution had by the first and the third factor on project failure. I couldn't find any.)

Estimation technique called Planning Poker in action. Image released under a Creative Commons license by Wyscan

Let's look at some of the modern best practices in software development with respect to what we've established above:
- Release early, release often = you don't have enough details to accurately predict the user's needs, the risks etc.
- Design and implement incrementally = you don't have enough details to accurately predict the future, so think only of what you know for sure
- Estimate by describing the solution in detail = add more details to the prediction mechanism of your brain
- Threat modeling = detail all possible threats and treat them
and the list could go on and on.

To conclude, we have good news and bad news. The good news is that the human brain is able to imagine a possible future. The bad news is that it sometimes fails. The good news is that we can improve its ability by opening our minds and adding details to the picture.

Until next time, may your predictions be right!

P.S.: I'm a big time Douglas Adams fan. As a result, this trilogy will have five parts ;-)



Bibliography

Software Estimation - Demistifying the Black Art by Steve McConnel - A look into estimation techniques and best practices

Stumbling on Happiness by Daniel Gilbert - We destroy our happiness when we expect something very different than what we get. A very informative book about how the brain stores memories, recalls them and predicts the future - and about when it fails to do so correctly.

Dan Gilbert researches happiness, a TED talk about why and how we fail to predict the future

Wikipedia

Many articles about software development methodologies, best practices and so on


I would like to thank Felix for the help provided for improving this article.