First Ever Coding Project
I got a bit nostalgic over the last few days and remembered my first-ever coding project.
Back in 2014, I had to manage barcode scanners. We received a tool from our software vendor to manage the configuration, but it wasn’t very efficient. I worked in logistics, and we had to create the configuration for 100 barcode scanners at once. However, you had to configure each scanner manually in this software, and in the end, it would spit out some registry files for the scanners.
These files only differed in the scanner’s name and IP address. So I thought to myself, “I can probably write a script to handle that better.” And that’s exactly what I did. It was my first project after school, and I hadn’t done any coding in about three years.
📝 Configuration
For the configuration format, I chose csv
.
I don’t have the original code anymore, but the configuration probably looked something like this:
country,city,scanner-names,ip-range
💻 Language
At school, I learned Java, C, and C#, so naturally, I chose…
🐍 Python
I picked Python for the project and knocked the code out overnight. It worked pretty reliably on my laptop, but looking back, it was the jankiest thing I’ve ever written. I had no clue about templating engines, so I basically reinvented the wheel with some search-and-replace magic on a registry file I had prepared. I used placeholders like !!SCANNERNAME!!
and replaced them with actual scanner names.
It was a bit difficult to figure everything out because I genuinely had no idea what I was doing. I just googled everything on a need-to-know basis. My search history was full of things like “How do I…”.
The script accepted command-line arguments: country, city, the last segment of the next free IP address, and the number of scanners. Afterward, it would render the config files, which I then had to move to the server manually.
Everything seemed fine—until I tried running it at work. The Unix jump host didn’t have Python installed… but it did have Perl.
⚪ Perl
So I pulled another all-nighter and rewrote the whole thing in Perl. Surprisingly, it wasn’t that hard to port the Python version because I had never really written Python before—nor Perl—so I wasn’t using any fancy libraries anyway.
The Perl version worked on the jump host and kept running even after I left the company. A former colleague told me they finally retired the script in 2019 when the vendor released new software that could configure multiple scanners at once.
💭 Reflections and Improvements
These days, I’d probably go with Python or Go, since I feel much more comfortable with them than with Perl.
For configuration, I’d use yaml
or toml
instead of csv
.
I’d also integrate an SFTP client and automatically transfer the config files to the server after generating them.
And most importantly—it wouldn’t take me an entire night anymore. I’d probably have a working prototype within 30 minutes to an hour.
It was a fun little project and the first time I realized I actually enjoyed coding. I just didn’t enjoy the way it was taught in school.