Solidity's biggest bug: Javascript

Solidity's biggest bug: Javascript

Reliance on Javascript is stunting the growth of the Solidity development ecosystem. It’s why new developers get stuck. It’s why we struggle integrating Solidity into development environments. And it’s why much of our documentation is out of date. We are stuck in our Javascript mindstate because we don't treat Solidity like it's a real language.

This begins with how we teach Solidity to new developers. First, we explain Bitcoin, Ethereum, blockchain, and smart contracts. Next we show them the SimpleStorage smart contract. It all makes sense until we start adding Javascript into the mix. We begin explaining web3 and how to make your SimpleStorage GUI.

What happened? Are we trying to teach smart contract development or how to build GUIs? Imagine trying to learn Solidity as your first programming language, and then getting told you have to know Javascript too. That would give me nightmares.

Solidity is constantly treated as a second class language.

This is not just a problem for newbies. Seasoned developers spend weeks on-boarding before they write a single smart contract. Instead of learning Solidity, they spend their time debugging web3 issues.

Personally, I spent over a month trying to integrate Ethereum development tools with my React/webpack frontend enviornment. Project after project I kept hitting walls that I didn't quite understand. That is, until I realized I had just spent weeks on my tooling with no smart contracts to show for it (talk about Javascript tool fatigue). Trying to couple my Solidity development enviornment to my Javascript frontend caused me nothing but pain.

Coupling our Javascript and Solidity environments also causes documentation problems. Most of our “Solidity” tutorials don’t actually cover language features. Instead they focus on Javascript integration tools which are in constant flux. We document high level abstractions instead of core functionality. It’s like living in a world where Angular.js is documented better than Javascript.

Because flashy GUIs provide great press, and CLIs only get Vim-users excited, Ethereum devs have been focusing on frontends. It's natural then that we tack-on smart contracts to our Javascript frontend workflows. We just throw the .sol files into a /contracts directory and call it a day. But this strategy doesn't scale. For dapps to move out of the prototype phase we will need mature tools which reduce the complexity of large smart contract systems.

There's still hope

We can still fix this. We need to treat Solidity like a real language and develop tools for Solidity developers not just for the Javascript developer dabbling in Solidity. There are a few areas which require the most attention:

  1. Solidity Learning Resources: More comprehensive learning resources that focus on Solidity. This could include a Hello World app that prints 'Hello World' to the console using events. Having tutorials that cover Solidity basics, up to advanced design patterns will do wonders for our community.
  2. Solidity Package Manager: Smart contracts on Ethereum all execute within a shared runtime. This provides great opportunities for code reuse, but somehow we still don't have a good package manager. npm empowered the Javascript community to share and reuse code. The Solidity development ecosystem needs it's equivalent.
  3. Solidity Unit Testing: It's common practice to test contracts with Javascript testing libraries. This practice introduces implicit dependencies (e.g. RPC connectivity), requires context switching, and is difficult for non-Javascript developers. Instead, for reliable unit tests, we need powerful Solidity unit testing frameworks. We need the Chai and Mocha for Solidity.

Solidity development is wonderfully greenfield and I haven't covered most of what needs to be built. But that's what makes this field so exciting. Every developer can make a huge impact. But for us to make the most impact, we need to stop building around the problem and attack it at it's heart: the Solidity language.

Our ecosystem is already maturing. But it would progress much faster if we stopped using Javascript as a crutch. We would soften the learning curve, empower developers, and push our ecosystem forward. Just because Solidity is resource constrained, doesn’t mean it should be treated as a second class language. If the Ethereum computer is going to change the world, it will need the most vibrant developer ecosystem supporting it.

Let's drop Javascript reliance like semicolons and take Solidity to the next level.