Tab v Space

Coding

Many years ago, a work colleague/friend and I had a disagreement over the use of tabs and spaces in software source code. At the time, my preference was to indent my code with two spaces as I often had complex nested operations that would vanish on the right-hand side of my screen if I were using the conventional 8 spaces.

Indenting with 2 spaces:

while ( unopenedThingsExist() ) {
  for ( eachThing in theCollection ) {
    with ( opened ( eachThing ) ) {
      if ( lookInside ( eachThing ) == something ) {
        display ( nameOf ( eachThing ) );
      }
    }
  }
}

Indenting with 8 spaces

while ( unopenedThingsExist() ) {
        for ( eachThing in theCollection ) {
               with ( opened ( eachThing ) ) {
                        if ( lookInside ( eachThing ) == something ) {
                                display ( nameOf ( eachThing ) );
                        }
                }
        }
}

His well-reasoned argument for using tabs was that other people with different width screens could simply tell their development tool of choice to render tabs as 4 or 8 spaces, or whatever was their preference. I adjusted my tools to replace the double-spaces with tabs, and all looked well, until it was pointed out to me that after the adjustment, comments to the right were a mess:

while ( unopenedThingsExist() ) {                    # guaranteed to end
  for ( eachThing in theCollection ) {               # collection is not empty
    with ( opened ( eachThing ) ) {                  # once opened, stays opened
      if ( lookInside ( eachThing ) == something ) {
        display ( nameOf ( eachThing ) );            # guaranteed not blank
      }
    }
  }
}

becomes:

while ( unopenedThingsExist() ) {                                        # guaranteed to end
    for ( eachThing in theCollection ) {                              # collection is not empty
        with ( opened ( eachThing ) ) {                                    # once opened, stays opened
            if ( lookInside ( eachThing ) == something ) {
                display ( nameOf ( eachThing ) );                        # guaranteed not blank
            }
        }
    }
}

Thus came about my general rule about tabs and spaces in source code:

Tabs on the left, spaces on the right.

To be precise, all the blank space from the left up to the start of the code should be tabs, and from that point on, all blanks are spaces. With this rule we get the following:

while ( unopenedThingsExist() ) {                    # guaranteed to end
    for ( eachThing in theCollection ) {               # collection is not empty
        with ( opened ( eachThing ) ) {                  # once opened, stays opened
            if ( lookInside ( eachThing ) == something ) {
                display ( nameOf ( eachThing ) );            # guaranteed not blank
            }
        }
    }
}

While this approach produces a better, albeit indented, alignment of the comments on the right, it doesn’t maintain the precise vertical arrangement of the original. Is it possible to preserve the vertical alignment of the comments? Yes, but not without some awkward mix of tabs and spaces. To achieve a vertical alignment that can survive a change of tab width, first you have to determine the maximum indenting expected in the source code. In the example, this maximum is 4 tabs (the “display” line). Next you have to ensure that this many tabs are present on every line, with the first tab(s) before the source code, and the remaining tabs after the last character of the source code (before the spaces that occur before the comment). For example, the second line of the source would be arranged as follows:

[**]for ( eachThing in theCollection ) {[**][**][**]        # collection is not empty

That’s one tab on the left, and three tabs to the right of the final “{“. With this use of tabs, the vertical alignment of the comments will be preserved regardless of how you set the tab/space equivalence.

while ( unopenedThingsExist() ) {                            # guaranteed to end
    for ( eachThing in theCollection ) {                     # collection is not empty
        with ( opened ( eachThing ) ) {                      # once opened, stays opened
            if ( lookInside ( eachThing ) == something ) {
                display ( nameOf ( eachThing ) );            # guaranteed not blank
            }
        }
    }
}

However, this would require a level of discipline with the input of invisible characters that I doubt any coder could achieve.

Optimal solution

There is an optimal and far superior solution, but it involves getting rid of two ideas: 1) tabs can be replaced by N spaces and 2) tabs align vertically with a multiple of N spaces. These two ideas come from the old fixed-width printers and screens. The printer tabs were a particular influence, and are not the equivalent of “tab stops” as found on typewriters, which are more like the tabbing positions you find in wordprocessing applications (e.g. MS Word).

