4 ms·
I write and use alot of software. Normally number crunching on servers. However, I recently started seriously learning javascript. I had avoided HTML/javascript
by tlarkworthy 14y ago
I write and use alot of software. Normally number crunching on servers. However, I recently started seriously learning javascript. I had avoided HTML/javascript for years as they were horrible systems to develop in compared to every other type of software system in existence. However, with HTML 5 + cloud computing platforms I thought these systems are probably mature enough to start using. Anyway, so I learnt javascript and have now built 2 cloud apps. The first was to learn the basic ropes of GAE with JS. The second one is much nearer to to what I would consider complicated (but still one hop from my final target app). I realised plain JS wasn't scaling (regarding software entropy) so I looked at frameworks that could tidy things up. Note I have plenty of experience choosing software APIs to connect different systems together, but next to no experience of JS specifically. Anyway I tried backbone and I was like "is that it? the JS community is blown away by a fricking event model?". It seems trivial to me.
Then I tried AngularJS and I was blown away. "Yes!" I exclaimed "JS/HTML5 has truly come of age". It is a beautiful thing that saves shit tons of time. And as I have got deeper into it, I hardly write JS anymore, YOU CAN DO 95% OF PRESENTATION LOGIC IN THE HTML. You can modularise. You can ... test! Its amazing. IT WILL ENABLE YOU TO STRUCTURE REALLY REALLY BIG PROJECTS!
I hear similar evangelism from the knockoutJS community, so I am keen to try that out too, although I am getting pretty proficient with AngularJS and I personally think its got more chance of survival given its googly backers, and its more likely that chrome will start supporting AngularJS features natively. So I am betting on longevity as well as functionality with NG.
- aerolite 14y agoUgh, but this is just terrible: <input type="checkbox" ng-model="todo.done"> I guess I'm a purist.
- deleted 14y ago[deleted]
- testing12341234 14y agoAngular supports many styles of markup. Other valid forms of that snippet are: Using xml namespace: <input type="checkbox" ng:model="todo.done"> Using underscore in the attribute name: <input type="checkbox" ng_model="todo.done"> As an x-* attribute: <input type="checkbox" x-ng-model="todo.done"> As a HTML5 data attribute: <input type="checkbox" data-ng-model="todo.done"> I think their may be a few more, but in any case, Angular is flexible enough that you can choose the representation that is best for you and your team.
- joshuacc 14y agoWhat about it do you find terrible? The declarative nature of the binding? Or just the fact that it isn't valid according to the HTML spec?
- aerolite 14y agoIt's invalid HTML and it's destroying the separation between logic and presentation/content.
- woadwarrior01 14y agoThis was a deal-breaker me, when I was evaluating Angular and Ember ~6 months ago. I eventually chose Ember and things worked out pretty well.
- tlarkworthy 14y agoYou must like bloating your project with pages of trivial javascript accomplishing trivial functionality. I really don't want basic stuff in my application logic. Allowing users to flip arbitrary booleans is a bit like declaring a public variable though. You can of course make them go through a setter if you prefer encapsulation. <input type="checkbox" ng-click="setDone($event.target.checked)">
- ricardobeat 14y ago> YOU CAN DO 95% OF PRESENTATION LOGIC IN THE HTML For us developers that have fought for years for separation between content, presentation, and logic, this is the very reason Angular/Ember/Knockout are not as popular as Backbone or other frameworks.
- melc 14y agoi've been using ember for some time now for a complex application and everything seems to be clearly separated. Easily integrated with jqm and generally its model and controllers can be used effortlessly by other frameworks as well. Actually the complexity depends on the context and kind of integration.
- tlarkworthy 14y agoNote I said presentation logic, not application logic. Deciding when a button should grey out etc. is presentation logic. Its the kind of thing you fiddle with after you have your basic system done. I don't believe these minor look and feel stuff should be in the same boat as real application logic.
- tlarkworthy 14y agoNote I said presentation logic, not application logic. Deciding when a button should grey out etc. is presentation logic. Its the kind of thing you fiddle with after you have your basic system done. I don't believe these minor look and feel stuff should be in the same boat as business application logic. Note you said fighting with content, presentation, and logic. In desktop apps MVC architectures are trivial to implement, no framework necessary. HTML JS are the things that are fighting you. In angular it doesn't. Complex presentation goes in directives (custom HTML tags! Woo! OO comes to HTML). Trivial boolean stuff can stay in the HTML. Business logic goes in the scoped controllers (woo, encapsulation made easy in JS).