Code, Shiny Things, and Other Random Shit I Like

jamesreinknecht.com

Shedding Technical Debt Part 1

Part 1 of who the hell knows.

My latest project is a soup to nuts re-write of a popular smart mirror application. My friend wrote a Module for the ‘Modular’ application MagicMirror. He had some questions about javaScript, and while investigating his code, I discovered that Magic Mirror seemed to me to be over-engineered, overly complicated, and just too much code to maintain for something that essentially was a couple of API calls displayed on a Raspberry Pi to a monitor behind glass.

To display the output of data from an API call, each module is about 800 lines of vanilla JS to manipulate the DOM. It wasn’t even using jQuery to sweeten the syntax. They even overengineered the CSS by a factor of about 48.

Life just doesn’t need to be this hard! It doesnt!

For now, the working title is MagicMirror-React.

I just re-wrote one of the main modules of MM in React.

Before: 496 Lines of Code

After: 12 Lines of React, 8 lines of Handlers and Axios Calls.

Data is updated real time whenever the API is called, and the layout is at least 9000% easier to customize.

Check back for the next installment or something!