By using a tab stop approach, you can continue to use tabs on the left for indenting, but on the right the tab character is interpreted semantically to indicate that you are moving to a new “block” of content. The tab is used more like an indication to move into the next cell of a table, rather than moving a certain number of characters to the right. This approach, outlined in detail by Nick Gravgaard in the mid-2000s, was adopted in Go’s tabwriter and a Notepad++ plugin, and Nick’s own extension for VS, but most IDEs don’t yet have this feature. Eclipse doesn’t have the underlying rendering features to support tab stops, while Netbeans could support it via its Swing components but nobody has created a plugin for it.

So, until tab stops come to all the IDEs that I use, I’ll stick with “tabs to the left, spaces to the right” and hope for the best.

Rules

Legal and Political, LUE

In my neck of the woods new rules were introduced from midnight that ban family gatherings, social events, allow only one visitor to our home and require us to stay within our county (radius 20km) with few exceptions. This is the middle of five levels of restrictions designed to limit the spread of  SARS-CoV-2, the virus that causes CoViD-19, which spilled into the domain of humans sometime around the end of last year. About 30 million worldwide have contracted the virus, two-thirds of those have recovered (to varying degrees) and about 1 million have died.

A viable vaccine might be developed in the next 9 months (based on the many mid-2021 estimates), so this could be the half-way point. We still have the challenge of mass manufacturing and distribution of that vaccine across the planet, which could delay the return to some kind of “normal” until the end of 2021.

In the meantime we have rules. Many rules. Frequently changing rules.

Our first taste of the rules happened at the beginning of March when a school was closed around the time of the first confirmed case of the virus. The following day, Google sent 8,000 employees home. That was just a case of someone having a “normal” infection, but the company wasn’t taking any chances. The next few days saw a rapid rise in cases, and within a week the projections were that without containment measures half the country could get infected.

Shortly after these projections were revealed, a decision was made to cancel all the parades celebrating the national holiday.

Then someone died.

The next day, rules were introduced nationally that closed schools and childcare facilities, and there were various advisories regarding travel into and out of the country.

Another death.

This time they closed the public houses, which was seen as such a monumental ruling that it made the news around the globe. Many of these social hubs had already decided to close, believing (correctly) that keeping their patrons alive outweighed keeping their thirst at bay. Most of these establishments have stayed closed, permanently in some cases due to going bust. Many other businesses would follow suit as the rules kept on coming.

They speculated the crisis might persist into the summer. Now we think it might last another year.

The government continued to introduce rules as the consequences of new infections unfolded. This had two unfortunate effects: first, it risked creating the impression that the rules were purely political decisions, and second, it created confusion because the rules did not remain stable long enough for people to become familiar with them.

To deal with the problematic perception of political motivation, the situation regarding the virus and the country’s response was presented and explained first by the medical leaders. Only when the bad news was presented (and it’s almost always bad) would the politicians step in to put into effect the recommendations from the specialists. Meanwhile, in a country not far away, their prime minister was the one delivering the medical news and the rules that followed, which definitely made the whole thing look like pure politics.

Statements from the medics, interspersed with proclamations from politicians, became increasingly frequent, to the point that by now it’s all a blur. In an attempt to put some distance between the medical advice and the consequential political decisions, our government has introduced a pipeline of steps that goes something like this:

  • The national public health emergency team (NPHET) provides medical guidance.
  • A Covid-19 “oversight group” with a mix of senior medical, civil service and political representatives meets weekly to consider NPHET advice.
  • Recommendations from the oversight group are passed to a Cabinet Committee (comprising government-appointed ministers) where, chaired by the head of government, plans are finalised on what new responses (i.e. rules) will be needed.
  • There are five levels of alert, from the basic level 1 to the most restrictive level 5. The Cabinet Committee decides what level is assigned to the country or individual counties.

The downside of this plan is the time between NPHET’s guidance and the government’s Level decisions. Once the public hear what NPHET is suggesting, the people know they have just a day or two before new rules come into force, and in the intervening time they go a bit nuts. Instead of thinking: “the experts say that having a party is dangerous”, they think: “we have just two days to have a party, so let’s get everyone together!” Crazy.

