I recently appeared on the Tech Lead Journal podcast, and the host, Henry Suryawirawan, picked up on a comment I made about the cost of a mistake I made many years ago, namely, the mistake of underestimating the importance of Hibernate’s StatelessSession
, and of not including it in the Java Persistence API.
You might think my statement a bit hyperbolic, and I guess it was intended in that vein, but let me give you a quick order-of-magnitude computation suggesting that my estimate was not far off.
The cost of this mistake should rightly include:
-
the cost of people struggling with stateful sessions when they would have been better served by using the stateless session, and
-
the cost to people who actually gave up on Hibernate and JPA and went and used something else they were more comfortable with, even though it surely caused them more work in the long run.
Since (1) is much easier to estimate than (2), I’m going to focus on it, even though it’s perfectly likely that (2) is larger.
(Note that I’m not saying that stateful sessions are always terrible; in many common scenarios they’re great, and are what the majority of developers ask for.)
Our estimate can be broken down to three parts:
-
The number of actively-developed projects per year which bore at least some cost from under-using
StatelessSession
or from not using it at all. I would say:-
103 seems clearly too small, given what we know about the level of usage of Hibernate;
-
105 isn’t completely implausible, but I can’t be sure;
-
so, conservatively, let’s say 104 projects.
-
-
The average cost per year to each of these projects. Here:
-
$103 is a day’s work for a single developer—that’s too small, if it were this tiny, nobody would care, and we wouldn’t be having this discussion;
-
so, conservatively, let’s say $104/project/year. If you’re the kind of person who really hates stateful sessions (there’s not a few of you), you might be inclined to increase this factor.
-
-
Finally, we integrate over 25 (that is, 101) years.
Multiplying this out gives us $109. Ouch.
Perhaps you think one of my factors here was overestimated by an order of magnitude. Maybe. But that still leaves $108 and that’s still much more than enough for me to give myself a good hard kick. Some might even think I’ve underestimated (2). Let’s hope for my sake that’s not the case, because a 10 billion dollar auto-kick has got to hurt!
Of course, the benefits that Hibernate and JPA have provided to so many projects over the years far outweigh the cost of this mistake, so perhaps the kick is not fully deserved.
The point of this post is that what we do as software developers matters, and when we fuck up it imposes real costs. Even relatively minor mistakes can come with a heavy price tag after integration over time.