初中级 JavaScript 开发者 8 个自毁前程的习惯 [英文版]

随着就业市场对 JavaScript 开发者的需求不断递增,JS 开发者迎来了一个美好的时代。相关框架和库如雨后春笋般汹涌而出,让生活在这个时代的我们倍感幸运——特别是还有那么多开源的好项目。于是我们在日常工作中把大量的时间和精力花在与 JavaScript 相关的任务上。

但每天花费你大量时间和精力的 JavaScript 任务很有可能会在不知不觉间,为你和你的未来造成灾难。我自己就曾因为文中提到的一些习惯受苦,所以我的目标是让你不再犯类似的错误,避免你深陷苦海。

下面就是初中级 JavaScript 开发者最可能有的 8 个自毁前程的习惯。


作者:jsmanifest

TeleMedicine 前端开发负责人。个人网站:https://jsmanifest。

Photo by Markus Spiske on Unsplash

It is truly an amazing time to be a JavaScript developer, as they increasingly become higher in demand in the job market. The quick and consistent releases of frameworks, libraries, etc. make it a blessing to be alive in this era — especially with so much being open-sourced. It’s to the point where we begin to direct so much of our time and energy into JavaScript related tasks in our everyday lives.

But there’s a good chance that you might be devoting so much of your time and energy into daily JavaScript tasks that you might end up causing a catastrophe for yourself and your future without even knowing it. I’ve suffered from some of the points listed in this article in the past, so my goal is to keep you from making these mistakes so you don’t end up in misery.

Here are eight habits for JavaScript developers that will sabotage your future:


1. Using jQuery

jQuery played a huge part in the growth of the JavaScript ecosystem.

For one, JavaScript was initially just used to run slideshows and cute little widgets like date pickers and image galleries that appeared in pages. There were issues with browsers providing different behaviors and jQuery helped standardize things with its implementation of abstraction layers, and taking care of all of the workarounds with common issues in things like DOM manipulation. It helped simplify AJAX and the issues with cross-browser differences.

The thing is, however, that today those issues are no longer as relevant as before. Some of jQuery’s best features, like fetch and the selectors api, were standardized to the browser.

Modern libraries like React solve the same problems as jQuery, in addition to solving problems that jQuery currently faces, like state management.

In jQuery, you end up doing weird things like using DOM elements to be current states or data and writing ridiculously complex code to figure out what the previous, current, and next state of the DOM will be in addition to providing ways to appropriately transition to the upcoming states!

Read more on some of the modern alternatives people today are using and the benefits they bring to your web applications: React, Vue, and Angular.


2. Not Exercising

Photo by Fil Mazzarino on Unsplash

Something I haven’t really mentioned much in my previous articles is staying fit. Now I’m not some professional trainer or anything, but I watched my body transform throughout the years and I witnessed first hand experience some of the terrible outcomes you can make happen if you ignore your health.

What were some of these experiences? Well, I’ve been planning to write a detailed post about how I managed to secure my first web developer job. My journey was rocky in many ways and includes lots of emotional and inspirational details, especially for those who are self-teaching themselves JavaScript, but I will share here that I gained 32 pounds in a single year back then as a result of learning JavaScript alone. How does that happen to someone?

If you don’t exercise, you risk developing many disturbing things that can happen to your body when you gain weight.

Some of these include:

  1. Changes to your DNA by altering gene expression
  2. The extra calories you gain over time start converting to fat
  3. Increases your risk of developing migraines (including chronic ones)
  4. Your blood pressure starts to rise as weight gain can start to put extra stress on your heart

The list is endless.


3. Socially Isolating Yourself

Photo by Palu Malerba from Pexels

Your family and loved ones are important.

When you isolate yourself from your social life while learning JavaScript, you are undermining your mental and physical health leading to an increased risk of depression and anxiety, difficulty sleeping, weight loss, and feeling tired or lacking motivation.


4. Not Writing Tests

I often see people skipping unit tests for their web apps and that’s perfectly fine — until an unexpected error crashes the app. That’s when it becomes a huge problem because time and money can be lost.

That said, just because your code is able to continue compiling without errors or the app works without the console complaining, it doesn’t necessarily mean that the app is ready for formal use.

The absence of any sort of tests may be fine for small apps, but when the app gets bigger and becomes harder to maintain, tests start to become increasingly important to integrate to the app because any changes made to the existing code can break another part of the app.

Want to save time in the future for huge projects? Integrating tests will help immensely.


5. Learning Frameworks Before JavaScript

I know and understand the temptations to start developing web apps immediately using popular libraries and frameworks like React, Vue, or Angular.

