On Comments in Code

I used to think that I didn’t need comments if I wrote self-documenting code. However, I have realized that I do write comments, and that I find them really useful. To see how many comments I write, and what kind they are, I wrote a script to analyze my git commits from the last six years. In total, seven percent of my committed lines contained a comment. This blog post has details on what constitutes good and bad comments, as well as more statistics from my script.

Continue reading

4 Things I Like About Microservices

Microservices have gone through a complete hype cycle. From being hailed as the one true way to build systems, to a backlash where they are often considered too difficult and complex. In a way though, they are like most technology – there are trade-offs. You get some benefits and some drawbacks. Here are four features specific to microservices that I have come to appreciate.

Continue reading

Recruiting Software Developers – Coding Tests

For the past few months, I have been interviewing with several companies. In all cases, one or more coding tests were included. I have also been on the interviewing side, evaluating a coding test. Here are my thoughts on the process.

Continue reading

More Good Programming Quotes, Part 5

Here are more good programming quotes I have found since my last post.

Programming

“It has been said that the great scientific disciplines are examples of giants standing on the shoulders of other giants. It has also been said that the software industry is an example of midgets standing on the toes of other midgets.”
Alan Cooper

“Changing random stuff until your program works is bad coding practice, but if you do it fast enough it’s Machine Learning.”
via @manisha72617183

Continue reading

6 Small Unit Testing Tips

Choosing test values when writing unit tests is mostly guided by the need to cover all cases of the program logic. However, some values are better than others. Here are a few tips on how to pick values that make mistakes easy to spot and the tests easy to read. Plus a bonus tip on a quick way to double check your tests.

  Continue reading

Mathematical Modelling of Football

This fall I took the course Mathematical Modelling of Football from Uppsala University. It was taught by Professor David Sumpter, and I believe this is the first academic course of its kind. The main subjects covered are modelling and analysis of events (on the ball actions), movement and pitch control (tracking data), player evaluation, and match result simulations. There were also several guest lectures from (among others) William Spearman, lead data scientist at Liverpool FC, and Javier Fernández, head of sports analytics at FC Barcelona.

The tools used were Python (using Anaconda) with NumPy, Pandas and Matplotlib. The course was a lot of work, especially the assignments, but I really enjoyed it and learned a lot.

Continue reading

Deployed To Production Is Not Enough

You have developed a new feature. The code has been reviewed, and all the tests pass. You have just deployed this new feature to production. So on to the next task, right? Wrong. Most of the time, you should check that the feature behaves as expected in production. For a simple feature it may be enough to just try it out. But many features are not easily testable. They may be just one part of a complex flow of actions. Or they deal with external data fed into the system.

In such cases, checking if the feature is working means looking at the logs. Yet another reason for checking the logs is that the feature may be working fine most of the time, but given unanticipated data, it fails. Usually when I deploy something new to production, I follow up by looking at the logs. Often I find surprising behavior or unexpected data.

Continue reading

Good Logging

To check if a program is doing what it should, you can inspect the output from a given input. But as the system grows, you also need logging to help you understand what is happening. Good log messages are crucial when troubleshooting problems. However, many developers don’t log enough information in the right places.

Continue reading

Working From Home – Cons and Pros

Because of the Corona pandemic, our whole company has now been working from home for 12 weeks. Before, we mostly worked in the office, although occasionally people would work from home, for example when waiting for a delivery. This abrupt switch has made for a great natural experiment on the differences between these two ways of working.

Many developers on both Twitter and Hacker News argue that remote work is the future, and that they want to keep working remotely even after the need for it because of Corona is gone. For me, it has worked quite well so far. However, I miss some things. Others were not quite what I expected.

Continue reading

Artificial Intelligence – A Guide for Thinking Humans

I really enjoyed reading Artificial Intelligence – A Guide for Thinking Humans by Melanie Mitchell. The author is a professor of computer science and an artificial intelligence (AI) researcher. The book is her attempt at working out if the singularity is near (or at least likely), or if we still are far from creating any true intelligence. In the process, the reader gets an excellent overview of the state of the art in areas such as image recognition, game play, and natural language processing. Even though it is aimed at general readers, I found it to be very good in technical content.

Continue reading