Live data from Hacker News

Angular 9.0

blog.angular.io

111–120 of 308 posts

Re: Angular 9.0

#111
post #28

Earlier quoted context omitted.

React was a mistake of the last decade. React itself is a great academic idea (i.e. pure functions, composability), but the whole React-Redux boilerplate mess (I dare not call it an "ecosystem" because that word implies harmony of some sort) is the the result of an entire generation of code monkeys and job seekers who didn't design their technology stack with any real engineering consideration, but rather on the basi…

I have the exact opposite opinion. React is the only sane way to do web development. All other approaches are deeply flawed by either relying on imperative mutations of the DOM instead of clean declarative code, or by relying on ugly templating syntax and data attributes instead of just using JS basic constructs like react. The power of react is just at its beginning, as we can see with things like react-three-fiber…

I agree. I have to develop for both Angular and React for work, and I find my experience with React so much more relaxing. The logic between the what I see and what I think is straight forward. What I see is what I get. JSX is great.

Meanwhile, for Angular, I keep constantly going back to the documentation, trying to remember all the small details about templating, binding, decorators, modules, dependency injection, etc...

Re: Angular 9.0

#112
post #28

Earlier quoted context omitted.

React was a mistake of the last decade. React itself is a great academic idea (i.e. pure functions, composability), but the whole React-Redux boilerplate mess (I dare not call it an "ecosystem" because that word implies harmony of some sort) is the the result of an entire generation of code monkeys and job seekers who didn't design their technology stack with any real engineering consideration, but rather on the basi…

I have the exact opposite opinion. React is the only sane way to do web development. All other approaches are deeply flawed by either relying on imperative mutations of the DOM instead of clean declarative code, or by relying on ugly templating syntax and data attributes instead of just using JS basic constructs like react. The power of react is just at its beginning, as we can see with things like react-three-fiber…

I'm not a React hater (in fact, I like it a lot when it fits) but I think when people criticize React, they're actually after the one-size-fits-all attitude displayed in comments such as yours. No, React is clearly not "the only sane way of doing web development" considering the web hosts many types of markup applications, the most successful ones predating React by decades.

Re: Angular 9.0

#113
post #60

Earlier quoted context omitted.

For me, I was first getting into web development before Angular 2 was out. I thought it was super cool that I could make an incrementing counter and a to do list but just couldn't figure it all out. I then tried React and it just kind of made sense. Since then from the sidelines I've heard Angular has gotten much better but personally don't see any reason to use anything other than React at this point in time.

I’m also starting to feel like if anything will dethrone React, it’ll probably be Vue or Svelte.

[deleted]

Re: Angular 9.0

#114
post #70

Earlier quoted context omitted.

Then why are all the React-based web apps I use so slow?

Facebook and Twitter are slow?

Facebook absolutely is, it's a beast. I find it can frequently freeze up my old laptop, which is admittedly getting past it but I have little trouble with most any other site.

I don't use Twitter, so can't comment.

Re: Angular 9.0

#116
post #80
post #28

Earlier quoted context omitted.

React was a mistake of the last decade. React itself is a great academic idea (i.e. pure functions, composability), but the whole React-Redux boilerplate mess (I dare not call it an "ecosystem" because that word implies harmony of some sort) is the the result of an entire generation of code monkeys and job seekers who didn't design their technology stack with any real engineering consideration, but rather on the basi…

React != redux. I really like react, I really hate redux, so I use react without redux and it works just fine (we actually use tracker+minimongo from meteor for our app state and really like it)

My enjoyment of React grew exponentially once I moved from Redux to MobX.

Re: Angular 9.0

#117
I have a policy of only shipping "back-end" apps because I'm worried about performance, browser compatibility and SEO. I don't know if the situation has improved in Angular 9.

Does anybody here use Angular for their customer facing websites?

Re: Angular 9.0

#118
post #86
post #28

Earlier quoted context omitted.

React was a mistake of the last decade. React itself is a great academic idea (i.e. pure functions, composability), but the whole React-Redux boilerplate mess (I dare not call it an "ecosystem" because that word implies harmony of some sort) is the the result of an entire generation of code monkeys and job seekers who didn't design their technology stack with any real engineering consideration, but rather on the basi…

Oh man, don't say it. I've just started to learn React to improve my chances of landing into my first job, since all Java positions are either full-time or requires >4 years of previous relevant experience.

I wouldn’t worry about that. React won the framework war in most industries. The only places who really utilise Angular in my area are the same companies who build the JAVA backends you can’t get hired for, and even some of them are switching to react.

All in all you shouldn’t worry too much about employability if you pick and stick with something popular. Check your local job-market and stop worrying about what’s hipster cool on HN. There hasn’t been a single Rust or Go job listing in my entire region of Denmark for an entire year, mean while there are currently around 150 PHP positions open right now.

Re: Angular 9.0

#119
post #98

Earlier quoted context omitted.

I wouldn’t say the same no matter the domain - junior devs can and will surprise you, and because React gives you less guardrails for app architecture, it likely has the potential to go far worse.

Well obviously they'll be CR'd. If you stick to prop drilling and functional code there's far less you can do abjectly wrong.

Except wire up routing in a strange way, or pick a library for form validation or form framework, or come up with odd ways of structuring tests, picking a strange approach for animations, etc.

This is the cost when app architecture gets delegated to your developers over a high quality central solution, the quality is as good as your developers.

Re: Angular 9.0

