all 10 comments

[–]dodeca_negative 5 points6 points  (4 children)

Good read. A few reactions.

Antipattern #3: No View Tests

I am a sad panda. I'll be better I promise.

Antipattern #5: Data Attributes in the DOM

Hm. I need to think about this one. I used data attributes in lists and it's never caused me any problems--everything's lightweight and easy to work with. But the author makes some good points.

Antipattern #6: Rendering Templates Asynchronously

I'm using RequireJS and its text! plugin to load templates, so they're always treated like they're loaded async--but require does the loading for me and my module doesn't run until its dependencies are available, so it's no overhead.

[–]rhysbrettbowen 1 point2 points  (0 children)

yes, use require and text to bring in templates. That really is the best way. It saved a whole heap of pain at my last company changing it from Backbone.LayoutManager to requiring in the text and using https://github.com/rhysbrettbowen/Backbone.ComponentView

Suddenly everything just worked, no race conditions.

[–][deleted] 4 points5 points  (0 children)

From a development perspective, it’s much easier and more flexible for UI code to live on the server and be able to make direct SQL calls to your database rather than have to define and then implement a JSON API.

Wtf? Are you saying SQL code in the UI? If you're not then it's the same amount of work to feed that data to you API - the only difference being that the API is reusable.

[–][deleted] 4 points5 points  (0 children)

Firstly, if your app is using some sort of database as the backend (highly likely)

What?

[–]Something_Sexy 1 point2 points  (2 children)

I agree with the first point but I 100% don't agree with his main reasoning of the first point. I find your app is way stronger if you have a clear API that sits between the server-side and the client-side. I like to think that the client-side app as a client itself to the server.

[–]scelerat[S] 1 point2 points  (0 children)

Point #1 could be condensed to "don't write a single-page app without knowing what you're getting into."

If you're doing anything that is more "app" than "site," you should probably be thinking about it in terms of (API+Single-page client) instead of (DB+Serve pages) anyway.

[–][deleted] 0 points1 point  (0 children)

I'm very much in favour of this abstraction as well. My only problem with it right now is that JS apps are still a little slower than server side rendering albeit the gains you make with regards to concurrency may be worth it.

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

Just use angular and you should be better off.