I used to say “Learn JavaScript before you learn frameworks!” but my opinion has somewhat changed. Instead of going straight to learning these tools as a newcomer, the best approach is to learn them while your learning JavaScript. The JavaScript ecosystem moves at a ridiculously fast pace, and if you want to sell yourself in the market you have to have at least someexperience in tools like React, Angular, and Vue.

For example, I did a search on Indeed for “JavaScript” and here is the first result that came up:

The job description says that they require you to have jQuery and JavaScriptexperience. For this company, jQuery is equally as important as JavaScript.

Another job description requires the following “basic” requirements:

I clicked on two out of four job postings, and 50% of them required not only knowledge in JavaScript, but knowledge in the tools built on top of it as well. I wouldn’t quite recommend splitting half of your time in JavaScript and the other half into some library of your choice, however. The ratio should be more along the lines of 65% JavaScript and 35% on a front end library or framework that you went with.

Splitting up your time this way lets you still benefit from learning “true” JavaScript, while also learning a popular front-end framework to improve your knowledge in building front-end web applications. You’ll also find yourself at ease when joining discussions around hot topics like React or Vue.

But what does it mean to allocate 65% of your focus on learning true JavaScript and the rest on popular tools you wanted to immediately start with? How does that work out?

What helped me to learn the JavaScript language was reading through the free online ebook “You Don’t Know JS” by Kyle Simpson (reading) and trying my absolute hardest to get through the online coding courses at FreeCodeCamp (hands-on). You benefit from two learning perspectives. “You Don’t Know JS” does such a good job with ingraining the ins and outs of JavaScript that random parts of the book still pop up in my head today. And that has been huge to me in interviews!


6. Not Learning Clean Code Practices Earlier

Writing clean code is something every developer must do in order to call themselves a professional developer. It’s also very convenient to start learning clean code practices early in your career. The earlier you start exposing yourself to these practices, the earlier you can develop the skills to write cleaner and more maintainable code.

Learning how to write cleaner code is one of those skills that doesn’t really benefit starting later into your career as much as “learning JavaScript before a framework” does. You don’t have to experience writing ugly code at the beginning to “learn the ways” of a JavaScript developer if you can just train yourself to write clean code. Your experience will come later when reading other people’s ugly code and becoming frustrated. There’s your experience.


7. Starting on Big Projects Too Soon

Christian Erfurt on Unsplash

One of the biggest mistakes I made in my career was getting started with projects that were planned to be big.

“What’s wrong with that”, you ask?

For one, if you’re not a mid to senior-level developer, there’s a pretty good chance you won’t be able to finish this “big” project anytime soon. There are so many things to consider, especially for apps to be stable, if you aren’t exposed to the best practices in writing cleaner code, writing tests, scalable architecture, etc. if you’re still in the beginning stages.

So what happens when you’re transitioning into your mid-level developer phase and realize that a lot of the code you had written needs to be refactored because the app isn’t written correctly? The job market starts to become bountiful for mid-level developers, but you haven’t gotten the chance to put any good projects to your portfolio yet because you’ve been keeping yourself too busy with this big project you planned awhile ago. Then you start to wonder if it is even worth continuing with it while other developers are taking your glory in these job interviews. My recommended approach is to start with a bunch of small projects so that you can put them on paper! Have something to show in your portfolio as soon as possible, you never know when an opportunity will arrive.

Another problem with starting big projects too soon is that if you aren’t exposed to best practices and the right design patterns to build your features, you’ll just end up writing a lot of code that you have to refactor or abandon in the future. At that point, it’s probably best to just re-write the entire thing. You might choose to just abandon it and put the current code on your resume or portfolio anyways, but they’re going to look at the code and make some unpleasant judgments.


8. Not Learning Data Structures And Algorithms

It’s a long going debate on when you should start learning about data structures and algorithms. Some suggest learning them before you start learning JavaScript and some suggest learning them afterward.

I personally think that learning them isn’t really required when getting your foot in the door, but it's good to expose yourself to algorithms so you can have some basic understanding with computer programs and computation. Algorithms are an integral part of any kind of computation or computer program. In fact, these computer programs are just a bunch of algorithms that get combined with some fancy structured data, that’s all!


Conclusion

And that concludes the end of this post! I hope you got something out of it and look out for more posts from me in the future!


作者:jsmanifest

TeleMedicine 前端开发负责人。个人网站:https://jsmanifest。


本文首发于 GitChat,未经授权不得转载,转载需与 GitChat 联系。

阅读全文: http://gitbook.cn/gitchat/activity/5d4c482d2ffe095da8720f73

您还可以下载 CSDN 旗下精品原创内容社区 GitChat App ,阅读更多 GitChat 专享技术内容哦。

FtooAtPSkEJwnW-9xkCLqSTRpBKX

你可能感兴趣的:(初中级 JavaScript 开发者 8 个自毁前程的习惯 [英文版])