At least our government’s decisions come into force within hours, whereas across the water their government decisions often don’t come into force for several days. And they wonder why things go barmy…

In addition to the local and national rules, we also have to deal with international rules, such as those from the European Union. Soon the EU will be releasing its own set of rules regarding cross-border travel. We have been using our own “green” list of countries considered “equally safe” (AKA “equally dangerous”) to determine if passengers need to isolate after travel. This list will be replaced by the EU’s “traffic light” system. This proposed system will hopefully deal with the problem of political reciprocity where one country puts a second on its red list in retaliation for being so listed themselves. The EU-wide alternative would see such lists determined by scientific/medical assessments, independent of political sensitivities.

We’re half way through this pandemic and in addition to facing the virus itself, we are faced with seemingly endless rules. The aforementioned systems introduced by national governments and international structures are worthy, but also wordy. The rules apply to everyone, but they are excessively complex, and necessarily changing, so what hope is there for the ordinary citizen to follow them, to understand them, or even be aware of them?

Simplicity is key. The medical, civil and political institutions will have to do better with their communication. Dozens of pages of legalise, diagrams, charts and numbers will not communicate to the people that matter.

My rule is simple: when in doubt, don’t go out.

2020 vision

LUE

We’re just around the half-way point of this year, and looking back it’s clearly been nothing short of truly awful. Three months ago, at the “first quarter” mark, I was offering a practitioner’s perspective on working from home (WFH). In the past few days some businesses have started to reopen, though the advice remains to WFH if you can, with very good reason as these depressing numbers will explain:

  • Over seven million infections confirmed (two million of whom are in the USA).
  • Over 400,000 dead, a quarter in the USA.
  • USA, Ireland and the Netherlands have the same per-capita death toll (~0.035%, or 350 per million[1]).
  • UK toll is 620 per million, Italy 560, France 440.
  • Half of the workers on the planet (~1.6b) are at risk of losing their jobs[2]. (Millions already have!)

With this kind of catastrophe going on you’d think there’d be no capacity left in humanity to make matters worse. But there you’d be wrong because we seem to have this knack when stuck in a hole to keep on digging:

  • Worldwide protests against colour/race-based discrimination by authorities, prompted by the dreadful public death of man being forcibly restrained under the knee of a law officer in Minneapolis[3].
  • Brexit has reared its ugly head once again, and we’re all charging towards that light at the end of the tunnel, to turn it off[4].
  • International economic sanctions; breakdown of the Korean détente;  awkward situation at the India-China border etc.

Finding any good news is increasingly difficult. Yet somehow with perseverance there are flickers of hope. Take that last item, the India-China standoff. As I type, I can see reports that the two sides have reached some agreement and tensions are de-escalating.

While Brexit is a constant thorn in the side of most Europeans (which includes the UK, the EU and nearby countries), it looks like Borris and Ursula are going to have a serious conversation in a few days as the deadline for agreeing an extension looms[5]. Fingers crossed.

As for the pandemic, the near universal decimation of our economies and the growing death toll, the figures show a gradual decline in cases and many countries are already easing their protective measures. The Americas, north and south, still have some way to go, though their piecemeal, almost apathetic responses in some cases will undoubtedly see a prolonging of unnecessary suffering. The curve is flattening where best practices have been established and work on rapid detection technologies, vaccines and anti-viral treatments are having incremental successes.

A usable vaccine or treatment could be 1-2 years away, and even that would be an amazingly quick result. In the meantime, we take all the precautions we can and try to keep life, business and society in general ticking along, even if it’s at a pace so diminished it’s unrecognisable. If it turns out to be a better world, I won’t be too bothered about not being able to recognise it.

[1] https://coronavirus.jhu.edu/data/mortality (2020-06-11)
[2] https://www.ilo.org/global/about-the-ilo/newsroom/news/WCMS_743036/lang–en/index.htm
[3] https://en.wikipedia.org/wiki/Killing_of_George_Floyd
[4] https://www.cnbc.com/2020/06/11/brexit-no-deal-concerns-grow-as-lockdown-lifts.html
[5] https://www.bbc.com/news/uk-politics-53012383
[6] https://www.irishtimes.com/life-and-style/health-family/covid-19-the-latest-on-vaccines-antibody-tests-and-treatments-1.4264937

