Empty parking lot

Learning every week – 3-Apr-2020

As the days get longer, the day seems to be longer than ever being stuck at home. But it’s essential and we need to do this to get through this together. With previous routines no longer possible, we must find new routines to make ourselves productive. My previous routine consisted of going to cafes to find that change of scene to help me work. I can’t do that now. I have been working remotely for 7 years now but this feels different. Someone else said it better while I was just thinking about this.

I’ve been full time working from home the last 3 years. The last two weeks is nothing like the #WorkingFromHomeLife that I’m used to

Alex Moreno

This week has not been stellar with me trying to get into the schedule for work and just managing. I played catch-up and even wrote a composer plugin for an internal tool, but then all my plans failed. I am working on figuring out a schedule that works for me now.

Concurrency in Go

Continuing from the same topic from the last week: I was trying to figure out other solutions, particularly one where I could just wait on multiple and an unknown number of channels. I found that there is a Select function in the reflect package that allows this. The benchmarks (see answers to this question) indicate that this is not particularly performant. It still seems useful in cases when nothing else would work.


I have been moving between simple PHP scripts and Python to automate daily developer tasks. The advantage of the PHP script approach is that PHP is our primary language. This means that integration with the rest of the tools is easier. It is also easier for the rest of my team who would be using the script. On the other hand, Python has a richer built-in library for writing scripts. Particularly, I have found the argparse library very useful to write scripts which needs to accept options and arguments. There are similar libraries available for PHP but they have to be pulled in via composer which makes it an application. It would become harder for me to distribute such scripts. They don’t remain just single PHP files. Python’s argparse is built-in which means the user just needs Python and I can share the script files to whoever needs it.

This is all highly subjective on the use-case, though. For example, I wanted to write an automation tool for developers to manage database images. I had already written a Dockerfile to wrap most of the logic but the build command was still long and there were chances for various mistakes. In this case, it made sense to write a composer plugin and keep it in PHP.

With this approach, everyone on the team gets the script along with the project because it gets added to the composer.json file. Alternatively, the plugin can be globally installed and it works well. And because it is a composer plugin, it gets Symfony console component support out of the box. Distributing the script is easy and I get to use a proper library to parse all the CLI options. In fact, since my script needed to work with the git repository, I could just pull in the cypresslab/gitelephant package to do that for me. If you’re interested, check out the code.

That’s it for this week. Stay safe and stay home. More next week!





Leave a Reply

Your email address will not be published. Required fields are marked *