2017.09.29: For the sake of humanity, use a library & Firebase/Angular
“mustaches ({{ }}) uses an entire extra character compared to the moneybox (${})... this is getting out of hand”
As the title strongly recommends, stop reinventing the wheel. Seriously, it's in the best interest of humanity itself. A few weeks ago I was looking into front-end (javascript) frameworks to build brüd's web client. I finally settled on Firebase and Angular. Makes sense, since I'm already in the Google ecosystem while using Android Things. However, it took 2-3 days before I had made a decision. There was Vue, React, Angular, Aurelia, Ember, etc. The list goes on. On top of that, what if those frameworks were too large? I mean, Angular is over 100KB minified and gzipped. That is disgusting! On top of Firebase, our application is pushing 300KB. A horrendous experience for mobile users on 3G or less. Realizing this from the start, I told myself, "There's no way I'm going to use Aurelia or Angular, it's far too large for my needs." This took me down a rabbit hole of trying to use modular libraries that provide similar functionality. For example, I used page.js for routing. Then I needed something for templating in my HTML. I had heard about mustache and handlebars before, but being the purist I am, I wondered why the hell they used {{varNameHere}} syntax instead of the classic ${varNameHere} syntax. It bothered me so I looked further into them, and tried to understand why they changed from the moneybox (${}) to mustaches({{}}) (an entire extra character, mind you). It almost makes sense because the moneybox is for string interpolation while the mustaches binds the variable to the template, but at the same time, why change from a syntax that has been used for decades to place a variable inside a string? Point is, they opted to invent a new syntax instead of reusing a syntax most people already knew to mean something very similar. Of course, this isn't a big deal, but when every Javascript library decides it's going to be the next cool thing and invent a new syntax, it greatly reduces developer productivity. At least for a day or two. That said, I also understand Javascript is in a tumultuous state (it really is in a weird state, it seems like every big company has their hands in the javascript world right now. Microsoft with typescript, Google with Angular, Facebook with React. I mean, it's sorta getting out of hand.) People are stepping on each other's toes right now! We don't need 20 CSS frameworks, we only need like 3-5. All I can do is implore the developers of the community to converge on a select few. Don't get me wrong, diversity is wonderful. There's a reason we write in so many different programming languages. Depending on the context, there are better tools for a job. However, I don't have enough space in the toolbox for all these different CSS libraries and template engines! Alright, the rant is over, and I reluctantly have to say, I finally stopped all the dancing around and started writing the web client with angular. It provides routing, templating, css stuff, and all the things I was trying to piece together with smaller libraries. There is certainly a way to make a robust web client in under 300KB, but the up front cost of finding all the right modules that will play well together is fairly high.
“It’s going to get messy before it’s clean again”
This leads me to the conclusion: we should combine our efforts on 3-5 frontend frameworks that really "do it all." The monolithic approach to programming is always frowned upon, but at least we have modules within angular, aurelia, or vue. Hopefully one day we can make modules with generalized interfaces in which angular, aurelia, or vue can be interchanged harmoniously and without trouble (that would certainly be the day, wouldn't it? :D). In the end, that's really how software should be, and what every language aspires to have, right? Javascript is an implementation of ECMAscript in a similar way that firefox and chrome have different javascript engines, but they still run the same code. Javascript certainly has a bright future, and I believe the saying my mother always told me, "It's going to get messy before it's clean again," really resonates here. Now that we have all this out on the table, let me go ahead and say, Angular has been a wonderful product, I highly encourage new front-end projects be based on it. If only for the reason that you're not making another library that serves the same purpose. When we duplicate the work that someone has already done, we laugh in the face of our ability to copy what has already been written.
Perhaps human's most fundamental, unique, and powerful ability is our ability to copy those that came before us. We've been able to progress at such incredible speeds because we pass down, not only our genes to the next generation, but our teachings. So, please, for the sake of humanity, use a library.