WFH

Business, LUE

What-the-FHappened?

It’s natural to be a little lost when a familiar context is completely altered, as has happened to millions (!) of people around the world in the past few months as a result of this truly awful pandemic. Three weeks since the WHO’s declaration, there appears to be an abundance of “experts” offering advice on how to “work from home”.

I’m not a WFH expert, merely a practitioner with decades of experience and while this may seem like an opportunity for many people around the world to show just what can be achieved by a WFH workforce, it’s really not.

For one thing, in almost all cases there was no proper planning. A workforce that suddenly has to work from home is not usually on the business continuity radar.  Shouldn’t this be part of “building availability” contingency? Yes, but typical answers to this challenge involve moving to another building, preferably nearby and similarly equipped. So unless you have very deep pockets to reserve an emergency hot-office (as some banks might), you’re not going to be able to deal with the case where almost every office building on the planet becomes unavailable.

As the virus spread across the world, many office workers were given mere hours to decamp to their homes as governments announced lockdowns (or variations on that theme). This ad-hoc introduction of WFH had people suddenly facing all kinds of problems, including:

  • Everything in the office is not necessarily accessible from home, including all that paperwork in the filing cabinets. (Yes, paper still exists!)
  • You’ve been promised but not yet received a laptop replacement for your office desktop computer, so now you have to haul that old lump of metal home. On the bus.
  • Your house uses wifi exclusively, but not your lump of metal PC, so now you will have to go buy a length of ethernet cable at the computer store. Which is shut.
  • What’s a VPN?
  • Your asymmetric home broadband seems fast enough to download the office files, but is taking forever to upload the edited versions.
  • Everybody seems to have their own idea of what is the best video conferencing solution.
  • Residential networks were not built for this level of traffic.
  • Some staff live on the lee side of the mountain away from the mobile phone mast, so to receive emails they have to stand on a bucket at the top of the mountain holding the phone in the sky. In the rain.
  • Nobody has ever explained how to do more than a few days working from home, so by day three everyone has gone completely bonkers. Meetings – for those who figure out how to attend – are haphazard at best and nobody knows where anything is located any more.

The list goes on and on. Some of these problems don’t have answers. If you need the paper files in the cabinet, and the cabinet is still in your shut down office, tough. Some problems take some ingenuity. For example, your lump of metal PC with no wifi antenna could connect to your home wifi access point by sharing your mobile phone’s wifi connection via a USB tether.

Consequently, this is not the great “let’s show what WFH can do” experiment that many have dreamed of. This is more the nightmare that goes: “let’s reveal all the WFH problems!”

Nevertheless, thanks to an overwhelming desire for people to share stories of accomplishment in the face of adversity, in time most of the solvable technical problems will be solved.

In the meantime, I offer some practical suggestions based on years of personal experience, though be warned that this might not align with the “expert” advice you see elsewhere. Naturally your mileage may vary.


WFH : A practitioner’s perspective

Mark your territory. This is important. Do it on day one. Say “this table is mine” and defend it night and day. This territory, wherever and whatever it is, will be where you work. When you are not within the boundaries of your territory, you are not working. Make sure people know this. Make especially sure that you know this.

No meals in the work territory. Seriously. Have you looked inside your keyboard recently? Eat elsewhere, and since elsewhere is not the work territory, you do not work while eating.

Dress for work. At least from the waist up. If your attire has no bearing on your work, wear whatever is comfortable. Sometimes attire can be a useful signal to others around you that this is your work time, which hopefully reduces interruptions. For some, changing attire at the end of the day is a signal to everyone (including yourself) that work has ended.

Put in the effort, not the hours. It’s a sad fact that much of our work is measured in time. I prefer to measure in results, so my day tends to start with a rough idea of what I want to achieve and how much effort I expect to put in. Normally that keeps me busy for hours, but when those hours take place can vary considerably. If I hit a mental block, I just pause, leave the work territory, go do some non-work (e.g. walk to the post box), and then resume the work with a clear head. Sometimes, often in fact, my work starts to flow so I go along with it even if it means working longer hours. In such cases I will have stored up extra results so the following day I can take a little easier, maybe an extra long coffee break.

