开源日报 每天推荐一个 GitHub 优质开源项目和一篇精选英文科技或编程文章原文,坚持阅读《开源日报》,保持每日学习的好习惯。
今日推荐开源项目:《需求带动发展 FaceMaskDetection》
今日推荐英文原文:《You Don’t Need a JavaScript Framework》
开源日报第700期:《需求带动发展 FaceMaskDetection》
今日推荐开源项目:《需求带动发展 FaceMaskDetection》传送门:GitHub链接
推荐理由:众所周知,人类有不少需求就来自于懒惰,正是因为懒才会有那么多方便的小玩意;现在有不少需求则来自于疾病正在蔓延的现状——关于口罩的需求自然就出现了。这个项目是人脸识别的口罩特化版,实现了识别人脸是否佩戴口罩的功能,毕竟这种时候比起谁是谁的问题,大家更关心他们有没有防护措施,出去的时候还是注意保护自己为好。
今日推荐英文原文:《You Don’t Need a JavaScript Framework》作者:Dev by RayRay
原文链接:https://medium.com/better-programming/you-dont-need-a-javascript-framework-df2a36c2dd0a
推荐理由:杀鸡焉用宰牛刀

You Don’t Need a JavaScript Framework

Sometimes React, Angular, or Vue.js might be too much

Do we suffer from JavaScript frameworks fatigue? Or are we ignoring the performance and data bundles of our users?

Let’s Go Back to the jQuery Era

Do you remember those days when everyone used jQuery for everything! jQuery before, jQuery after, everything smelled like jQuery. Every website or web application included jQuery.

Why?

Developers found Vanilla JavaScript was too difficult or complex to handle. There where a lot of big differences between browsers.

Thank God those days are over! jQuery fixed a big problem for the JavaScript community. But it made most of us lazy because we didn’t understand what was going on under the hood.

For me, it all ended when this website(http://youmightnotneedjquery.com/) launched.

The JavaScript Fatigue Era

Right now, 2020 is just starting but we are making overweight websites and web applications. We can choose Angular, React, Vue.js, Svelte, or Polymer. Sorry, I won’t name all of them…

Maybe you’re thinking: “Well, go ahead and judge for yourself.” Well, that is also what I’m doing with this article. I’m very critical about my own JavaScript fatigue.

But let’s be honest. It has never been easier to start a website or web app from scratch with a single command. For Angular, we use ng new project name, for React we use …, etc.

Most of the time, we are picking what suits us the best. But we have to decrease our JavaScript weight some more and be more thoughtful on what we load into our application.

Because, maybe HTML, CSS, and JavaScript are enough.

When I talk about the JavaScript framework, I also mean the JavaScript library. Angular, React, Vue.js and Svelte are for me in this category. (Yes, there are a lot more…)

Pros and Cons of Using a JavaScript Framework

Using a JavaScript framework has some pros and cons. Because it’s about good and evil. It’s more like one’s better in one situation than the other.

I’m using Angular in my day job and like to experiment with React or Vue.js. Or trying some small JavaScript micro-library that does only one thing very well.

When You Shouldn’t Use a JavaScript Framework

There are a few situations I won’t recommend using a JavaScript framework, but rather recommend using a JavaScript micro-library or use Vanilla JavaScript.
  • Your application is simple or small. If you’re building a small project, such as experimenting with a new JavaScript API.
  • Tight on performance. When your application needs to be of very high performance, even on a low-bandwidth connection.
Every byte that is sent over the line counts. Then, it’s not smart to use a big framework. Because a JavaScript framework comes with a cost because of its overhead.

Well, there are many tools to make this more manageable. It’s better to prevent problems than to solve them.

When Would a JavaScript Framework Be a Smart Choice

There are situations where it is smart to use a JavaScript framework. But still, we need to be careful with everything.

1. Your application is big

When you’re building a big application, it could be smart to use a JavaScript framework. A framework, most of the time, comes with great support from a community.

Most of the time, a community will provide a lot of learning material that helps to build an application for long-term support.

2. You or the company values open source

The best thing about open source is that everyone can use it how they want (if the license allows it of course).

A lot of the elements of that framework are built by people that spent their free time on it. This doesn’t cost the developer or the company that is using it any money.

If a company/developer likes to contribute to a JavaScript framework, other people can benefit from that too.

3. High speed development for new features

Because most frameworks offer a lot of tools they make it easier for the developer to build new features in shorter times, they can rest on the shoulders of smart engineers that did a lot of testing for them.

Conclusion

In my story, I have more pros in comparison to cons when we talk about JavaScript frameworks.

But even though it sounds so good to use a framework, we have to be very careful with what we load onto our websites and application.

Always ask the question: “Why do I need this framework? What benefit would we have from building it ourselves or using something that already exists?”

“What consequences does it have for the user? Is a low-end mobile phone also able to use the application with the same user-experience as a high-end mobile phone?”

Thanks

Thanks for reading all this way! I hope that after reading this story you will be more careful picking a JavaScript framework, or not picking one.

Because, in the end, our goal should be building an application that has great user experience and is scalable.
下载开源日报APP:https://openingsource.org/2579/
加入我们:https://openingsource.org/about/join/
关注我们:https://openingsource.org/about/love/