6 ms·
I am a big fan of Angular (2+). While I can't exactly say I now enjoy front-end development 20 years into it, I can say it is a much more enjoyable experience
by EMM_386 5y ago
I am a big fan of Angular (2+). While I can't exactly say I now enjoy front-end development 20 years into it, I can say it is a much more enjoyable experience than it used to be.
I'm coming at it from a strong OOP background, and while people call it "opinionated" I have no problem with that. My current project is Angular v12 and C# .Net 5 for APIs and it all just works, C# developers who don't have experience with SPAs can read the code and see at a glance what is going on. "We can inject the UserService in the constructor here and get the current ID", etc.
I have worked with React but it seems to come from the other direction, JS-first, and is constantly changing how you should approach things, from hooks to routing.
- gspencley 5y agoI've worked on more React projects than Angular, and am very competent in both. I'll take an "opinionated" framework any day of the week over what I see in the React ecosystem. Every React project that I've walked into has looked completely different from each other. One common complaint about Angular is that it is "bloated." Yet every React project I've seen pulls in a million 3rd party libraries to solve the most trivial problems, and I've seen very few React apps that implement code splitting of features. So you have massive bundles being pulled into the client and the majority of code contained in those bundles are not going to be needed for a given user session because no user is going to use all features when they login. Also, JSX reminds me of PHP code in the 90s. While you can separate your markup from your view logic and styles with discipline, most React devs don't. Most components I've seen are a large hodgepodge of markup, styles and logic. Give me Angular any day of the week. - Give me view encapsulation so I can write straight-up SASS and have it scoped to a component. - Give me a template language to keep my view logic separate from my markup. - Give me dependency injection. - Give me code splitting / bundles right out of the box. Let me configure my routing without having to use components. - Give me a sane, reactive forms module out of the box. Form controls are the standard way of interacting with the end-user and so the typical front-end application will work heavily with forms in some shape or form (no pun intended). I have yet to find a decent forms solution for React. - Components should just be views. I like a framework that encourages developers to separate their concerns and get integration code, routing config, state management and the like into a separate layer of the app (and no, react hooks are not a good solution for this. They introduce tight coupling between the view and other app layers - I use them a lot, but they're no substitute for dependency injection). - Give me pipes. Formatting and manipulating string data is a very typical problem that views need to solve. In React apps you'll typically see low-level JavaScript code doing this type of stuff inside of markup.
- Oddskar 5y ago> Also, JSX reminds me of PHP code in the 90s. While you can separate your markup from your view logic and styles with discipline, most React devs don't. Most components I've seen are a large hodgepodge of markup, styles and logic. This is no doubt the biggest problem of React that no one talks about; “where do I put my business logic?” The most common solution to this is to sprinkle it all over some sort of pseudo-controller components. Even worse when it’s all hook-spaghetti. At least Angular recognises that not everything is components.
- flyingchipmann 5y agoUh, the hooks in the new versions literally solved this problem. And is backward compatible although it's somewhat painful if you work with both the class based and hook based base code base at the same time. But if you use an current opinionated package. Next.js + pure hooks based+ typescript, beats everything on the market by miles. It's not even close.
- agrippanux 5y agoYes the answer to the complaints above is Next.js + hooks + Typescript. Absolutely fine if that isn't your cup of tea, but let's not kid ourselves that a solution isn't already available.
- flyingchipmann 5y agoBut the hooks literally solved the logic problem. I know what the complain means as I have worked on old code base. But I don't see anything better than handling cross cutting logic better than hooks. A pure hook based code base is not just the best in browser, but also better any other UI technologies in other platforms I have ever seen. This is my personal opinion. Could you show me a better way?
- steve_adams_86 5y agoI think they actually agree with you, unless my reading comprehension is terrible today (I’m prepared for that to be true)
- thomascgalvin 5y ago> I'm coming at it from a strong OOP background, and while people call it "opinionated" I have no problem with that. I love opinionated frameworks, if those opinions make sense. This is the same reason I prefer maven to gradle; I like knowing how a project is set up sight-unseen. It makes onboarding so much easier. Too much of the UI world is a random hodgepodge of cobbled-together libraries, utilities, and frameworks. There's no "right" way to do anything. There's rarely even a "right" way to do something in a given framework.