It is spring time where I live, which besides chirping birds and blooming flowers means also spring cleaning. In particular, I have spent at 10-20 hours over the last several weeks cleaning the paths in our back yard. Over the winter months, when we don’t use it much, moss, algae, and weeds start to grow on and between the bricks. I almost hired someone to clean it professionally this year, but it was quite expensive, so I decided to do it myself again this year. However, I did buy a new tool – an electric “multi brush”, which has several different attachments for doing this very thing. So instead of using a manual brush to remove weeds from the cracks, it has a metal brush which spins at around 4,000 rpm. It is still time consuming and tiring work, but it is much faster than the manual brush. I did end up using the manual brush as well in some spots, e.g. between the pavers and the edging, because the electric tool doesn’t reach there.
As I was working on this, I followed several paradigms I have practiced over the years, and I thought I would share them. I know that many people have a hard time with cleaning. There are some people who feel like they need to get something 100% clean, and that is overwhelming. For some, it is so overwhelming that they don’t even start. For others, they spend hours getting one little spot of their home 100% clean, while leaving the rest of the house in chaos. I take a very different approach. I don’t make a goal of 100% clean for any part – I go for 90%. With cleaning, I think this makes a lot of sense, because it is going to get dirty again anyways. With regular cleaning, I might go from 70% to 90% clean, meaning that on average my home is 80% clean, a rate with which I am comfortable. Looking at the above picture of my garden path, you can clearly see which part I had cleaned and which part I hadn’t gotten too yet. If you look closely, you can see imperfections in the part I cleaned, but it is still a striking difference to the part I hadn’t. Thus overall, the clean part leaves an impression of a well cared for yard, which is my goal. So here are some of the principles I follow
1. Start at the most visible or frequently used places
First impressions are important. When someone new comes to your house, I want them to think that I am the type of person who is hard working, and that includes keeping my house clean. If my entryway is full of shoes strewn about, it gives a bad first impression. It also makes me feel uncomfortable when I come home if that is how I am greeted. By starting my cleaning in these areas, I can be happy knowing that if I run out of time, I will still give a good first impression
2. Quickly clean up clutter, especially on the floor.
For the most part, only furniture belongs on the floor. Anything else is a tripping hazard, and gives a very messy impression. The same goes for stuff on tables, benches, window sills and the like. However, there is always some stuff that is difficult to know where to put, e.g. newspapers, mail, etc. I find that about 90% of stuff is easy to sort through and put in the proper place. The other 10% I put in one neat pile. This way the windowsill looks tidy. The next time clean I go through that pile again, and 90% of the stuff has gone from “difficult to categorize” to “easy to categorize”. For example, that coupon for a store has now expired. The receipt for a purchase I made two months ago can be thrown out, because I am definitely not going to take that thing back, and so on.
3. Clean a little bit frequently
What do you do while heating up something in the microwave or boiling water for tea? Some people look at the window. Others maybe daydream. Nowadays I think many people check their smartphones for whatever they may have missed since the last time they checked. I usually spend that time cleaning up. In the morning, this means I put away the dishes in the drying rack that I washed the night before while my water is boiling. While I am waiting for a cake to bake in the oven I wash the dishes I dirtied to make the cake. I might not get all of the dishes done, but if I get one drying rack full done, then I can come back in a couple hours, put away the dry ones and do another batch.
Clean code
The 90% principle doesn’t apply to everything, but I think it can be applied in many different situations in life, including when writing computer code. There are some software development practices which mandate 100% test coverage. When I started programming, I mostly was developing stuff for myself, and I didn’t really bother with tests. I have come to learn that in an environment with a complex code base with many developers, the main reason for having tests is so that other people don’t break your existing code! However, I think the way that this is achieved best is by integration tests, not unit tests. In many programming paradigms, there are getters and setters, like get_id
, which simply returns the value of a private property of an object. This is very common in Java. I don’t see a need for a test for this use case. Currently I spend most of time developing Elasticsearch pipelines for Automattic. We have a separate test cluster which we use for integration tests. Thus I have a test which adds a new WordPress post, and then checks that I can find it in Elasticsearch. There are many different pieces of code where that could fail. I might not even know of them all yet, and other developers might not either. That kind of test I find very valuable, and in particular when we upgrade our Elasticsearch versions, which frequently include breaking changes, these tests give me a lot of confidence that everything will continue to work correctly.
Another aspect of code cleanliness is formatting. Most every programming language has some guidelines around whitespace, indenting, variable names, and such. Many projects and companies also have their own guidelines. At WordPress.com we follow the WordPress guidelines for PHP, which include among other things, that there should be be spaces inside parentheses, e.g. do( $this )
. That is a quite uncommon convention, but you get used to it. We used to rely on code review to make sure these formatting guidelines were being adhered to, but around five years ago we started using phpcs
(PHP Codesniffer) to enforce them. However, we already had a bunch of code, much of which did not meet our new stricter guidelines. Instead of requiring developers to spend months reformatting code, we only require the new strict guidelines on new code – either entirely new files, or also just changes to existing files. It means that we don’t have 100% clean code, but it also means that we never have to justify spending a bunch of time working to clean up code, which doesn’t actually make new features or fix bugs, and in fact, might actually introduce bugs (e.g. by switching from loose ==
to strict ===
comparison in PHP).
Final thoughts
I could certainly improve this blog post, but I am also going to call it 90% perfect and simply hit the publish button. I hope that someone else finds it useful.