Sunday, September 14, 2008

Accidental complexity

The other day I attended a presentation (arranged by Valtech) by Andy Hunt, co-author of "The pragmatic programmer". Andy is a fantastic speaker so it's easy to guess that the presentation was fun and interesting. Andy argued that software has nowadays become pervasive. It's everywhere and it has become a fundamental part of the global economy. But are we ready for this? Software development is still too hard and often it's not because of essential complexity (due to the nature of the problem i.e. speech recognition) but because of accidental complexity (no real reason for it i.e bloated tools like Eclipse ;), XML or GOF patterns )

We have to get better at selecting the right tools for the job. More often than not we try to use the same tools and techniques to solve different problems and the result is often not ideal. I've seen horrible webapps that didn't even have any business logic written in Java and using the whole EJB2.x stack for no particular reason. Or just because "the CIO wants to use JEE". Btw, the CIO has never written a single line of code nor did he need to open JSP pages containing hundreds of lines of pure horror.

OK, so who cares? Don't we have bigger problems to solve that technology itself? Of course, but if we allow ourselves to choose better, more focused technologies for the task at hand we'll have more time and we'll be better equipped to solve the really hard problems which often have absolutely nothing to do with technology but, rather, with understanding what the users want. Andy calls this "death by generalization"....got a hammer?

Andy's advice:

  • Seek specific solutions
  • Avoid general solutions
  • Try to remove the accidental complexity

How hard can it be?


"I've never met a human being who would want to read 17,000 pages of documentation, and if there was, I'd kill him to get him out of the gene pool" (Joseph Costello)

:)

Monday, July 14, 2008

Space colonization

Current NASA chief Michael Griffin has identified space colonization as the ultimate goal of current spaceflight programs, saying:

"...the goal isn't just scientific exploration... it's also about extending the range of human habitat out from Earth into the solar system as we go forward in time. . . . In the long run a single-planet species will not survive... If we humans want to survive for hundreds of thousands or millions of years, we must ultimately populate other planets. Now, today the technology is such that this is barely conceivable. We're in the infancy of it... I'm talking about that one day, I don't know when that day is, but there will be more human beings who live off the Earth than on it. We may well have people living on the moon. We may have people living on the moons of Jupiter and other planets. We may have people making habitats on asteroids... I know that humans will colonize the solar system and one day go beyond"

Will we ever be able to do that? I hope so, but I don't think so. We are too busy doing other things like destroying the only planet where we can live and when the time comes to really leave this planet we will not be prepared. Our genes will become stardust.

Monday, April 14, 2008

Studying the great works

An old colleague of mine, Joakim Sundén has written an excellent blog post on the importance of reading books (ok, from the point of view of a software developer). It's in Swedish but very nicely written and I can only agree with what he says. What baffles me is that so few developers in this industry read something (other than their own code). Few read articles, blogs or other people's code. And even fewer read books. I know, time's scarce. We all have families, hobbies, etc. Agreed. But if that's the case, then you should do it on your free time. If you are a person who is interested in a 9 to 5 job, I recommend that you have a career switch. Software development is not a field where you can just go to work. It requires a great deal of effort and agility to keep up with it.


We are in a profession where we are dead if we don't keep learning. To me being a software programmer is like being on a treadmill. You cannot afford to stand on a treadmill when it's on; you get thrown away. And that's exactly what happens the minute we quit learning in software development. Learning is something extremely important. And learning by taking a course, it's just one way of doing it. You could attend good conferences and symposiums definitely, but again all of those require budget, no doubt about it and we certainly must do that, but what's important is: that is something we're going to do a couple of times a year. That doesn't mean that we learn only a couple of times a year. So what do we do about learning? I want to talk about this as iterative and incremental learning. In other words we can not afford to learn something huge and large in just one day. We did this as students, cramming before the exam; we certainly shouldn't be doing that as professionals. - Venkat Subramaniam

One way to force ourselves to keep reading, learning is to do this within an organization. An example is to organize "brown bag sessions" where different people volunteer to be the lead in different discussions. You should be able to find at least one or two people that are interested in this kind of setup. Get them going, get management involved, arrange a few sessions and see what happens.

Just as we are interested in iterative software development we should be equally (or even more) interested in iterative learning. What did you learn today? Are you learning anything it at all? This should be a sign that tells all of us that it's time to get a new job :)

It's not easy but my personal goal is to become one of the mythical 5%

In my experience those in the 5% must struggle to get there, and struggle to stay there, and it's the process of continuous learning that makes the difference. - Bruce Eckel

We could compare software development with writing poetry. Mark Strand said that how good you are depends on how many poems you've written in your life. How do you get good at it? By writing poetry all the time. By reading relevant literature. By studying great poetry works.

Saturday, April 12, 2008

Tx isolation levels with JTA and Spring

I just "rediscovered" that JTA does not support custom isolation levels. I was using Spring's JtaTransactionManager together with @Transactional and setting custom isolation levels for different operations. The application was a legacy EJB2.x based application which had been migrated to Spring in order to simplify the deployment and eliminate the horrible realms of XML. But after eliminating the SLSBs lock problems in DB2 were observed. It turned out that some of the heaviest queries were not being run with the intended isolation value as defined in the annotations, just the default datasource level which is usually READ_COMMITTED. This level is the equivalent of "cursor stability" level in DB2.
The Cursor Stability (CS) isolation level is the default isolation level and locks any row on which the cursor is positioned during a unit of work
This was really not what was intended since it locks rows with a shared lock. Other transactions can still access the table for selects but holding the locks places a heavy load on the db. In this case what was desired was to have a READ_UNCOMMITTED isolation level for those completely read-only operations.

There are usually two ways to solve the problem of custom tx levels with JTA.
  • Define a datasource for each isolation level you intend to use in your application and then use IsolationLevelDataSourceRouter
  • Use a vendor-specific extension that wraps the JNDI datasource
It's typical to learn this the hard way so I'd like to recommend this article that shows how to specify custom isolation levels with Spring and JTA in detail.

Tuesday, February 12, 2008

Unthinkable futures

These are excerpts from a list of "unthinkable futures" as developed by Brian Eno and others out of an internet conversation some years ago. If you like Eno's works I'd recommend getting "A year with swollen appendices". It's a fantastic book, full of smart thoughts. Truly the work of a "drifting clarifier". Did you know that Brian created the "Microsoft sound"?
Mass outbreaks of allergies unexpectedly solve all our transportation problems by confining almost everyone to their sealed residences. Telecommunications stocks soar

A highly successful new magazine - Ordinary People - focuses only on people who have never done anything in particular to deserve attention

News is understood to be a creation of our attention and interests (rather than "the truth") and news shows are redesigned as "think-tanks," where four interesting minds from different disciplines are asked the question, "So what do YOU think happened today?"

Later, four uninteresting minds (chosen from the pages of Ordinary People magazine) are asked the same questions

A microbe engineered to eat oil slicks evolves a taste for rubber. Transport grinds to a halt on burst tyres. People stay home and have sex more, but condoms crumble routinely. World population doubles in six years

The commonly held notion that it is correct to surround children with love, security and affection suffers a serious decline in credibility when it becomes apparent that kids reared thus are entirely unequipped for a world that is cruel, dangerous and insecure. Enlightened parents begin experimenting with new forms of toys: teddies with sharp teeth, building bricks with abrasive surfaces, mildly toxic crayons, unsafe play areas

Manufacturers of underwear finally realize that men have different sized balls
Some of the legendary Oblique Strategies could be applied to software development as well