• LIBTYFI – Leave it better than you found it

    LIBTYFI – Leave it better than you found it

    Some of my fondest memories from childhood are the times my dad let me tag along on his weekly trips across the expanses of Northern Ontario in his 18-wheeler. As you might imagine, a daily ritual on these trips was one of washing up in some dingy restroom1 before eating a greasy breakfast (“two eggs sunnyside up, bacon soft, rye toast please”).

    All these years later, the biggest lesson that stuck with me was “leave it better than you found it.” In other words, not only “clean up after yourself,” but also “clean up the mess you found.2” After all, the next guy’s going to appreciate a clean space to start his day.

    Old code is like a dirty truck stop restroom.

    As part of working on code guidelines for my day job, I read a bunch of the code standards and adjacent posts. None of the documentation, blog posts and idioms (DRY, KISS, etc) really touch on legacy code. I suppose it makes sense since they are generally aspirational documents. At the same time, I think these documents are incomplete without touching on it.

    As programming languages and platforms mature and fads of the moment fad away, it’s becoming more and more common for developers to run into old code. Maybe even code that’s predates code standards in a given language. This is certainly the case in my day-to-day.

    While it’s relatively straightforward to install IDE tools to format you code properly and keeping it simple can be easy when you don’t have to consider a decade of backwards compatibility. It’s less obvious when you’re not working with a clean slate. What do you do when you encounter ugly code? What about when repeating yourself it the shortest path to a complex fix? Should you re-write an entire library because doesn’t hold up to code standards?

    I propose adding LIBTYFI3 to the lexicon of idioms.

    If the code is ugly and misformated. Fix it4.

    If you’re repeating yourself or having trouble keeping it simple. Step back and assess what you should actually be refactoring. You’ll probably learn something about the application in the process.

    If variable and functions are named poorly. Fix them.

    If comments are missing. Add them!

    If tests are missing. Add them.

    In other word, if code is not holding up to current standards, rewrite as much as possible as long as it’s tangentially relevant to your task.

    Obviously this is going to take more time than a quick fix. Perhaps, if your task is truly a critical fix you should skip some of these steps. But stakeholder should understand that legacy projects are complex and taking time to do it right will lead to a better product in the long run.


    1 – Lest you question my Dad’s parenting choices, I can assure you small town Northern Ontario truck stop restrooms in the 80s/90s were not nearly as sketchy as the image you probably have in your head from movies and TV.

    2 – This rule did not apply to toilets.

    3 – Libby-fi? Sounds like some poorly thought out Liberal social network.

    4 – But please for the love of god, isolate style from functional fixes in their own PRs.


  • Winnipeg COVID-19 Controversies

    …and other associated weirdness.

    Winnipeg is weird at the best of times. Coronavirus is bringing the weirdest of the weird.

    Here is a chronological list of all the controversies and other we’re occurances that have unfolded in Winnipeg during the ongoing self-quarantine period:

    March

    12: First case of COVID-19 in Manitoba.

    15: Zillionaire owners of the Winnipeg Jets refuse to continue to pay their employees (well except for their Millionaire players). Redditors vow to stop chanting “TRUE NORTH” during the anthem when the NHL season starts back up. It takes them 5 days to reverse their decision.

    I’m sure everyone will forget all of this when sports are back in 2023.

    20: Provincial Government briefly threatens pull childcare providers’ operating grants if they choose to close during quarantine.

    I’m glad they “corrected the record.”

    25: Government liquor stores cite serving alcoholics justifications to stay open.

    I guess that makes some sense, but sounds bad when you put it that way.

    26 — notable non-Winnipeg mention: Workers ‘bunkered in’ at water treatment plant in Brandon, to ensure service during pandemic.

    This is when it really started feeling like a zombie apocalypse to me.

    30: Shindico exploits a loophole to increase rents during COVID rent freeze.

    Assholes. I didn’t see a follow up to this so I assume it actually happened.

    April

    11: Owner of water park Fun Mountain accuses medical workers of being actors.

    archive

    18: Police shot 3 people in 10 days.

    oof

    26: Local St. James ice cream shop — Sargent Sundae — re-opens for the summer. Only accepts cash to the ire of reddit.

    Extremely gross and unacceptable IMHO.

    27: Firefighters alleged to have broken social-distancing rules.

    30: Chainsaw-wielding man threatened arborists and others. 36-year-old charged with six offences, including assault with a weapon, uttering threats, theft.

    Ooohkay

    May

    8-9: Ice cream shop BDI opens an illegal drive-thru in a residential area. It doesn’t go over well.

    https://twitter.com/linzzzzzzzzzzz/status/1259295183444815874
    archive

    9: Winnipeg saw a US-style anti-lockdown protest.

    MCGA?

    10: Director of Operations of Manitoba Jewelry Chain Appelt’s Diamonds – Sarah Appelttweets a QAnon slogan. Turns out that’s the the first time she’s posted wacky stuff.

    What’s next unfriending diamonds?


  • When Facebook Turns Against You

    Yesterday Facebook surfaced one of my aunts posts in which she alluded to a conspiracy theory that the COVID-19 death numbers are being fabricated. Normally my response to these sorts of posts on Facebook these days is to simply hit the “snooze for 30 days” button.

    But this was my favourite aunt who I’ve respected since I was a child. She is not a “crazy aunt,” she is level-headed and well educated. Facebook has also never shown me a post of hers like this before, so I assumed she still had her wits about her.

    I decided to spend some time with a thoughtful and researched reply. It was as follows.


    There are a bunch of ways in which this statement doesn’t pass the smell test:

    1. “We can’t know that the people who died, died from Covid19” I don’t think that the statement is true. I think we can know in the vast majority of cases. People are not randomly getting some a combination of symptoms similar to: kidney failure, pneumonia, meningitis, etc. Doctors know what the symptoms look like, they even have a test for the disease. If someone has the symptoms, they test postive for the disease and then subsequently die, it would be silly to say that they didn’t die of the disease.

    2. “ANYONE who tested positive with COVID at the time of death has been marked as a COVID death.” I believe this is consistent with the way that causes of death are typically attributed. For example, if someone suffering from HIV/AIDS dies of a pneumonia, their cause of death will be recorded as “HIV/AIDS.” Same with people suffering from cancer. If someone with lung cancer dies of lung failure or pneumonia, their cause of death will be listed as “cancer.” Perhaps in an obituary it may be listed as “complications of cancer.” But in terms of statistics and epidemiology, deaths are attributed to the deadly diseases the victims were suffering from. So the statement “we can’t know that the people who died, died from Covid19” is not relevant because it’s consistent with the way that we normally attribute causes of death.

    3. “…even if they died from any other cause.” If someone dies in a car crash what is their cause of death? Cars don’t have some sort of ability to suck our souls out of our bodies. A car crash will cause various injuries which will end our lives. Those injuries are the direct cause of our death, but the car crash is the reason we received the injury, so we say that the car crash was the cause of death. If an unwell person becomes infected with COVID and their body is unable to go living with the added stress of fighting off COVID, then COVID is the factor that tiped the scales of fate, so we would say that COVID caused their death.4. I think you might be alluding to this idea that non-COVID deaths are being attributed to COVID. Even if this were true, the numbers don’t add up. For example, the average number of deaths in New York City 145 per day. On April 7th, New York City reported 545 deaths. Even if every single death under normal circumstances was being reported as a COVID death in NYC, the numbers would only be around 145. Not 375% higher!

    Now there’s no denying that the US media thrives on fomenting fear uncertainty and doubt. They make a living keeping the US public in fear and uncertain of the truth. But I can assure you that the Canadian media and media in most of the rest of the western world do not operate this way. The tone here is not one of fear, it’s one of solemn resignation to a fate beyond our control. It’s one of steadfast dedication to flattening the curve by doing our part.We’ve got this.


    Her response was short and polite but I did not sway her opinion.

    It’s becoming more clear every day, the USA is a failed state. We are witnessing the fall of an empire.


    A friend of mine told me that he literally hits “snooze for 30 days” on every post that comes up in his feed.

    It works rather well. The people you don’t care about, you only see monthly. For the people who you do care about, you get a monthly reminder to creep their profile

    name redacted to preserve his privacy

    I think I am going to give this a shot.