So I set up a raspberry pi to control my bedroom lights last year. I decided I wanted to add some more features to it and for the first time since I created it, started looking through the code I wrote.

First thing I noticed was the excessive amount of files I have. Like I get that I just wanted to throw this thing together as quick as I could but did I really need to create a file specifically for storing a 1 or 0 depending if the lights were last turned on or off for a startup check.

Secondly, I seem to have 2 index.html files for some reason.

And finally, the code itself is pure spaghetti. The website is running with a python script, which sends calls to a nodejs server, which executes additional python scripts to control the lights. No comments anywhere, and badly named variables are also a great combo.

And finally there is the occasional "Why the fuck isn't it working, fuck it I'll just unplug the pi and reboot it" that I have been dealing with lately.

Oh and don't forget that the log file is spammed by a debug message that is printed every minute.

God I feel so ashamed. I was proud of this until I looked at it just now.

  • 6
    I have just noticed I put "And finally" twice and still had another point after both of them but fuck it I'll leave it like that

    Edit: This is probably the attitude that made this codebase so bad in the firstplace
  • 2
    @LavaTheif Ha! Self reflexion is important ;)
  • 0
    welcome to the world of open source hardware and software, where the simplest fucking shit is a nerve-wrecking drama.
  • 2
    Well this is a good corona extra project.
    You did step 1: identify the problems
  • 1
    @hjk101 What's step 2? Blame your coworker or the intern?
  • 2
    @Jilano nah that is step 4 and only to upper management.
    Step 2 is delegate all the actual work to co-worker/intern.
  • 0
    Sounds like you have a lot of refactoring to do, good luck.
Add Comment