RantFever 4

I pontificate but not in the pejorative sense of the word.


Posted 10 April 2013
Written by Abinadi Ayerdis
Category Ember.JS

I've always had a fundamental problem with Javascript. As a web application grows, I have struggled with how best to organize my Javascript into something reasonable and easy to maintain. I generally use jQuery along with any number of jQuery plugins. But I have never been sure about how should the folder structure look or how the code should be organized. I heard about node when it came out, and it sounded exciting. I also heard about backbone. Backbone really intrigued me, but I never had any time to really devote to either. 

Eventually, I had an idea for a project. I wanted to build an online version of Dominion. There already was one, but I thought I could do better. So I tried it, but I quickly got bogged down in jQuery. I figured a javascript MVC framework is what I needed. I then read about Ember.js. It was new and hot and seemed like the perfect fit what I was looking to do. I tried it a couple of times, but my efforts were half-hearted and never amounted to anything. Dominion online took a backseat to life. Since Rant Fever is redone and looking fairly good, I am ready to take Ember.js by the reins again. And this time, I won't accept defeat!

Understanding Ember.JS

Ember has a steep learning curve. I have been doing a lot of reading on it. There are not very many tutorials out there about Ember, since it is still relatively new, but between the Ember docs themselves and nettuts tutorials, I am starting to get a grasp of how it functions. The thing that I had to first understand was the difference between server-side MVC and how Ember.js implements client-side MVC. The two are different.

Server Side MVC

Server Side MVC starts with a router which routes requests to a controller. The controller then calls on models for data and then spits the data out to a view for displaying. This is a fairly generic description of what a typical server side MVC framework, like Codeigniter or Symfony, would do.

Clien Side MVC

Ember.js also starts with a router. The router points both to the controllers and to the models. So when a controller needs data, it goes through the router to get to the model. Strange idea, but it is what it is. Dinkin flicka.

After that, the controller pushing the data to a view, which pushes, in turn, to a template. All told, it feels like Ember.js has more moving parts that what I am used to.

The next step

In order for me to really grasp the gist of things, I will have to build a test app now. Hopefully that will iron out all the issues I have with understanding how this all fits together.



14 April 2013

Hurry up and finish Dominion... for the love!


14 April 2013

You're right, of course, Andrew. I'm working on it!

Posting comments after three months has been disabled.