Experimenting with SOLID for JavaScript

By Niksa Janjic on November 3, 2016

fingers_on_keyboard.jpg

Here at East Coast Product we’re nerds at heart and we really enjoy playing with emerging tech. Recently, we had an opportunity to start exploring SOLID, a design framework that has the potential to fundamentally change how social applications manage data. For added fun, it lines up really well with JavaScript!

What is SOLID?

Let’s start with a little more about SOLID –  these are a set of conventions that propose that every user should store their own data where they want. This allows the user as the data owner to choose which apps access some or all of the data. The goal here is to build a decentralized web.

But what exactly does SOLID do? Currently, when you create an account on Facebook, Twitter, or LinkedIn, these companies own whatever information you provide and they store it in their own databases. Many applications support API integrations but this is just additional functionality inside the same ecosystem that doesn’t give users control and ownership over their own data.  

SOLID’s value premise is that once a user’s data is added, deleted, or updated in the private  repository, applications receive updated data when they make a request. This eliminates the need for the user to manually open each and every application to make changes or transfer data. Think of the last time you had to do a mass update of your social accounts, perhaps when you moved or changed jobs – SOLID would simplify that process substantially.  

Why We’re Excited

For us, the prospect of a new order in data management and user data ownership is a pretty big deal. Data would be free from any particular application and could be reused and transferred easily between all of your favorite apps. On the technical side, developers benefit from being able to offload some of the data architecture to this simple framework. Although we found that the structure can be limiting in some aspects, you will generally be able to develop faster. If that weren’t a big enough sell, SOLID is the latest project by Tim Berners-Lee in collaboration with MIT’s Computer Science and Artificial Intelligence Lab (CSAIL) and the W3C.

Getting Started

Since SOLID is a newer technology, there obviously aren’t many examples out there and documentation is theoretical and limited. The best documentation I found was the SOLID-Client repository and the rdflib.js tutorial repository so definitely check those out.

Working with SOLID requires a backend skillset because you have to deal with data architecture. I found a few examples of SOLID apps developed in Angular that helped me really understand how the principles work in practice. For context, I'm a frontend developer but have backend experience and I’m very comfortable with Angular.

Things to Keep in Mind

As with any new technology, hitting a roadblock can't be solved by a quick Google search. In my case, I encountered a Chrome bug during the authentication process, so I'm only able to properly log in using Safari. If anyone out there has insight on fixing this, I would welcome the help.

One of the downsides of SOLID became really apparent with our sample social media profile. Creating a list of friends required multiple HTTP requests from different sources that increased the overhead and loading time substantially. Theoretically, you could cache the requests on a local server but then you have to deal with keeping the data fresh, which creates it’s own set of problems.

The extra logic also requires larger JavaScript files, leading to longer download times. Not a big deal, but something worth mentioning. This could be a downside for SPA applications where more code on the frontend means bigger JavaScript files even when minimized.


Get your free consultation today!


Final Thoughts

Personally, I find the prospect of users owning their own data very exciting—it completely disrupts the current way social networks operate.  While the biggest social networks may not move away from their current data management models in the near term, new social spaces might force others to reconsider user data management and ownership.

Check out our GitHub repository to see our React/Redux SOLID profile editor in action. I’ve included some instructions to help you start testing and experimenting with it.

 

Subscribe to Email Updates