Haste makes waste

When I was in university I attended a couple of semesters of psychology. One of things that made the strongest impression on me was a graph the professor showed of human performance vs. motivation.  I googled around a bit to see if I could a copy of the curve, and I came across the following, which offers a little more interpretation than my psych prof. did, but does an excellent job of communicating the point.  It comes from an excellent post  at psyprogrammer.com.

 

.human-performance-curve

 

As I understand it this curve comes originally from studies on factory productivity.  While it’s difficult to obtain bulletproof data on more difficult to quantify tasks like programming, my take from the psych lecture was that this curve extends pretty universally across all human activity.  This is not only matches against personal experience well, but seems to be pretty well accepted by the scientific community. An interesting aspect of the curve is it’s assymetric nature. Being slightly undermotivated has significantly less negative impact than being overmotivated by the same degree.

It’s an unfortunate truth that most people in managerial roles are woefully unfamiliar with this graph.  They typically overwork both themselves and their employees, to the detriment of productivity, all the while taking a macho sense of pride in how hard they work.  I can’t tell you how often I have heard people bragging about the excessive number of hours they work, while the rest of us groan under the weight of their emotional instability, error-prone work, and poor judgment.

Even when employees are disciplined about working reasonable hours, getting sufficient rest, and maintaining a positive work-live balance, excessive demands take a toll on productivity and this is no less true in the case of software development than it is any other task.  Software development is a kind of craft, in which intellectual discipline, creative thought and disciplined craftsmanship must all be combined to provide optimal results.    Managers who seek to whip their development teams up into a frenzy of panicked development wind up destroying their teams productivity.

I have all-too-often found myself in the position where management comes by the development teams on a regular basis to tell them “If we don’t develop feature X in time Y, we will go out of business.  The fate of the company is in your hands!”  Typically X and Y vary heavily, even within the same project, sometimes over very short time intervals.  Every time I have found myself in this situation, the deadline has been missed, and the company survived.  Besides resulting in skepticism and distrust in management, this has some very harmful effects.

In the best case, the programmers ignore the dire warnings, maintain a zen like attitude to their work and continue to strive to perform to the best of their abilities.  In this case the only harm is destruction of trust in management.  I’ve never actually seen this case,  but it is a theoretical outcome.  In the worst case people take the warnings/threats seriously, start hurrying production, and start sacrificing their personal time to the goals of the project.  Shortcuts are taken and technical debt is accrued in an attempt to make short term goals.  Developer get stressed and start to resent design discussions, make the discussions longer and less fruitful.  Developers get tired and their judgment and emotional equilibrium is impaired.  Stress leads to strife and illness.  In their haste developers stop taking time to mull their algorithms over, and errors creep in.  The time it takes to fix these haste-bred bug dwarfs the time it would have taken to calmly develop a correct implementation, which spirals the project further in stress, cynicism and despair.  Stressed out workers get sick, and feel pressured to work anyway so they infect their stressed coworkers leading to more unproductivity.  Eventually the project collapses under the weight of exhaustion  mistakes,  strife, and technical debt.  Actual results tend to fall somewhere in between these two extremes, but heavily weighted towards the latter outcome.

I meditate regularly.  I read books on Zen and try to set what I learn into practice.  I exersize religiously, eat healthy and have a very happy relationship.  Still I find myself slipping into unproductive stress levels when harangued by emotional and irrational managers.  Today I spent about an hour tracking down and debugging a completely moronic error.  I had written the following code:

/// if there is a next element, and it should be written, write a ",\n",
/// otherwise write a ;\n"
m_fstream << (( (i+1 < res.GetSize()) && shl::is_a_supported_type(res.GetItem(i+1).GetChoice()))?",":";")
<< "\n";

It actually does exactly what the comment says does, but it should in fact only write a semicolon if we are at the end of input.  This bug crept in under precisely the conditions I described above:  a manager ranting and raving on a daily basis about how we would go out of business if this feature wasn’t implemented yesterday, and why the heck is it taking so long and so on.  I was chastised for spending so long testing the code which was delivered, but the above bug wasn’t detected for two weeks, which implies that no-one noticed the error for two weeks.  Since this bug prevents data from being successfully loaded to the client application this casts a bit of doubt on how urgent the update really was.  In any case we still have to re-build and deploy the bug fix to the customer before he can use the feature, which means another hour or two of developer time, and a total of about 3 weeks of delay for the customer.  All because I felt stressed enough to get out of my zone and make a completely stupid mistake I would never make under less hurried circumstances.  Doubtless this is not the last such bug I will discover either.

