Click here to Skip to main content
15,891,633 members

Survey Results

Favourite C-style language

Survey period: 27 Jun 2016 to 4 Jul 2016

It's been a while since we've had a religious brawl.

OptionVotes% 
C1778.35
C++33215.65
Java1175.52
Objective-C140.66
C#1,32362.38
Javascript / ECMAScript723.39
Go130.61
Swift170.80
D120.57
Other442.07



 
GeneralRe: Who voted JavaScript!? Pin
Sander Rossel26-Jun-16 21:42
professionalSander Rossel26-Jun-16 21:42 
GeneralRe: Who voted JavaScript!? Pin
hooodaticus28-Jun-16 5:41
hooodaticus28-Jun-16 5:41 
GeneralRe: Who voted JavaScript!? Pin
Marius Bancila26-Jun-16 23:46
professionalMarius Bancila26-Jun-16 23:46 
GeneralRe: Who voted JavaScript!? Pin
Sander Rossel27-Jun-16 2:04
professionalSander Rossel27-Jun-16 2:04 
GeneralRe: Who voted JavaScript!? Pin
CDP180228-Jun-16 4:57
CDP180228-Jun-16 4:57 
GeneralRe: Who voted JavaScript!? Pin
Leng Vang28-Jun-16 7:46
Leng Vang28-Jun-16 7:46 
GeneralRe: Who voted JavaScript!? Pin
Sander Rossel28-Jun-16 8:22
professionalSander Rossel28-Jun-16 8:22 
GeneralRe: Who voted JavaScript!? Pin
Ryan Peden29-Jun-16 4:40
professionalRyan Peden29-Jun-16 4:40 
I like it, and I find that ES2015 has eliminated many of the gripes I've had with it in the past. Having an actual module system is much nicer than just relying on libraries you need being available in the global namespace. Using const and let where I would have used var in the past gets rid of scoping and hoisting issues for the most part.

Using ES2015 makes it necessary to run your code through a build process to generate ES5 that will be compatible with all browsers. I find this to be a benefit, though. A decent amount of static analysis is possible even in a dynamically typed language like JavaScript, so tools like ESLink or Google's Closure compiler are able to find a decent numbers of errors and in the case of Closure, do lots of optimization and dead code elimination as well.

Source maps are generated as part of the process, so the original ES2015 code shows up in browser dev tools instead of the mangled and optimized ES5 generated by the compiler, and normal debugging tools like watches and breakpoints generally just work. I had some issues with source maps and browser debugging tools not working well in the past, but it's been about a year since I've encountered any problems there.

I know some people hate the idea of adding a compilation step to the JavaScript, but I figure if I'm not going to get angry at C# for having a build process, I shouldn't get too upset about using one for JS. The build isn't going to catch type errors in a dynamically typed language, of course, but it can catch plenty of errors you might otherwise miss.

As you've alluded to in some of your replies to other people, a lot of confusion happens because JavaScript looks a lot like C++ or Java, but the semantics are quite different. I approached JavaScript after toying around with Smalltalk, Scheme, and Common Lisp, so a lot of what I saw (first class functions, why this works the way it does, etc.) made sense. Although now even C++ will let you dome something like auto add = [](int a, int b) { return a + b }. You can use JavaScript's looseness to your advantage sometimes; if you understand the difference between == and ===, there are times when == provides exactly what you want.

Or if you're working a library that is a bit wonky (a phenomenon that certainly isn't unique to JS - I've encountered lots of the in the .NET and Java ecosystems too), you might want to perform a certain operation only if a value you get back is not null, or undefined, or zero. In that case, it's nice to be able to write
if (foo) { doSomething() }
rather than
if (foo != null && typeof(foo) != 'undefined' && foo != "") { doSomething() }


