Angular 2 first impression
-
@RaceProUK Not enough JS.
-
@Yamikuronue said in Angular 2 first impression:
with minimal AJAX
So, say, no more than 7 javascript frameworks? Can I count different jquery versions and their plugins together or must they come separate?
Runs back to backend land
-
@Yamikuronue
Yeah. But not with the easy deployment path that web has.
Still. Web frontend is a fracking mess, but it's improving
-
@Jarry said in Angular 2 first impression:
But not with the easy deployment path that web has.
What? I'm still talking about web. All of this has been about web. In 1999 you could build a form that validated on blur.
-
@Yamikuronue You already know one who's done just that ;)
-
@Yamikuronue oh. That.
It's light years away from what you can do with a modern js framework. And you know it. Don't be silly
-
@Jarry Talking to modern SPA devs ,you wouldn't believe it's even possible.
I mean, yeah, when you cram a gig of JS frameworks down the pipe, a round-trip refresh is painful. But when you just send text and a little CSS, it's really not. Depending on the task, of course. Validation is a good reason to use AJAX. Submitting a post is acceptable to take a refresh hit, people have been doing it for years.
-
@Yamikuronue Not sure where you're getting the GB from. My current page has an initial load of 450 KB. And 100 KB of that are the inclusion of MathJax.
If the page is cached that shrinks to a mere 4KB.
-
@Rhywden said in Angular 2 first impression:
My current page has an initial load of 450 KB. And 100 KB of that are the inclusion of MathJax.
If the page is cached that shrinks to a mere 4KB.
Validation done server-side would probably be a few sub-1k transactions.
I like doing stuff in client-side javascript - it's often neater - but 450kb seems crazy (particularly on mobile).
-
@japonicus Yes. Validation server-side. On mobile. Great idea.
-
@Yamikuronue said in Angular 2 first impression:
I swear to jesus. I want to force everyone who calls themselves a front-end developer to do one serious project server-side with minimal AJAX and nothing else. They'd be astonished at how much can still be done.
I'm doing exactly that right now. It's pain in the ass.
I'm actually ditching all these ajax callbacks and moving everything I can to the backend. Until we dump the entire code and switch to a SPA.
-
@cartman82 said in Angular 2 first impression:
Until we dump the entire code and switch to a SPA.
I'm doing one of those right now. TBH, I'm not convinced it's better than the more traditional full-page postback. Having said that, there are a couple of pages that do benefit from AJAX, and for one of them, I'm using WebSockets to avoid long polling.
-
@RaceProUK said in Angular 2 first impression:
@cartman82 said in Angular 2 first impression:
Until we dump the entire code and switch to a SPA.
I'm doing one of those right now. TBH, I'm not convinced it's better than the more traditional full-page postback. Having said that, there are a couple of pages that do benefit from AJAX, and for one of them, I'm using WebSockets to avoid long polling.
One of the things I'm planning to implement on my page is real-time synchronization between everyone in a "room". Also a QuizDuel-like game. As the initial page load for that (if someone uses a mobile device for this feature they'll be in our WLAN) is largely irrelevant, I don't really see why I should have to reinvent the wheel just because someone is scoffing on 400 kB of data on an initial load on principle alone.
-
@RaceProUK said in Angular 2 first impression:
I'm using WebSockets to avoid long polling.
They're awesome where they work, and a total PITA where they don't.
When do they not work? When using old IE or stuck behind one of those nasty corporate proxies that time forgot. (Those things prevent most viruses from getting through, but that's just by “virtue” of ensuring nothing else gets through either.)
-
@Rhywden said in Angular 2 first impression:
Validation server-side. On mobile. Great idea.
Why not?
-
@dkf said in Angular 2 first impression:
When do they not work? When using old IE or stuck behind one of those nasty corporate proxies that time forgot.
Which is why I'm using SignalR, which uses WebSockets where it can, otherwise falling back to AJAX long polling or even an embedded invisible IFrame if absolutely necessary. And the best thing is, I don't have to worry about which it uses; it's all abstracted away both client- and server-side :)
-
@Yamikuronue said in Angular 2 first impression:
@Rhywden said in Angular 2 first impression:
Validation server-side. On mobile. Great idea.
Why not?
Business logic validation is normally better done server-side I agree, but client-side validation is good for basic 'is the user a total spanner' checks, like putting 'potato' in the field for 'departure date' ;)
-
@RaceProUK On mobile, where you're data-conscious, if you can replace a 450kb javascript file client-side with a few 1kb ajax calls and a 50kb script to invoke them, you get 400 incorrect values before you approach the same load.
-
Ok, I'm done playing with angular 2 for now. Some quick impressions.
Upsides:
-
Component based. Bye bye MVC, it was nice knowing you.
-
Apparently, pretty fast
-
Oriented towards typescript. Frankly, it's a relief after the chaos of javascript. I'm getting pretty damn tired of these fucking dynamic languages and having to keep all the data structures in my head all the time.
-
Web components and shadow DOM, with an IE9 fallback compatibility. Very interesting to work with this, angular adopts it 100%.
-
Well thought out dependency injection. Services are a straightforward relief after the redux's functional circlejerk.
Downsides:
-
Still insists on using its fugly templates and DSL. Except, directives are even fucking uglier this time, if that was possible.
-
I'm pretty well versed with frontend build systems, but even I found the angular2 landscape to be a NIGHTMARE.
It's gulp, calling the typescript compiler, then doing uglify, with source maps, except uglify would screw up source maps so line numbers wouldn't match, oh and typescript needs special annotations to find modules, except this doesn't work and sometimes it uses bower and other times npm....
Sigh. I spent more time dicking with gulpfile than coding my fucking todo app. And this was the one boilerplate template that I was even able to get working. The others I tried couldn't even resolve its modules.
Maybe the situation will improve by the final release (right now, angular 2 is beta 7 or something), but I don't think messing with this will ever be for the faint of heart.
-
Obtuse errors. A great hidden feature of react are its excellent error messages. They really went out of their way to do a bunch of sanity checks (in dev mode, at least), and try to help you figure out the problem. With angular 2, it's back to "something crashed 20 stacks deep, have fun figuring it out".
-
Boilerplate. It's insane how much rote configuration code you have to write to set up a component. They really need to "conventionalize" much of this.
-
Typescript. Yes, it's a bad thing too. There's no escaping that web world is a world of dynamic languages, not typed languages. However hard you try to create a typed little oasis in the middle of it, the reality eventually butts in. I have a feeling you'll spend a lot of time wrestling with the typescript compiler and trying to make it just accept some 3rd party library without thinking everything is an error.
React or angular? At this point, I'd still go with react. I didn't hate angular, I just didn't particularly like it either.
There's a strange sense of clarity I get when working with react. A simple conceptual model of how everything will render and update based on my actions. In this regard, angular felt more like ember - like I was balancing on top of a huge pile of jelly, trying to prod it in just the right way to get the job done, without being shaken off.
Since two giant companies are behind each of these frameworks, I suspect either choice will have a decent long term support. So it's a matter of taste mostly.
-
-
@Yamikuronue said in Angular 2 first impression:
450kb javascript file client-side
My client-side validation JS is a fraction of that size, and it's only loaded on pages that need it
-
@RaceProUK Congratulations?
-
@Yamikuronue OK, I'll put it another way.
Why do all validation server-side, which on mobile could mean several seconds for the roundtrip, when it can be done in several milliseconds on the client?
-
@Yamikuronue said in Angular 2 first impression:
@RaceProUK On mobile, where you're data-conscious, if you can replace a 450kb javascript file client-side with a few 1kb ajax calls and a 50kb script to invoke them, you get 400 incorrect values before you approach the same load.
If one doesn't really care about mobile, your gripes become largely moot.
-
@Rhywden said in Angular 2 first impression:
Validation server-side. On mobile. Great idea.
@Rhywden said in Angular 2 first impression:
If one doesn't really care about mobile, your gripes become largely moot.
uh, okay then?
-
@RaceProUK said in Angular 2 first impression:
Why do all validation server-side
I never said you should. In fact, I said validation seems like a good use of Ajax. But when validation is being held up as the primary reason to use 450kb of SPA, then fuck it, do it server-side, you know?
-
@Yamikuronue OK, your argument makes more sense to me now ;)
-
@Yamikuronue It's not me who set up this goalpost of mobile being of the utmost importance. So, move the goalpost all you want.
Also, never said that validation is the primary reason for using an SPA.
-
I'd say you don't need to do everything on the client, but there's some things you shouldn't be doing a round-trip for. Things like numbers, IP addresses, etc. which are like 10 lines of local code shouldn't be round-tripped.
-
@RaceProUK And spend ages mucking about polyfilling browsers that don't support it or support it badly. Sliders etc are fucked in some browsers that "support" HTML5
-
@lucas1 Or just find a library/module/package that has the polyfills already
-
@RaceProUK It depends what devices you are supporting i.e. do you care about Blackberry (I do) or older iPhones because things start to get weird there and the polyfills on github don't always work. Or I could use something like parsely and that seems to work on anything that jQuery supports.
-
@Yamikuronue Bandwidth hasn't been the issue in ages it is the latency between requests which is problematic and isn't likely to go away anytime soon.
I have 4G on my phone and that is 15mbps, I can stream Netflix without any problems while on the Tram.
Also it is generally faster on modern mobiles to use the SPA approach because JS rendering of the page is faster than plain HTML + CSS, this has been true from around about iPhone 5 release.
EDIT: Unless you are Jeff Atwood and decide to repaint the fuck outta the page constantly and Ajax everything to hell aka Discourse.
-
@lucas1 If you're paying $10 / GB of overages, the bandwidth matters a hella lot.
Sucks to lose your forum members because the Discoload sizes are costing them $$$$$$$
-
@izzion Browser will cache js, css etc correctly as long as you serve the right headers.
I've been streaming from Spotify pretty much constantly everyday on the way to work and I've only just started to hit 2 GB.
-
@dkf said in Angular 2 first impression:
@boomzilla He's probably also ignoring the complexity of deploying the application to all the users he needs to support. Which is a complete bear when using something written in C++ compared to just serving up HTML, CSS and javascript from a website.
Oh god that's funny.
As long as you don't take any retarded dependencies, deployment was a solved problem long ago. Browser compatibility, on the other hand, is not only still a problem - new incompatibilities are pretty much guaranteed to continue popping up several times a year forever (or at least until your favorite framework stops updating the version you are using for leading edge browsers and you are forced to re-write it in the now-totally-different version of the framework).
-
@Jaime said in Angular 2 first impression:
As long as you don't take any retarded dependencies,
Like operating system or architecture?
-
@Jarry said in Angular 2 first impression:
Still. Web frontend is a fracking mess, but it's improving
Is it, though? What metrics exactly are improving?
I guess "development time" might be improving at the cost of "literally everything else", because it seems like the selfish and awful thing all those open source-y people who make web frameworks would do.
-
@cartman82
With angular 2, it's back to "something crashed 20 stacks deep, have fun figuring it out".Is Angular 2 the long-dreaded Spring of the front-end, the Beast of Thousand Lines of Stack Trace?
I thought it's Sencha's ExtJS with its clunky API, apparently I was wrong.
-
@wft said in Angular 2 first impression:
Sencha's ExtJS
-
While there is still inconsistencies in browsers they aren't like anything like 10 years ago. There are now plenty of robust methods to detect various features.
The biggest problem these days is retards that abuse prefixes.
-
@accalia AMEN to that
-
@blakeyrat Utter rubbish. All the newer frameworks are now faster than the older ones and development is far less horrid than it used to be.
-
@lucas1 said in Angular 2 first impression:
All the newer frameworks are now faster than the older ones and development is far less horrid than it used to be.
But are they faster than webapps pre-"frameworks"?
Despite being a bloated mess, Community Server was way faster than Discourse ever was, and it's on-par with NodeBB. (Except in mobile mode, where NodeBB mysteriously gets so slow it can barely keep up with my typing.)
-
@blakeyrat You are again asking me to compare two things that aren't comparable, cannot be quantified and pre-frameworks vs framework performance actually means nothing (just vanilla js, static html ... what the fuck do you mean?).
-
@lucas1 I'll put it this way: are websites better than 2016 than they were in 2010? From the user's perspective.
I would argue at best, on-par. And the websites I use day-to-day are generally speaking worse. By doing stuff like, for example, throwing away the entire concept of WYSIWYG and replacing it with broken Markdown bullshit.
-
@blakeyrat Well it is something purely subjective and cannot be proven.
I prefer using Markdown than iffy Word-esque editors where doing anything more complicated than bolding text is an exercise in frustration.
-
@lucas1 said in Angular 2 first impression:
Well it is something purely subjective and cannot be proven.
Then give me your opinion.
-
@blakeyrat It isn't relevant to this discussion.
What is relevant:
Angular 2 is demonstrably better performance wise than Angular 1 in almost every benchmark.
-
@lucas1 said in Angular 2 first impression:
It isn't relevant to this discussion.
I'll take that to mean, "you're so right, Blakeyrat!"
-
@blakeyrat You would be wrong then.