All of this is an avoidable phenomena if one understands the relationship between motivation and performance.  If you really care about doing your best work, you won’t let yourself get overmotivated (stressed, hurried), and will try to keep yourself in the optimum zone.  Sadly this is terribly difficult if your manager is a stress junkie who perceives health productive workers as undermotivated.

 

“Standardize” is not a synonym for “improve”.

When I was working for a mega corporation, one of the recurring battles that I had to fight was the standardization battle. The assumption was “if a little standardization is a good thing, then a lot of standardization must be even better”. Of course this is simply not true. Excessive standardization stifle’s creativity, decreases productivity and increases risk. Standardization is a useful tool to increase productivity where it appropriate. But just as you shouldn’t hammer in screw, there are places where you think about deregulating. not standardizing.

Recently I found myself in a conversation with a new coworker who asked me “So what are you standardizing?” (out of the blue, no context). I was a bit mystified and replied that I wasn’t standardizing anything, I was developing code. On a separate occasion he asked me if I had any ideas how we could “standardize our testing”.

One of the sad truths at my current workplace is we simply don’t have enough testing going. We need to improve our testing. We need to extend it. We need to develop it. We don’t need to standardize it though… what good would that do?

To standardize something is to take something is inhomogeneous and make it more homogeneous. This is a useful technique — for example standardizing communication protocols and power outlets has been a tremendous boon. In a software shop that is just doing chaotic testing you don’t start with the question “how can I standardize this” you start with the question “how can I improve this”. It may be that developing standards is a one of tools you use, but it may not be. In our shop we have three teams — a back-end team, a middleware team, and a front-end team.

For the back-end team we need more unit tests, automated functionality tests, and automated integration tests. We don’t really need any manual test execution. For the front-end it’s quite different. There we need a database of manually run usability tests, most of which will probably have to be executed manually. This means that even the testing schedules will likely have to be quite different, meaning standardization will probably only play a small role, although formalization might play a larger one.

So all of this went through my head when the question was asked and I replied “Standardization is wrong word. We need to improve our testing. We are working on that.”. The disturbing thing in the conversation is the realization that the word “standardization” seems to have lost its very specific meaning. I suspect that when managers and executives get in a room and someone says “We have standardized our testing”, everyone responds “bravo, well done”, rather than asking the obvious question — “what benefit did the standardization bring?”.

Considering that:

  •     It’s best practice to do warning free builds.  Those harmless warnings you are ignoring could be hiding an important warning that’s bugging up your code.
  •     Recent version of GCC support disabling of specific warnings.
  •     Sometimes we use external libraries which we trust, or must accept — we don’t want to muck around with their internals — say for example the boost libraries.

Given these points, when we include a header which creates warnings, we’d like to disable just those warnings, for just those header files.  This can be done with the following statements for the GCC compiler:

#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wswitch"
#include <tl_base_data.h>;
#pragma GCC diagnostic warning "-Wswitch"
#pragma GCC diagnostic warning "-Wparentheses"

This comes up often enough I cranked out a trivial bit of elisp so I can do this in emacs a bit more automatically:

 

; @todo let this work if we have a range too.
(defun insert-pragmas (pragma-name)
"Wrap the current line with a pragma to disable the warning."
(interactive "MWarning to disable: ")
(if (string= "" pragma-name)
(message "ignoring empty pragma name")
(move-beginning-of-line nil)
(insert "#pragma GCC diagnostic ignored \"-W" pragma-name "\"\n")
(move-end-of-line nil)
(insert "\n#pragma GCC diagnostic warning \"-W" pragma-name "\"\n")
)
)

Trayvon Martin

My response to the Trayvon Martin verdict has been complex. I didn’t follow the case closely, having read primarily superficial discussions of the case until that point. When I heard about the verdict I was disappointed but not surprised. When Rodney Kings attackers were acquitted I was shocked and surprised. The Zimmeran verdict shows that white America hasn’t gotten much more civilized. I think one could argue that black America has, since the response from black Americans has been reasoned and reasonable. One can hope it will effective as well.

