I’m going to celebrate the “finish” of my newest website design/structure with a post about what happens when you discover new technology and force it onto something it is not meant for. Notice I quoted “finish”, because I have a habit of forcing changes onto my portfolio every so often. Hopefully I can finally put that aside and just focus on creating actual content for it.
Anyhow, onwards with the text. This is the story of how I managed to completely overkill several tiny websites that I wanted, this being one of those websites. At some point during late 2012, early 2013 when AngularJS had just started surfacing I saw potential in this new framework. I’ve always loved trying out new frameworks and the “single page” approach appealed to me when it came to my portfolio. I figured “single page” meant that you just keep everything on a single page, and that’s what AngularJS is really good at. I’ll give myself some credit and say that I was partly right. I was right that it is really good at keeping everything on a single page, meaning no loading of other pages. But I completely missed the concept of asynchronously fetching everything. That’s why I ended up with using AngularJS simply to list several projects that I would then write down in JSON format. It was pretty cool too, because then I could do all these different kinds of sorting on the projects and their data. I was able to keep all my html neatly sorted in folders, and it was magnificent.
AngularJS is not meant for static content. Every time I would load up the page it would initially take another half second or so to load the JSON into AngularJS, and then display them. I was basically handing the users all these random pieces of information and then told them how to structure it in order to create my website. This is perfectly reasonable if you have very dynamic content, and you may not want to display everything the same way to every user. But that’s kinda the idea about a portfolio, right? You want to show the visitor what you’ve done, maybe what your thoughts are, and maybe even a few other things. But are you really going to ask him to comment on the page? Is he going to be sorting your posts, or searching through them? Most likely not. Most visitors at a portfolio will click around on your website. If it’s easy to navigate they’ll be able to see everything. If it’s not then they’re more than likely to leave rather quickly.
I realized my erroneous ways, when I’d load up the page and I’d see it blink empty before displaying my static content. It’s not like it’s difficult for a webserver to serve a single static HTML page, I mean that’s probably as fast as it gets, if it’s done properly with very few HTTP requests. So why am I causing unnecessary load? Well I wanted to try a technology out that I didn’t have any small projects I could immediately fit it onto. But here’s the thing: I’m not sure that was the right decision, even though I just wanted to try it out. Because I’d just be making some very simple things, not really digging deep into what the framework is capable of. Most problems that you run into when creating, what is essentially a static webpage served as templates and JSON files, is pretty standard and is more than likely answered a million times in different StackOverflow questions. That’s why I think it was basically a waste of time for me. I could have done the tutorial and gotten just as much from it, and even if I did just want to play with it, who would ever actually deploy it when it’s hopelessly inefficient? Well seemingly I’m that kind of guy. But not any longer!
I’m starting to realize that AngularJS should be used for content that is dynamic. That’s why I created a tiny website that would allow me to list some boys and girls names. I planned on allowing the user to sort them according to different rules and quickly filter the names. Potentially mark ones as important or something similar, a lot of things that would be somewhat of a mess without the models that AngularJS provides. I learned a lot more from playing around with that than I did in the huge amount of hours I spent creating JSON files, and it was at the same time fun.
For these reasons I think it’s important to not go completely overboard when you’re planning on developing something. You don’t need a 1000 men to build a table for 4 people. That would just lead to way too much overhead.