Beatspeak DevBlog 3 Computer Vision + Telehealth = passion project
Tags: cpp, devjournal, opensource, computervision
Published: 2023-05-08 18:49:05

In my last post I left the story after finishing the accelerator program. I had ultimately failed in my primary goals of:

1. Building a team and startup
2. Raising money to bring the product to market
3. Building the product to a production standard
4. Having the Idea and product and in a state suitable to bring into a larger company

The aim of the system was to automate a crucial task for nurses, in truth I did have the option of bringing it to a large american multinational which had a program for such ideas. In the end however I decided not to for a number of reasons. 

The first reason was it would take 5 years and I would basically be an employee with no control over the direction of the project, the second reason was it was clear it would be used mainly for private healthcare users and not be targeted at public health or the people with no access to medical care, basically it would be a premium product. 

There was also interest from security and surveillance companies but I really had no interest in this area it just went totally against all my values and principles. My culture and heritage just makes it impossible to work on any product designed for the security or surveillance industries.

**Post accelerator**

At this stage the funding and the monthly stipend came to an end, I was years away from generating any revenue and if I sold the idea into a large company I would lose control and the project would never reach the potential I saw for it. I had been freelancing and taking on projects (mostly hardware) during the program to augment my income, but this was not nearly regular even to cover my rent and living costs. 

I decided I needed to take a job in software development, first to pay my bills and second I needed some hands on professional experience in pure software. At this stage I was in the late phase of tendering for a project with the European Space Agency. The project was nothing to do with my main project and was instead on the topic of using Software defined radios with Cloud providers to offer powerful real time satellite signal processing. 

**Engineer for hire**

I won the project and funding with my plan to use off the shelve raspberry pi's, software defined radios and AWS to demonstrate how a video could be converted to a satellite signal. Then transmitted via radio waves and decoded in real time (with a slight delay). To take this project I wasn't able to do so as an individual so I pitched it to another company based in Dublin and they agreed to host me for the 6 months. 

During my time on this project I was successful in building the system which used AWS with kubernetes(something the company wanted to experiment with) Apache Kafka and a lot of C++. I was also successful in winning the company two further contracts with the ESA, but after the 6 months I left. In this time I wasn't able to work on the heart rate app. I did learn a lot about cloud, dev ops and signal processing at scale but I was finding my lack of progress on Beatspeak very frustrating. I was also struggling financially, I was barely able to afford my small apartment and I was barely able to make ends meet. During this period I walked to avoid paying for the bus, I ate one meal a day and I just didn't socialise outside sport to save money. 

**Dream come through**

At the end of the six months I won a place on an internship with bell labs. I had always dreamed of working in the famous labs, I had read so much about them, even thought I was way over qualified for the program I got onto (it was designed for graduating and recently graduated college students) I was really excited to start.

I really enjoyed my time in the labs there were so many diverse projects to work on and the conversations at lunch time were some of the best I've ever had at work. I did struggle however, the salary was barely better than before and at this stage I was forced to move back in with my parents to afford a car to get to the office. I struggled with the 9 to 5 schedule which I hadn't done for a few years and its really hard to hide the symptoms of my ADHD in an open plan office. In the end I left after 6 months with a lot of new experience. I had tried to bring the heart rate project into the organisation and I tried to get help and insight but ultimately it wasn't a good fit. The labs at this stage had a model of filing patents or working with industry but this were done by individuals with PhD's not individuals like me who simply built what we were told.

**Professional Developer**

Following my time in Bell Labs, I had built up a lot of development experience at this point both professionally and on side projects. I was comfortable with web, mobile, desktop and embedded development. I managed to land a job as a c++ developer in a robotics startup. They had a product that they build custom from the ground up from the robot to the software controlling it. This was mainly C and C++ with a central server to control up to 50 robots in a room together.

When  I joined I was team member number 6. On my first day one engineer quit and joined Google, this became a trend. He had spent six months writing a software package, that was not tested or integrated so I had to take this and do both asap. I had to get up to speed with the system that had 6 components each with at least 20k lines of hand written code. The code was written by multiple generations of engineers and was a soup of different style and opinions, it was separated into 6 parts but each part worked with each other part, aka integration hell. Documentation was non existent and comments were incredibly rare and often wrong. 

This was really a baptism by fire, I spent two years at the company and each time I would get on top of a piece of software another engineer would leave and Id have to take over his section. I ended up building a whole CI/CD pipeline that tested and deployed the software using github actions, and ansible I had to do a crash course on the job on Dev Ops. I was the most junior engineer by far when I started, no new team member every joined, some would start for a day or two but look at the code and leave. Eventually all the seniors left over conflict with management. My final task was to black box all the code and make it available to python developers who the company decided to hire instead of C++ developers as they were easier to find and less demanding than c++ developers. 

