by davidw · 13y ago · 0 comments
* I started out with Backbone. It seems ok as far as it goes, but a bit annoying in that there's enough "magic" and stuff going on that I don't quite understand it completely, but without enough magic to really make things simple and easy.
* Angular.js. Now this is more like it in terms of magic. Then, the other day, I decided to add a date picker to one of my forms. Uh oh: http://www.grobmeier.de/angular-js-binding-to-jquery-ui-date... - how many lines of code just to make it a date picker? I couldn't have written that code myself without several more days of banging my head. Wonder what'd happen if I really try and do something it doesn't agree with... So out the window with that for the time being.
Also: a lot of these tools have tutorials that don't really walk me through all of what I want to do, which initially involves a fairly straightforward "CRUD" type of application. I want to see how the framework deals with both 'make me a new one' and 'edit an existing one' forms, for instance. I found that very irritating about the Angular tutorial, which is otherwise very nicely put together.
Now I'm testing out jquery-pjax, and... so far I'm happier. It behaves more like a web application that I'm used to, sending around HTML, and staying out of my way. And, seeing as how all of these things require that the server do its job in any case, it has more of a "don't repeat yourself" feel to it: click on the button, and the server gives us some new data, without repeating the whole MVC cycle on both the client and server. I got the idea from this post: http://37signals.com/svn/posts/3112-how-basecamp-next-got-to...
As it happens, I just completed a 4 part tutorial building an Angular CRUD app this afternoon! http://jphoward.wordpress.com/2013/01/04/end-to-end-web-app-...
The backend in the tutorial is in C#/WebAPI, but it's very easy to apply the concepts to any server - the server is tiny and very simple. I'll be doing a Python tutorial with Flask-Restless very soon.
I'd be interested to hear any feedback. I'll be adding video wall-throughs in the next week or so too.
now, i'm back to plain javascript/jquery. i run into less headaches and more control, therefore more productive. my gripe is the same as op, the "magic" is what throws me off. angular is a bit too buggy, last i used was 6 months ago, and still lot of things they didn't support like proper callbacks upon rendering, etc ...
basically something really easy to do in plain js, becomes like a rubik's cube with all the magic going on. just be prepared to write a lot of extra code/hacks/patches for certain things to just "work" if you decide to go the i.e; angular route. but don't say i didn't warn you :)
>and still lot of things they didn't support like proper callbacks upon rendering, etc
Heh render callbacks in Angular? That's so Backbone. Did you read the hello world tutorial?
also i don't know why not too many people bring up such issues as the 'if/else/switch' flagging nightmare that comes with maintaining an angular code-base. it makes your code a very verbose in that regards.
This is one of the lines in backbone.js:
if ((callback && callback !== (ev.callback._callback || ev.callback)) || (context && context !== ev.context))
I feel stuff like this takes a lot of mental power to understand the context that it is being executed in and what exactly it is doing. It feels like I am knee deep in some obfuscated C code.
It definitely gets the job done; however, I would imagine someone figures they'll come back and refactor at some point. Code is never finished, it is merely shipped. This is shipping code, but it certainly can be refactored into a more intention revealing function.
It's a trade-off. If you pull it into a new function, it adds LOC. It also is another layer of abstraction. Is it worth it? Perhaps...but maybe not. Just looking at this one line of code in isolation without context is a bit unfair though.
I'm ready to get on board with something cohesive that's Ember-ish whenever it matures.
What happens to SEO?
Wouldn't that suggest that any search-engines wouldn't have an issue indexing your site if you implement things correctly?
To be fair, you can just use Angular UI as that article says: <input ng-model="date" ui-date> for a date picker and the ui-jq directive for any other jQuery plugin.
Couldn't have said it better myself. I can't count the number of times I had been excited about learning some new framework, only to discover that their documentation is non-existent, poor, or written for rocket scientists.