6 ms·
It's all about scaling of complexity and number of engineers working on the project. No doubt hand rolled js is better when you only have to do the one thing yo
by savanaly 5y ago
It's all about scaling of complexity and number of engineers working on the project. No doubt hand rolled js is better when you only have to do the one thing you mentioned and you're the only person who has to read or write the code.
What happens when it's one of hundreds of checkboxes on the site? When they all do slightly different things depending on user sku, product page, file type, file permissions, god knows what else. And when one experiment flag is on or how about this other one? Then i18n? Then what about the fact that after you write this line countless other engineers will see and modify it in the future, it's not just you writing and maintaining it? These are the problems that my company (and, I assume, Publicis Sapient with 20,000 employees according to Google) have to consider when choosing whether to hand roll JS or use a framework.
- simonw 5y agoThen you can switch to something like React. But most projects won't ever get close to the level of complexity you are describing. Meanwhile I have seen SO MANY sites that use full React for a contact form with two fields on it.
- arcturus17 5y agoYou don't need to get close to that level of complexity for React to become useful. > Meanwhile I have seen SO MANY sites that use full React for a contact form with two fields on it. I agree that the contact form you describe would be dead-easy to do vanilla. Maybe throw in Parcel if you want to write ES6. However, while I suspect some people may use React in this case because it's all they know, others may do it because they are literally faster in React - they have a workflow that can see them code and deploy such a website to Netlify or Heroku or whatever in 10 minutes.
- hajile 5y agoPreact to render the view and a dozen lines to handle the submission and data in a closure are still likely an easier solution than vanilla JS.
- joesb 5y agoWhich is fine if your company and teams use React a lot. Why introduce inconsistency in everyone's workflow just because this specific page is a simple contact form? The fact that it is just a simple contact form is exactly why you should use the same tools and workflow that everyone in your team has already been using. Write what other people knows so you don't have to be the one maintaining it.
- QuadrupleA 5y agoEverything a programmer does is "hand rolled" whether it's JS or JSX. You'll still have to tackle those complex requirements and come up with a good design that organizes things and makes them manageable, whether you're using React and JS or just JS. To say that a good design is just impossible with JS or that no other engineers could possibly understand the resulting code seems absurd. Javascript is a Turing-complete language. It gives you a lot of design options. Your poor engineers will have to learn it to use React anyway so why would vanilla js necessarily be worse than js plus a giant framework?
- csande17 5y agoI once worked at a place that thought like the grandparent comment. "We're gonna have a huge app with lots of different UI variations. Let's use React. Then it will be super maintainable and scalable!" And then it turned out that if your plan to write maintainable code starts and ends at "use React", you will end up writing code that is not maintainable, and your framework will not save you, and in fact you will be fighting framework-induced bugs and performance issues on top of the problems caused by your total inability to design computer programs. The pace of software development at your company will grind to a halt, you will accept this as the only possible state of affairs (we're following all the best practices by using React!), and your company will limp along for a while and then go out of business.
- bayesian_horse 5y agoIt's more about the programmers than the underlying technology. But with react (and redux etc) very smart and experienced people have already put some thought into things like maintainability, and your chances of achieving success from the shoulders of these giants are higher than by starting from scratch. Unless you don't need to reach that high.
- csande17 5y agoI don't think that's really true. React doesn't give you less problems, it just gives you different problems that aren't as immediately visible because you haven't learned to look for them yet. For example, if you're used to thinking that every page of a web app can be tested individually, you won't notice bugs in single-page apps that only happen when using specific links to arrive on pages in a specific order.