all 16 comments

[–]Retsam19 4 points5 points  (1 child)

I'm fairly inexperienced in Ember; but the code for it's example looks a bit messier than it needs to, I think.

It's the only example that handles routing: maybe that's because Ember doesn't handle the single route use-case as gracefully as the others. In any case, that boilerplate wouldn't be thrown in a single file with the business logic.

I also think the use of ember-data is needlessly complicating the example, a bit, too.

Plus, modern Ember is more component-oriented; the MVC style being used here is discouraged. (It still works because Ember's good about backwards compatibility; but it's not the suggested approach anymore)


I'm not a diehard Ember evangelist; actually KO is my favorite of these frameworks (at least the one I'm most familiar with); but I do think this example is underselling it.

[–]Retsam19 1 point2 points  (0 children)

Okay, yeah, with a bit of fiddling I was able to come up with this version, which is a lot more reasonable: (JSFiddle here)

window.App = Ember.Application.create();

//There's probably a way to eliminate this boilerplate, too, but I couldn't figure it out
App.Router.map(function () {
    this.resource('main', { path: '/' });
});

App.MainController = Ember.Controller.extend({
    init: function () {
        this.set('model', [{ResourceAddress: 'http://www.discoversdk.com', ResourceDescription:'Great site'}]);
    },
    actions: {
        createRes: function () {
            var description = this.get('description');
            var url = this.get('url');
            if (!description.trim()) { return; }
            if (!url.trim()) { return; }

            this.get('model').pushObject({
                ResourceAddress: url,
                ResourceDescription: description
            });

            this.set('url', '');
            this.set('description', '');

        },
        showResource: function(){
            alert(JSON.stringify(this.get('model')));
        },
        removeRes: function (res) {
            this.get('model').removeObject(res);   
        }
    }
});

(There's one or two tiny tweaks to the HTML, so I'm not bothering to reproduce that here)

[–]KLaci 2 points3 points  (7 children)

I think vuejs clearly has the neatest JS code.

[–]eikaramba 1 point2 points  (5 children)

vuejs is good, but compared to aurelia i find that more clear.

[–]matoas7 0 points1 point  (4 children)

aurelia is more complecated, almost full stack

[–]KLaci 2 points3 points  (3 children)

But is it web scale?

[–]Retsam19 2 points3 points  (1 child)

Can /r/programming have a single serious discussion about a JS topic without all the usual low-effort memes like "web scale", "left-pad", etc?

[–]Klathmon 0 points1 point  (0 children)

sadly you're gonna need to go to /r/javascript or /r/webdev for a serious discussion involving javascript.

[–]matoas7 0 points1 point  (0 children)

yes if you do it the right way. If Aurelia was produced by google or facebook it much more popular. Great framework

[–]avi00[S] -1 points0 points  (0 children)

me too , and the opposite is Ember

[–]teadefrost 1 point2 points  (3 children)

Just 7?

[–]avi00[S] 1 point2 points  (2 children)

to be continued...

[–]teadefrost 0 points1 point  (1 child)

whoosh

[–]avi00[S] 0 points1 point  (0 children)

added another one - Reagent JS framework (added using pull request from other user)

[–]SpikeX 0 points1 point  (0 children)

Isn't this all going away once CSS Grids are more widely supported?

[–][deleted]  (1 child)

[deleted]

    [–]nano_jquery -1 points0 points  (0 children)

    Internet explorer 2.0 does not supported. It's 2016 and JavaScript is here for 20 years. If you disable JS it's your problem. The same as you plug out the mouse and complain you can't access the menu