Archive for February, 2020
I often hear something along the lines of “I cannot write tests for that UI code!” as the reason for the lack of unit tests. The fact is, more often than not, we can write tests for what seems to be “UI code”. I decided to come up with a talk to explore that topic and will be giving it at the Improving Code’s User Group next month, on March 4th.
In this talk, we’ll explore an approach to either write or refactor UI code so it can be tested more easily. We will NOT cover how to write automated UI tests, though.
Looking forward to it!!
I’m speaking at the North Houston .NET User Group this coming Thursday, Feb 20, 6:30-8:00pm. I hope to see you there!
Code Review: I Mean No Harm!
As part of the work I’ve been doing for many years, I get to do a lot of code review. I usually document things that come up doing a code review so I can share it with other developers in the teams. In this session, I share some of the code I’ve looked at, the reasons why the code raised yellow or red flags in my head, and some possible solutions I’ve proposed.
Back in 2015, I used to have a morning routine that included working out at the gym. Since I get bored working out, I’d often be either listening to audiobooks and podcasts or watching TED talk videos on my iPad. Whenever there was something I wanted to either review or remember later, I’d take a quick note, such as this one: “Slow the #$@! down!“
I wrote that note when watching Carl Honore’s “In Praise of Slowness” TED talk. I’ve been since saying that sentence in my mind, deliberately, at times when I realize I’m rushing through things.
Did Michael Jordan really say that?
I’ve either read or heard someplace that somebody asked Michael Jordan how he was able to read a game so well and react so fast to it, and his answer was something along the lines of having an ability to see everything going on around him as if it were in slow motion.
I haven’t been able to fact-check that, but I don’t care, since the idea makes a lot of sense to me: if anything is fast-paced, the best way to succeed at it is to see it in slow motion. But how do we do that without acquiring the powers that only fictional characters such The Flash possess?
How does he make his guitar sound like that?!
I still remember my thoughts when I first listened to Yngwie J. Malmsteen (Swedish Guitarist) when I was a teenager. At the time, I was happy I could play some of my favorite guitar solos found in the music of bands such as Iron Maiden and Metallica. I could learn their songs simply by listening to it.
Then, I start listening to an album by Yngwie and my face is melt; I simply could not understand how he could make his guitar sound like that. I mean, I couldn’t visualize how he was playing that. Certain passages sounded so fast, yet so smooth. I’d pick up my guitar and not have a clue where to start trying to learn one of his licks or solos. I had to see it to believe it. After seeing it, my brain could start processing what was happening.
At one point I got a copy of a VHS tape with his video lessons (holy grail!), and when he slowed down playing some of his licks, only then I believed I could actually learn how to play that (and I did, as we can see in some of my own music).
Practicing playing a guitar has to start slow, regardless of your level.
Riding motorcycle at a race track can be daunting. Things come to you very fast when you’re going 150mph on a straight, or 100mph around a corner! When I started riding at the track in 2017, I did what most beginners do: looked down on the track, instead of further ahead. By the time I got to a corner, my brain didn’t have enough time to process the information and make quick decisions on all the things that I need to do in order to go through a corner properly.
“Go slow to go fast”, they say. And that’s true. I needed to slow down to be able to learn fundamentals of track riding. Give time to the mind and body to internalize the actions. As time goes by, muscle memory is built, besides developing better visual skills; instead of looking where I’m going, I learn to look where I want to go next. The better I do that, the more time I give the brain to process everything, so it’s almost like things are coming at me in slow-motion.
Putting the mind and body through the process of slowing things down before trying to go fast makes me a better rider, so I do it as much as I can, which includes riding mini-bikes:
Fast-Thinkers and Improv
I’ve been blogging about my recent experiences in improv. At first, I thought improv would teach me how to think fast. As I focus on thinking fast, I end up stumbling into my own thoughts. That’s similar to blowing up corners at the race track because of not “seeing ahead”, or blowing up several notes in a guitar solo simply because I’m focusing on playing fast.
But then, I found this short video a few days ago, which changed my perspective on it:
“Backing up” in a scene seems equivalent to seeing things in slow-motion.
What did that driver just do?
I guess this has happened to you several times: you’re driving, minding your own business, when all of sudden, another driver pulls up right in front of you (driving out of a parking lot or something like that), startling you really bad.
That does happen to me at times, usually, when my mind has drifted away, as I’m thinking about a million things, except for the one impostant task at hand, which is to safely drive my car. In such situation, it is easy for other drivers to catch me off-guard.
That type of situation can be avoided by using “slow-motion” again. In this case, that means to be in the moment, aware of my surroundings. When fully-aware, predicting what other drivers are about to do becomes easier. We predict when a driver is ready to jump the gun and make a last-minute right-turn, or when a driver will cut you and others off, jumping lanes without using the blinkers, or when a driver will speed up to prevent you from merging into his or her lane. “Slow-motion” here doesn’t mean slowing down the speed of the car; instead, it means our mind can better assess the situation because we’re giving it space to process the information.
I’d like to point out that I believe I’m usually way more aware in traffic than other drivers because I also ride motorcycles (the lack of a “cage” makes one aware in the middle of crazy traffic and drivers).
Software Development: Productivity Tools
I’ve been using productivity tools such as ReSharper and Code Rush for a long time. At first, it was just cool to see how quickly I was able to navigate code, write it, change it. I now see it differently.
To the outside (other people), it looks like I can do those things really fast. Internally, though, doing those things fast allows me to think slowly. Because of the muscle memory built after practicing all those shortcuts, I spent less time figuring what and how I’ll do something, and spend more time thinking why I’m doing it.
In the same vein of giving the brain some room to think, I often take the time to do things the slow way; for example, I may go the command line and type a command character by character, instead of recalling and changing a previous command, or using an alias of some sort. I fall back to this approach when I feel I’m either rushing or unsure as to whether I’m going in the right direction (“If we are facing in the right direction, all we have to do is keep on walking.”).
Summing it up…