3 ms·
I used Angular1 for years. Then Angular2 for a while before being assigned to a React project. Then elm for 3 years, and now back to React. So really now idea h
by matsemann 5y ago
I used Angular1 for years. Then Angular2 for a while before being assigned to a React project. Then elm for 3 years, and now back to React. So really now idea how ng looks today.
But one thing I really liked about ng was directives. It allowed you to compose and reuse stuff, and attach multiple behaviors to the same node that could cooperate. Of course it could end up being hard to grok sometimes. But for instance having various input components, and then being able to attach various validation directives to those seamlessly in the html was very nice. Almost like an entity-component-system in game programming.
React does something similar now with hooks (didn't exist when I used react the first time). Allowing you to compose stuff more easily compared to when class-based. But still have to write the glue code between all hooks in a component, though that makes it more visible what's going on.
- cies 5y agoWhat are your thoughts on Elm? And why did you switch (if it was be choice not merely a change of jobs)?
- matsemann 5y agoChange of jobs, yes :) I'd use elm again if given the opportunity, certainly. Enjoyed it very much. But I wouldn't evangelize my current company to switch, exactly. While it's not hard to learn elm, everyone here already knows react. And while elm leads to very robust code with little bugs and no runtime errors, it's at a cost of implementation speed, not everything is straight forward to write the elm way.
- cies 5y agoThanks! > everything is straight forward to write the elm way. Same could be said for React and Angular I guess; but mainstream drama is easily forgotten. :)
- matsemann 5y agoYes, but in React for instance, you could always do something "dirty" if you want. Like adding a class to some random parent element when a modal is showing from within deep down in the component tree, and remove on unmount, and also trigger a google analytics event. In elm, the GA event is a side effect, so it has to come from your update function, using a port out to JS. So it has to be triggered by the same conditions showing your modal. Sometimes that leads to that logic being duplicated. And the modal either the same to trigger some js code to set the class, or set a value on your main model somewhere and edit the render function of that specific element to take the new classname into account (so have to modify some other part of the code). Of course, it leads to maintainable code with little surprises. But at a cost of a stricter way to do it.
- girvo 5y agoI say this as someone who adores Elm and has used it in production twice: React et al. have escape hatches that Elm by design doesn’t.
- simion314 5y agoI personally hate angular1 architecture(I did not tried the rest), some of my reasons are 1 instead of pure code you use markup like ng-repeat , ng-if , this causes weird bugs and weird errors and not clear scoping issue. I prefer the old react architecture(not sure if modern react is still sane) where instead of ng-repat item in items you could have pure JS code like items.foreach(renderItem(,,,)). It is a personal opinion but I prefer to see my code to run when I debug rather that my markup getting "compiled" under the hood and not seeing the actual code. 2 I dislike the error mesages, the stack traces are useless 3 the performance is terrible, it is super easy as a SPA grows to get too much updates triggering , this might have been solved with new versions and maybe a more component oriented architecture but still the way data binding and update cycles works is pure performance insanity. 4 sometimes shit does not work, maybe you have a typo and you get no warning, maybe there is some scope conflict, maybe you forgot to add some attribute, maybe the data-binding fails and you need to always apply "that workaround" but I wasted a lot of time on problems like "why is this element not updating", at least the devs could add some extra checks and warn when something is not right, I manage to write some code and add this extra checks but is not that well tested. This is personal opinion, angularjs is not targeted for developers like me, I worked with Qt, GTK, Windows Forms and WPF, I think i done a bit of MFC, Flex4, React , Swing and angular is the worst one for my personal taste. I thin Flex4, Qt and WPF are better architected and more powerfull, you can do simple and modareate things fast but you still have flexibility to do everything. With angular you can do Hello World fast, after that it is a pain, and a giant pain when you need to maintain a fea years old code base made by a newb angular dev team.
- jaywalk 5y agoAngular (Angular 2) is nothing like AngularJS (Angular 1). The biggest mistake they made with Angular 2 was the name.
- simion314 5y agoIf the architects of Anuglar >=2 are the same people then i do not have high hopes, they probably fixed some of the issues but for me personally the architecture is broken. Let me know if they brought some competent(for this task) developer for angular2 and I might have a bit of hope but I would never chose angular if I ever had a chance to start something new.
- phaedryx 5y agoSounds like you might like Vue. It has directives for HTML which I like better than using JSX and it has a composition style now that I like better than React's hooks. https://v3.vuejs.org/guide/composition-api-setup.html https://v3.vuejs.org/guide/composition-api-setup.html