DEV Community

Ivan Delgado
Ivan Delgado

Posted on • Edited on

My Journey into Software Engineering #4: Tackling Legacy Code and Learning on the Fly

As I dive deeper into my role as an embedded software engineer, I’ve encountered challenges that extend beyond coding. This project, which involves developing a leak testing instrument using Raspberry Pi and sensors, has provided a wealth of lessons about the complexities of inheriting legacy code and navigating real-world development environments.

Inheriting Legacy Code: A New Kind of Challenge
Sometimes I have a hard time reading old code I wrote—now imagine trying to decipher someone else’s code and understand why they made certain decisions, especially without proper documentation or comments. That’s been the most challenging part of this project. The codebase is not well-organized, with no clear separation between relevant files and outdated or unrelated ones. This has made it difficult to focus on the actual task of improving the software.

On top of that, there was no version control in place initially. My colleague and I set up a Git repository to track our changes moving forward, but having no history to reference has been a significant hurdle. Despite the disorganization, I’m learning to piece together the logic behind the code and find the entry points into the system.

Navigating Networking Issues and System Constraints
Another unexpected challenge has been working in an environment where the Wi-Fi frequently drops or assigns new dynamic IP addresses to the Raspberry Pi devices. After updating the firmware on the Netgear router, I had to deal with dynamic IP assignment that caused the devices to receive new IP addresses upon reboot. This required me to keep track of their IPs to maintain SSH connections.

Additionally, I’m accustomed to developing on Linux or macOS, so working on Windows has been a bit of an adjustment. I’ve had to use tools like PuTTY for SSH access and file transfers, which has exposed me to new development processes on a platform I’m less familiar with.

Realizing the Importance of Legacy Software
One of the biggest lessons I’ve learned is how much legacy code can depend on legacy software. Initially, I installed the latest version of Raspbian OS, only to realize that the project required OpenJDK 11, which wasn’t available for download on the newest version of the OS (only OpenJDK 17 was). This forced me to reflash the SD card and install an older version of the OS that supported the required Java version. I also had to install MariaDB and use SCP to transfer files between my host machine and the Raspberry Pis.

This process taught me not only about configuring Linux environments but also about dealing with legacy dependencies that aren’t compatible with newer software.

Troubleshooting Hardware Issues: Power Supply Matters
Another critical lesson came from hardware troubleshooting. We spent time trying to figure out why one of the Raspberry Pis wouldn’t boot or display on the screen, suspecting everything from a faulty Pi to a bad SD card or screen. In the end, the issue was simple: the Pi wasn’t being properly powered by the power supply. This reminded me of a similar issue I had when trying to power a Pi with my MacBook. It taught me the importance of using the correct power supply with adequate voltage and current for the Pi to function properly. Underpowering the Pi can lead to hours of confusion when, in reality, it’s a straightforward fix.

Getting Comfortable with Linux Networking and System Management
Throughout the project, I’ve enjoyed becoming more comfortable working in a Linux environment. I’ve learned to configure network names in /etc/host and /etc/hostname, set up Wi-Fi through wpa_supplicant, and retrieve the Raspberry Pi’s IP address using commands like hostname -I. These tasks, although new to me, have helped me gain a better understanding of the Linux system and how it interacts with embedded devices.

Moving Forward: Version Control and New Projects
Despite the challenges, the project is expected to be delivered soon, and we’ve been laying the groundwork for future projects that will benefit from the lessons we’ve learned here. Having a Git repository now means we can at least track our progress moving forward, and I feel more confident about reusing parts of this project for future work involving similar sensor technology.

Top comments (0)