I guess what it comes down to is that the language has quite a few pitfalls and some historical baggage. It's possible to avoid all of these and focus on the modern bits, and when I do that I find JS development quite pleasant. It's a non-trivial amount of work to learn all of that, though. Many developers use JS as a secondary language to occasionally add some interactivity to a web page, and for most of them there's not a huge ROI in becoming a JS expert.

Then there are those who just hate JS because it is dynamically typed. I often see people getting very worked up, writing passionately about why dynamic typing is the work of the devil. They often mix up static vs dynamic typing and strong vs weak typing, ignoring the reality that some languages are strongly typed and dynamically typed (like Python). I try to stay out of those flamewars because they often just boil down to the old liberal and conversative software engineering dichotomy where the respective see the other as degenerate hippies or something like this.

I've been on both sides of that debate at various points in time, so I'm sympathetic to both points of view. Now that TypeScript makes it easy to gradually add static typing to existing JS code, maybe the two sides can find a way to peacefully co-exist and prosper. Smile | :) These days when I'm working on personal projects I tend to wander off in Clojure land, building apps from the ground up and then adding typing when it makes sense.

So at the end of the day, I completely understand why many people dislike JS. However, the question was about why I might vote for JS, not why anyone else should. Hopefully what I've written helps explain that. I like both C# and JS quite a bit, and couldn't decide which one to vote for. So I voted for Objective-C because it was looking pretty lonely in the poll results. Poke tongue | ;-P
GeneralRe: Who voted JavaScript!? Pin
Sander Rossel29-Jun-16 10:40
professionalSander Rossel29-Jun-16 10:40 
GeneralRe: Who voted JavaScript!? Pin
Ryan Peden29-Jun-16 10:44
professionalRyan Peden29-Jun-16 10:44 
GeneralRe: Who voted JavaScript!? Pin
Sander Rossel29-Jun-16 10:47
professionalSander Rossel29-Jun-16 10:47 
GeneralRe: Who voted JavaScript!? Pin
Your Display Name Here30-Jun-16 10:54
Your Display Name Here30-Jun-16 10:54 
GeneralRe: Who voted JavaScript!? Pin
Ryan Peden30-Jun-16 11:04
professionalRyan Peden30-Jun-16 11:04 
GeneralRe: Who voted JavaScript!? Pin
Your Display Name Here30-Jun-16 11:35
Your Display Name Here30-Jun-16 11:35 
GeneralRe: Who voted JavaScript!? Pin
Ryan Peden30-Jun-16 15:07
professionalRyan Peden30-Jun-16 15:07 
GeneralC++ Pin
den2k8826-Jun-16 21:26
professionalden2k8826-Jun-16 21:26 
GeneralI really like... Pin
Super Lloyd26-Jun-16 19:35
Super Lloyd26-Jun-16 19:35 
GeneralCUDA and OpenCL Pin
Shao Voon Wong26-Jun-16 19:33
mvaShao Voon Wong26-Jun-16 19:33 
GeneralI wanted to put C Pin
PIEBALDconsult26-Jun-16 19:16
mvePIEBALDconsult26-Jun-16 19:16 
GeneralRe: I wanted to put C Pin
KarstenK26-Jun-16 21:42
mveKarstenK26-Jun-16 21:42 
GeneralRe: I wanted to put C Pin
TheLonelyCoder27-Jun-16 1:26
professionalTheLonelyCoder27-Jun-16 1:26 
GeneralRe: I wanted to put C Pin
PIEBALDconsult27-Jun-16 3:18
mvePIEBALDconsult27-Jun-16 3:18 
GeneralRe: I wanted to put C Pin
hooodaticus28-Jun-16 5:42
hooodaticus28-Jun-16 5:42 
GeneralDepends Pin
Alaa Ben Fatma26-Jun-16 19:04
professionalAlaa Ben Fatma26-Jun-16 19:04 
GeneralI know there's a million more... Pin
Chris Maunder26-Jun-16 12:53
cofounderChris Maunder26-Jun-16 12:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.