Javascript Why To? Là 1 programming language phổ biến nhất bây giờ

Javascript Why To? Là 1 programming language phổ biến nhất bây giờ

You can easily find information with varying degrees of correctness about “how-to” with JavaScript. I want to make a case for why-to learn to write in JavaScript. Also note that if you’re in a place like I was just a few years ago with JS, you might not actually know JS yet.

Javascript Why To? Là 1 programming language phổ biến nhất bây giờ

There are seemingly an ever-increasing number of efforts with the purpose of allowing programmers to write in some other language, like Java, CoffeeScript, C, etc., and then have a program turn that code into JavaScript for us.

I think in a lot of cases* this practice will fade once more programmers learn the JavaScript language itself. You just stop wanting it to be something it’s not.

* ASM.js, in contrast, seems to be a case where something special is happening that can not easily be replaced by simply writing correct JS manually.

You know nothing, purported JavaScript programmer.

In 2010 I stumbled onto the idea that I didn’t actually know JavaScript. At first this idea was really alien to me because: how could I not? JS had been around forever, it seemed, and I had certainly used it for… stuff. However, it turned out to be true. I didn’t know how to write in JavaScript. It’s possible to use JS nearly every day, as I was then, and yet still not really know the language.

This idea was conveyed to me by Douglas Crockford when I stumbled onto his Crockford on JavaScript talks (then posted on the YUI Theater site, now more conveniently available on YouTube). If you have never seen these talks, and you’re interested in learning JS (and a little about programming history along the way) I highly recommend checking them out.

It’s not me, it’s you.

“I hate JavaScript.”
  - everyone, at some point

I’m sure we’ve all heard this. I’ve even said it, though as I alluded earlier, I knew nothing. Also, in my own defence: AJAX and The Good Parts had not yet been discovered (yes, I’m old).

One of the phenomenons that Crockford points out is that a lot of people (most?) think they should be able to do productive work with this language without actually learning it first. It is both a testament to the power and elegance of JS and also a very strange line of thought for programmers to have.

I have found that the more I learned about the language, how it works, and, sometimes more importantly, why it works the way it does, the more my “hate” melted away and was replaced with appreciation. The wrestling match I once had with the syntax in order to make it appear more like a language with classes went away. My instinct to define functions with a name somewhere in the code and then call them from somewhere else, even when they were never going to be called again from anywhere else ever, went too.

I’d be willing to bet there are even more habits and conventions from other languages I've tried to blindly apply to JS that have since faded away.

Toy language.

“Generally the most important new innovations are received with contempt and horror.”

  - Douglas Crockford

It’s sort of strange to me now that I also once subscribed to this idea. The idea that somehow some languages were inherently inferior to other “real” languages. In all ways. Especially given that almost all of the professional programming in my life has been done using PHP.

I think the fact that languages like PHP, Python, JavaScript, etc. are referred to as “scripting languages” is sort of vestigial at this point. Almost every programmer is working on things where it is actually more beneficial for code to run on a virtual machine. This instead of directly controlling the actual machine, where lots of very bad things can go very wrong (hello, Heartbleed…). So why would a language for a system that only operates in that way necessarily be a bad thing?

The Good Parts.

I think for a lot of folks, the issue with JS comes down to the fact that it has been laden with some very bad parts. Let’s be honest though, all languages are, and JS is getting better (see ES5 strict mode). And that brings me to my other Crockford-related recommendation towards the path of figuring out JS. His book: “JavaScript: The Good Parts”.

The Good Parts is a fairly concise description of the JavaScript language, taking care to point out the Good Parts and what makes them good. The book then takes a detour into the Bad Parts, describes what makes them bad, and gives some compelling arguments on why you should avoid them.

This book, along with the talks mentioned above, set me on a path of thinking about JS in a way that I never had done before. Not as a bad, or “fake” language, but as a real language, and also an important language. But, also a different language than what I was used to, a point I had not stopped to consider.

Other materials

From The Good Stuff, I followed up with reading some other things and about some other subjects:

After going through all of this, and thinking about functional programming in general, I can say I’m glad I have. My programming with JS had improved quite a bit and, perhaps more importantly, my experience with using JS has improved: I’m happier with it now.

Why JavaScript? Well, like it or not, it’s everywhere. It’s said to be the most used programming language in the world now.

I guess what I’m trying to say is, it’s alright, there’s plenty to like. It’s ok to like it!

Additional Resources:

Drupal 8 RESTful Services - Webinar

Using Entities in a Drupal Project - Webinar

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
Apple và Samsung sẽ sớm thỏa hiệp?

Apple và Samsung sẽ sớm thỏa hiệp?

Theo cựu Phó giám đốc phát triển của Apple - Jay Elliot, tranh chấp tại phòng xử án giữa Apple và Samsung thực ra chỉ là phần nhỏ trong cuộc chiến chống lại Google của "Quả táo khuyết" và sẽ sớm kết thúc.

Viết bài PR trên Mạng Xã Hội như thế nào là hiệu quả?

Viết bài PR trên Mạng Xã Hội như thế nào là hiệu quả?

Giống như một bài viết PR tốt, hay bài thuyết trình trong thang máy ngắn gọn trong 1 phút, sử dụng status FB hiệu quả tất cả đều phải gọn gàng và chặt chẽ khiến người đọc không có một cơ hội để từ chối.

Facebook có thật sự trị giá 100 tỉ USD?

Facebook có thật sự trị giá 100 tỉ USD?

Đợt phát hành cổ phiếu lần đầu ra công chúng (IPO) của Facebook, một trong những đợt IPO được chờ đợi nhất, có thể sắp đến.

Công ty diệt chuột T&C

 

Diet con trung