I learned a lot from this job, it was also during the covid 19 lock downs so it was my sole focus for a while, in the end a lot of my experience was of how not to do things and what to do if your forced to work with unmanageable code you can't change. 

Towards the end of my time in the job when I was burning out I was finally able to refactor and rewrite the code because I was the last engineer left. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zg22xubxgk4z0qvgvsum.gif)

I cut most of the 20k+ components down to 5k with no loss in function, performance or redundancy and often with an improvement each. This was a period I really got into functional programming especially with c++. The bloated unmanageable code was clearly a result of a dogmatic adherence to Object Orientated principles with layers upon layers of inheritance. Often wheels where reinvented again and again as components that where written to be reused "with no documentation" where simply re-implemented elsewhere in the code by a different engineer with no knowledge or interest in using preexisting code. Sometime a component would be designed and implemented with a simple function but Kafkaesque layers of complexity to make it "reusable", "extendable" or "scalable" of course the complexity became so great nothing could be reused or even modified.

The other thing I learned on this job is no amount of software management fads, or buzzwords can make up for poor design, poor code or the ballooning tech dept caused by both. As the code continued to cause serious problems for the company as it was on fire metaphorically and for one scary moment actually on fire! It was during covid so I just worked long long hours on it, I was basically working on it when I wasn't sleeping and sometimes when I was. 

In this job I came to the conclusion a developer is basically fighting against complexity as they try to add features and stability to the system. I think this is ultimately what Functional and OOP are trying to achieve to simplify the code so any engineer can consistently work on and improve the code and avoid the spinning plates frustration of spaghetti code.

I saw how a dogmatic believe in the inherent goodness of all things OOP could blind developers to the reality of needing a well designed and robust code base regardless of how.

Functional programming seemed a silver bullet for this complexity when I first started using it. A lot of proponents of Functional will present the issues I came across as something only applicable to OOP, Functional is definitely more terse and easy to use when It works, but it also has the limitation of having to constantly move the real world of side effects into the stateless world of functional. I think this might work OK in web development but when interfacing with the real world and hardware it had its limits. Even when it was suitable a lot of my time had to be spend in writing the code to support the actual code I wanted to run. I think this is a lot less of a problem if I was better at functional programming but it felt like I was already off the main road and the deep I went on the topic it felts like I was making my own path. I think a lot of developers like this feeling but for me I just want something fast and reliable to write. 

In the end I found a nice medium, I used a flat OOP structure which encapsulated the code into section where I used functional, oop, generic or imperative where it made sense. 

**Journeyman**

 Following my time on this project I was really burnt out. I had however been able to apply a lot of what I was learning into Beatspeak, this didn't impact the functionality but I was able to refactor the code and do a rewrite with a good structure using CMake and conan. A lot of the real engineering behind the project was done in this period. 

After this job I landed a job with a big data, ai company. I had the freedom to choose the language and technologies I wanted. The project was to build a transcription service to run on a service but to avoid using API's for security reasons as the software was designed for governments.

I decided to use Haskell as the main language that integrated it with C scripts. The C code basically used FFMPEG and opensource transcription libraries, the haskell took the audio broke it down, ran the C in parallel on the chunks and then recombined it. For usability It was all run in a docker container, so a user just had to spin the docker image up and then they had access to the onsite API. It was lightweight, robust and powerful. This job came with a really good benefit I could work fully remote from anywhere in the EU. I choose to move to Krakow because it had the lowest cost of living mixed with the nicest apartments, my intention was to save money and visit the rest of Europe from this city. 

This was the first time in my life I could afford to live alone in relative comfort, the apartment I rented had three rooms which was a palace compared to the places I lived while in Dublin. The other benefit of being there was there was no distractions, I could focus on work and study. In my first few months I spent all my free time building a web app for a friends startup but once I left that project I finally had the time to focus on my own projects.

I really got into AI, deep learning and Machine translation, I built a few translations models for Geailge using 5 million sentence pairs and learned how to write perl I also got into Rust, Erland and Elixir. 

I vividly remember sitting in a cafe staring at the Beatspeak code and not knowing where to start. I had been using Emacs as my IDE for it so the first thing I did was switch to vscode, I know use a mix of nvim and vscode depending on if I need a vscode plugin. 

During this period I dived deep into category theory, the latest C++ features and really advanced and abstract coding concepts. I was also studying languages and linguistics on the side which really boosted my coding ability, the final improvement from this period is I learned to touch type which turn out to be a cure for my dyslexia it was like taking training weights off a really exhilarating time in my life. 

The job was a dream job in many ways but two extreme events led to me leaving the job 8 months later and moving to Istanbul for a summer. But that's a story for the next post.