I found some of the response worth commenting on. William Saletan wrote an article on Slate titled “Your Are Not Trayvon Martin”, which I found particularly disturbing.  His thesis is that:

The problem at the core of this case wasn’t race or guns. The problem was assumption, misperception, and overreaction. And that cycle hasn’t ended with the verdict. It has escalated.

He goes on to explain that Zimmerman wasn’t a racist, that the whole thing was a stupid sequence of event based on fear, overreaction and misperception.  All of the latter points would seem to be factually true.  Whether or not Zimmerman is a racist is a bit more of a difficult question.  Standards as to what constitute being a racist change over time.  Behavior an opinions which would have been considered egalitarian and progressive in 1892 would be considered backward and rampantly racist today.  The evidence does suggest that Zimmerman is no self-identifying racist longing for the glory days of slavery or the clan… but he would seem to be a racist to the extent that he finds a black teenager walking down the sidewalk in a hoody scary and suspicious.

Zimmerman’s attorney mad the assertion (28:02 of the video below) claims that Zimmerman would never have been charged with a crime, had Zimmerman been black. That’s an interesting assertion. Had Zimmerman been black and killed Trayvon Martin, would he have been charged? I don’t know. But I think we should ask ourselves some other questions:

  1. If Trayvon had been white, and Zimmerman black, what do you think would have happened.  The statistics would suggest the death penalty would be likely.
  2. If Trayvon had been white, would Zimmerman have acted as he did?
  3. Put yourself in Travon’s situation:  You’re walking to a friend’s home wearing a hoody and carrying a bag of skittles and soda pop.  Some guy starts giving you a hard time, so you run away.   He runs after you.  You defend yourself and he shoots you dead.  Wouldn’t you want the justice system to take some action against the guy?


I think it’s exceeding naive to think that race, prejudice and racial profiling had nothing to do with this sequence of events.  I’m annoyed at journalists’ attempts (like those of mr. Saletan) to dismiss people’s efforts to address the problems that black people still face in America.  People, including my white self, are angry and frustrated at this outcome and what it says about our society.

Our unwavering defense of Israel

Predictably, Jay Carney defended Israel’s recent strikes against Syria. The defense was the usual one:

“The transfer of sophisticated weapons to terrorist organizations like Hezbollah is certainly a concern and a threat to Israel, and they have the right to act in their own sovereign interest on … in response to those concerns.”

I like to play the universality game, applying our governments foreign-policy standards uniformly. So let’s pose a hypothetical: Advanced firearms being exported across the border to Mexico are a clear threat to Mexico, arming the drug cartels to the extent of being a threat to both the Mexican people and the Mexican state.

What would Carney say if Mexico started bombing firearm stores in Texas that are known to be providing weaponry to the drug cartels?

If anyone ever runs into him at a party, let me know what he says.

Slow Food

There’s a fantastic interview with Micheal Pollan about the Slow Food movement, that is completely worth watching:

I found the entire thing fascinating, but I was especially inspired by the protest organized by Carlo Petrini’s fantastic protest against McDonalds.  I think we should try to make a protest like that a tradition — once a year organize a pot luck against fast food.

gnu global, getting gtags to treat .h files as C++

I’m still experimenting with tagging in Emacs.  I think my current favorite is using gnu-global.

Unfortunately I just joined a team where all their c++ header files start with .h.  By default gnu-global treats these as c, and results are poor.  While I think there’s a more sophisticated way to handle the problem, I just use:

export GTAGSFORCECPP=””

Sponsor a Walmart Striker

I can’t think of a worse example of the failings of our economic system than Walmart.  Virtually everything that’s wrong with our economy is wrong with Walmart, typically to an extreme degree.

Walmart rules the “price is everything” universe, often by selling poor quality merchandise, poorly suited to its purpose.  Other times by selling the same merchandise available elsewhere, made cheaper by virtue of mass purchasing power, and exploitation of its workers.

In the eighties and Nineties Walmart spread like a cancer from small town to small town.  At first towns rejoiced at the arrival of Walmart with their huge stores, huge selections and cheap prices.  Gradually people awakened to a disturbing pattern however:  where Walmart went, small locally owned businesses died.  Once a town had a Walmart, your only job opportunities were Walmart jobs, which pay so poorly you can barely afford to shop at Walmart, let alone at a small locally owned business.