Reserve certain periods. You need some regular clock hours if you are going to work with a team of (remote) people. In that case, let everyone know what periods you will be available, and what periods are off-limits. Your co-workers, clients, suppliers and anyone else you interact with need to understand that in addition to working from home, you also live at home. They cannot assume that because you are at home you are also at work. The French have the right idea. If you are contacted during living time instead of working time, defer until it is appropriate to be working again. (Use your judgement, of course, emergencies happen!)

Remember to move regularly. The typical office scenario has a certain ebb and flow to it, and you can adjust to that rhythm quite quickly. Breaks are an important part of the rhythm so a healthy office environment will encourage you to take breaks regularly. In the WFH scenario that rhythm can be lost, and you could find yourself buried in work for hour after hour without noticing, taking no break, ruining your posture and eyesight. Stand up. Look out the window. Stretch.

Regulate your distractions. I’m a news junkie. Maybe sports results are your thing. Or cats on YouTube. Whatever is your preferred distraction, make time for it. Like the short walk outdoors, this can be a short walk for your mind. Just remember to regulate it, so that you have specific time allotted during which you are not working and you can compensate for these periods elsewhere in your day. It’s one of the few advantages of WFH that you can do whatever you need to recharge your batteries, and it pays back in better efficiency and less stress (unless your news/sports is going pear-shaped).

Separate concerns. Many work activities involve sensitive information. If you are doing that kind of work, keep it completely separate from any of the non-work activities you do. So if you want to look at cat videos, leave the work territory and use another device.

Talk to someone every day. This, my final piece of advice, is important. WFH means you are not in an office with people physically nearby, and your work could be the kind that can be done from daybreak to sunset without ever needing to say a word to anyone. Email, code checking, push notification, IMs etc., are all quite practical and efficient, but we are not robots and without some human contact we can quickly lose our bearings. So at least once a day, make contact by voice. Add video if you can. And for at least a few minutes of that call, talk about trivia like normal people do at the office. It’s good for your mental health.


This period of WFH has been imposed on so many people around the world and it could be this way for many more weeks or months. When it’s all over, and it will be over, most of the new WFH people will go back to the office. Some might discover that WFH works better for them, and continue that way. Others will be just glad to get back to something akin to normal. In the meantime, guard your territory!

Consulting

Business

I’ve been a tech consultant for several years. Having come from a long history of CxO-level roles, head-of-this, chief-of-that, chair-of-the-other, I find myself, for the first time, alone. I still have busy days engaging with people, my inbox is as hectic as ever, the IM pings are continuous and my schedule isn’t pretty. Working in teams is something I miss but I’m fortunate that many of my most trusted colleagues have remained in touch. Travel is a thing of the past, thankfully (as it was becoming tedious). There’s nobody to whom I can delegate and nobody to whom I must report other than my clients.

During a recent meeting with some people at a government agency that is tasked with providing advice and tangible support to small businesses I was reflecting on the nature of my role as consultant. They remarked on something I’d observed over the years: great business leaders will recognise their limitations and reach out for help. In the larger companies, that help can often come from within. For the smaller companies, they have to look outside. This is where these government agencies and occasionally consultants like me come into the picture.

Mine is the advice/opinion kind of consultancy, not the executive kind that involves management/oversight. Offering advice is hard work. “Well, he would say that, wouldn’t he?” I look at where a company is, and where it wants to be. Then I ask some probing questions. Then I listen. Followed by some research, probably some more questions and finally I offer reasoned suggestions to get the company from here to there.

Listening is the hardest part. It consumes a lot of time. It’s also a part of the process that I really enjoy because I learn so much. Sometimes a round-table session with the company’s senior staff is the first time they’ve collectively tried to explain to an outsider what they do and how they do it. Such a session can be an opportunity for staff to learn more about the operations of other functions in their company. The CEO is usually involved in these meetings, and will often find them enlightening.

It has taken decades for me to acquire the knowledge and experience to do what I do. I’m so glad to see the positive impacts that result, and I look forward to continuing this work for years to come. Onwards and upwards!