#120
I've been going down the long road of learning Angular recently, and I love it and want to learn more, but I have a couple naive newbie questions whose answers I thought should be obvious, but I haven't been able to figure out:

Is there a standard way to define local variables in an Angular template so you don't have to repeat the same redundant expression again and again (or so you can at least give an expression a self documenting variable name so it's not so mysterious)? Or do you have to define an instance variable on your component and figure out how to initialize it to the right value before the template gets executed, with no way to lazily (or repeatedly) evaluate it by putting the calculation inside conditionals (or loops) in the template so they're not run if they're not needed (or to calculate the local variables independently for every loop iteration)? Is there an angular hook or technique that's meant for that, and efficient, and hopefully doesn't involve much arbitrary non-JavaScript gobbledygook syntax, and is at least somewhat standard and well supported? Please don't tell me I shouldn't ever want to do that for some reason of ideological purity or separation of concerns (as if a templating language could ever be called "pure" or "elegant"). The common legitimate use case is ngIf="some expression is not null" then {{some expression}}, and also ngIf="some expressions" ... ngIf="not some expression".

I googled for it, and the solutions of "abuse ngIf's special goofy syntax to name the result of the condition and pray to God it's truthy or don't bother" and "abuse ngFor to loop over an array of one item to give it a name" are not acceptable answers. There were also a few competing and possibly out-of-date "install this non-standard ngLet directive that I hacked up but don't support, but don't call it with an "ng" prefix because that's reserved for the Angular team" -- but isn't there a standard way of doing such a simple essential thing, that the Angular team already thought of and included, such that other people will have some clue what's going on when they see it? And it would be nice to be able to define more than one variable at once per begin/end tag, if you know what I mean. Maybe even without using any begin/end tags, perchance to dream?

Also, is there a way to easily define simple light weight macros ("snippet reuse") so you can repeat the same pattern in one or more components, without defining a whole component in all its glory and splendor with multiple files that other multiple files need to import and declare? Or even a global file of shared macros that a bunch of other templates can import, like the globally shared css declarations you can include in local css files? I've seen "ng-template", but I am having a hard time getting my head around it, compared to the simplicity and power of Genshi's py:match, that's based on xpath, and py:def, that precisely follows Python function calling conventions and that you can easily call from any normal expression. And py:match is quite useful for defining concise custom tags (or xpath patterns) that can wrap embedded content. In comparison, ng-templates seems quite clumsy and limited, and confusing about calling and scoping and passing parameters and content, which is nothing like standard JavaScript calling conventions, and reminds me more of the abomination that is Zope METAL templates.

https://zope.readthedocs.io/en/latest/zopebook/AppendixC.htm...

https://en.wikipedia.org/wiki/Template_Attribute_Language#ME...

https://en.wikipedia.org/wiki/Zope#Zope_Page_Templates

I've been using and loving Genshi with Python for more than a decade (and before that, Kid, which Genshi is almost the same as, and before that Zope page templates, TAL, and METAL templates, which inspired Kid and Genshi, but totally sucked), and I love its ability to drop into Python with to define some variables or import some functions locally in the template that you can use, with real honest to god multi-line indented Python "if" statements for logic (and Python comments for, err, commenting) instead of Christmas trees of deeply nested ternary ? : operators (or rather postfix conditional "foo if bar else baz" Python expressions). Genshi also has "with" for defining scoped local variables with tags, like $x $y $z.

And I also love Genshi's py:def for making locally defined or libraries of includable imperative "code snippet" templates you can call just like Python functions (with glorious optional named defaulting args, etc), and py:match for declaring xpath pattern matching templates that can wrap html content as a parameter (so the macro can cherry-pick out and transform different parts of the passed content with xpath), as well as taking attribute parameters.

Another nice feature of Genshi is that for all directives it supports both the attribute form like ... attached to an element that you want to keep, or the element form that dissolves without leaving an element, like ... . You can also attach multiple directive attributes to the same element, thanks to the way it executes them in a well defined ordered hierarchy that makes practical sense (like "for" above "if", so each iteration of the "for" loop can be conditionalized with its own "if" evaluation), and "def" above all else, so you can define a single tag macro that loops over something then conditionalizes each iteration, then sets attributes on and adds content to the included elements. It's quite concise and expressive!

https://genshi.edgewall.org/

https://genshi.edgewall.org/wiki/Documentation/xml-templates...

py:def

https://genshi.edgewall.org/wiki/Documentation/xml-templates...

py:match

https://genshi.edgewall.org/wiki/Documentation/xml-templates...

Processing order of multiple attributes (precedence rules you must remember, but they make practical sense, and at least Genshi is quite minimal and only has a few directives): py:def py:match py:when py:otherwise py:for py:if py:choose py:with py:replace py:content py:attrs py:strip

https://genshi.edgewall.org/wiki/Documentation/xml-templates...

These two features (local variables and code snippets) are so important to me, and I'm having such a hard time figuring out how to do them in Angular, that I feel like there's whole a chapter in the Angular templating manual that I missed somehow. Thanks for any tips on how to do this kind of stuff with Angular templates!

I've written more opinions about Genshi and templating on hn before:

https://news.ycombinator.com/item?id=8445252

https://news.ycombinator.com/item?id=10842990

https://news.ycombinator.com/item?id=12365442

https://news.ycombinator.com/item?id=12527839

https://news.ycombinator.com/item?id=16677520

https://news.ycombinator.com/item?id=20745676

https://news.ycombinator.com/item?id=10842902

Post reply on HN