Now Walmart workers are fed up, and they are organizing.  They are planning a walk out on Black Friday, which is simply a brilliant idea.  The thing is, Walmart workers lead precarious lives, economically speaking.  Missing out on a day’s pay hurts.  That’s where we can all help.  You can sponsor a Walmart striker.    The organization page is here, and the donation page is here.

The Romney Video

I try not to follow the presidential race too closely, as I consider it the junk food of democracy:  addictive, but not very nourishing.  I was delighted to see the video of Mitt Romney showing his disdain for the working class get some traction in the mainstream press though.

Some months ago, Switzerland had a popular vote whether to increase the mandatory vacation time large firms offer their employees from 4 to 6 weeks.  One would think that such a bill would have been an easy win, but there was a very successful, well funded fear campaign against the initiative, which was based on the threat that longer vacation times would mean Swiss companies would become less competitive,  leading to more unemployment.

I was sitting in our employee cafeteria listening to one of my fellow working-class schlubs parrot this particular line of thought.  I told him that his analysis was based on poor assumptions.    The primary false assumption here is that employees who work less are, by definition, going to be less productive.  This is of course a false assumption.  Research has shown that stressed, overworked employees make mistakes and are less productive than well rested employees.   There are relevant and perhaps important debates which should be had on this subject, such as:

  • Do the Swiss labor laws create conditions of maximum productivity for employees (i.e. finding the perfect balance between stress and productivity)?
  • Should our legal system strive to create conditions of maximum productivity, or should we be striving for other goals, like work/life balance, or a healthy, happy society which has time to care for its health, children, culture, the elderly, and the environment?

I went on to tell him that the fact that the advertising campaign relies on fear, instead of a rational assessment of causes and effects, is a pretty good sign he should be skeptical.  Further, it’s well known that inside Europe, the Swiss relatively poor conditions:  longer working weeks and fewer vacations.  It’s also a common theme that stress-related illnesses cost the Swiss society and the Swiss economy enormously, and are considered a real problem.  Given these facts, there is reasonable evidence to think that a little extra holiday time might actually be good for the Swiss economy.

His response to this was the following question:  “If that’s true, why is every other country working to decrease holiday time and increase working hours?”.  I told him that that was precisely the question he should be asking.  If only the Romney video were available at that point, I could have pointed to it as evidence of the obvious answer:  because those countries are being run by wealthy people who feel like they should make a living simply by owning things, and those people have nothing but contempt for working people.

 

 

Penny-wise, pound-foolish

One of my frequent frustrations working for a large corporation is penny-wise, pound-foolish policies. Examples abound, but one annoys me at sufficient frequency and intensity to comment on it.

I have to print documents for reading or reference on occasion.  Often I would prefer to read them on my tablet, but my companies various security policies prevent me from doing so.  Working around the security policies would put me at risk (in terms of breaking company policy, not in terms of actual security), and would be time-consuming.  So I wind up printing them out.

Being an environmentally conscious guy I do so double sided, and generally 2 pages per side, so as to save on resources.  Typically the stuff I have to print out has some syntax-highlighted stuff, and maybe some figures with a little color in them.  Typically the color is sufficiently valuable that is worth reading it in color — The increased efficiency in understanding the content easily pays for the costs of the color.

But printing in color is more expensive than printing in  black-and-white.  Managerial classes do a lot of printing, and work with a lot of superfluous color: Big bold headers in color for visual style, pie charts, shit like that.  So in their wisdom, they have reasoned  that making all printing have the default to print to grayscale will save the company money.  As a result, whenever I need to print something in color (the usual case), I have to go through an annoying series of clicks to enable color printing.  Each time costs me a a minute or two.   When I haven’t done it in a while I lose a few minutes going over the gui trying to find the relevant fields to click.  Being a large corporation, this waste of time and energy is occuring hundreds of times a day.  That’s hundreds of minutes of time being lost.

The worst part is the psychological impact.  The company went to extra-expense to make it inconvenient to manually select color or b/w, because they don’t trust us enough to do it for ourselves.    Our time and concentration are disparaged as being worth less than the cost of a small amount of color toner.

Because we we can measure  the cost of printing supplies, we register cost-reduction.    The decreased productivity, reduction in employee satisfaction, and the ensuing increased turnover are puzzled over, but occur with a time-lag so connection are not made.    This pattern reveals itself again and again.