Software is like softball, at least when it comes to fundamentals.
My youngest daughter plays travel softball. “Travel” means that the players on the team are above average, so they get to visit other cities to play teams of the same high caliber. One of her recent games ended in a loss for her team as a result of a walk-off, four-base error. If you’re not a softball fan, a brief explanation is in order.
A walk-off means that the team at bat wins on the last play of the game. A four-base error is very unusual at higher levels of the sport, but for 12 year-olds, it is not unheard of. It basically means that the team in the field made a series of errors that allowed the batter to score a run.
In this case, my daughter’s team was in the field when the batter hit a ball to the infield. The shortstop cleanly caught and threw the ball, but the first baseman had let it skip off her glove. As the runner headed for second base, the first baseman scrambled for the ball, throwing it wildly into the outfield.
Now the runner had her eyes on third and was halfway there by the time the left fielder picked up the ball. You can guess what happened next: in a rush to get the runner at third, the left fielder’s throw flew over the head of the third baseman – and the runner easily trotted home, ending the game.
On the ride home, I asked my daughter why her team lost the game. She repeated the story above, recalling overthrows and missed catches. I told her: “That’s the result, but not the reason your team lost.”
The reason for the loss: in a rush to prevent that runner from advancing, her team forgot the fundamentals of throwing and catching, which are key to softball. And, that got me thinking about the fundamentals of software development.
But what are the fundamentals of software development? If I asked 5 of my colleagues for a top 10 list of fundamentals, I’d probably get a wide variety of answers. I’m sure there would be a lot of overlap around topics like consistent use of case, variable names, appropriate commenting of code, and the like. If you’re like most developers, you have a vague recollection of these fundamentals from your days in college. Keep on reading to chip off the rust on some of those forgotten concepts and in some cases, learn a few things you may have missed along the way. What follows is a brief tour of basic computer science fundamentals and best practices for software development.
Building a Strong Foundation
When I was an undergraduate student in Computer Science, one of my most challenging courses was Analysis of Algorithms. This course delved into the complexities of sorting, graph theory, and even a mind-bending concept called N-P Completeness.
The premise of the course was to teach computer science students how to abstractly analyze problems to determine why some solutions were faster but consumed more memory than others. We didn’t write any actual code, just pseudo code on a whiteboard. In university terms, this was your typical “weed out” class.
Good programmers failed this class because they couldn’t translate the art of writing code into a deeper understanding of the underlying theory. For me, this course was an epiphany that led to a deep appreciation for the early pioneers of computer science – and their fundamental theories.
However, as the years went by and I refined my software development skills, these fundamentals slowly began to fade into the background. I like to think they became ingrained in my code. But, something tells me that, much like throwing and catching in softball, it’s critical to constantly practice these software fundamentals. If not, the results are similar: four-base errors of software, also known as bugs, start to occur.
Think Inside the Box
A strong foundation is meant to guide you when making decisions. So, why do most people immediately jump to “thinking outside the box” to find answers?
Sure, the concept has merit. Breakthroughs in almost every modern industry have surfaced from someone solving a particular problem in a novel way – one that went against traditional thinking. In this sense, outside-the-box-thinking can and should be encouraged; but only when all conventional ways have been exhausted.
My problem with “thinking outside the box” is one of time and space. Said another way: how long did you look inside the box – and how big is your box?
What I see happening often is that when faced with a thorny problem, software developers are quick to jump onto <insert your favorite developer site here> to find a quick answer to a problem.
My personal favorite for this laziness is Stack Overflow. While this is perfectly fine for arcane syntax questions or undocumented API tricks, there are dangers with this practice. It slowly erodes our knowledge of the fundamentals.
Need proof? Here’s a pop quiz: What’s the complexity of merge sort in Big-O notation? Answer: [O(n log n)]. I bet you can’t remember the last time someone asked you about Big-O; and if you do remember, it was probably in a job interview.
What’s the point? Simple: We should resist the temptation to quickly find the answers to these kinds of questions and instead invest the time to keep those fundamentals sharp. Increase the size of your box so you don’t have to immediately jump outside the box to solve a problem.
Click here to dive into a deeper discussion on data structures, algorithms and concepts – as well as coding examples – for software developers. If not, keep reading…
Back to the Basics
If you actually cracked open one of your old university textbooks, bravo! You will not be disappointed and this will pay dividends in your everyday coding efforts.
Here are some books that I keep handy when I’m looking for inspiration:
- The Art of Computer Programming, 1: Fundamental Algorithms – Donald Knuth
- The Art of Computer Programming, 3: Sorting and Searching – Donald Knuth
- Introduction to Algorithms (CLRS) – Thomas Cormen, Charles Leiserson, Ronald Rivest, and Clifford Stein
But the best homage you can pay to this blog is to remind your fellow developers about fundamentals and why they still matter. And remember: think INSIDE the box before venturing outside!