Hacker News new | past | comments | ask | show | jobs | submit login

I can tell you why I dislike programming in JavaScript (those aren't necessarily faults of javascript itself):

1. Complex code usually contains some horrible callback spaghetti, which is not pleasant to debug at all.

2. General flakiness, or, as I call it, the "WTF happened?" syndrome. I run into this all the time. Change or add something - suddenly you find the web page broken. Okay, so there's a bug somewhere. Click developer tools - console... blank. No error messages, nothing. Just you and the broken web page. Just the other day I was trying to integrate a select2 input field into some angular.js-powered page and ran into all kinds of weird issues. But why does it even have to be a problem? Why can't I just stick a new control into a web page with a click and maybe a few lines of code? Hey, remember those things called "Visual Basic" and "Delphi"? UI programming with these was a blast, all the controls looked and behaved the same across all applications. And then there was ActiveX. The idea behind ActiveX is almost futuristic compared to the shit we have to put up with.

3. Type system. Made a typo in a variable name? Bad luck, Javascript will introduce a new variable and you'll have fun chasing a non-existing bug. Oh, look, here's a function: "function foo(param)". I wonder what does it do? Unfortunately, the previous maintainer has not left much comments, so now I have to dig through the implementation to find out what the parameter should be and what values the function may return.

These are my main issues with javascript. I hope sometime in the future we'll throw out the whole Javascript/HTML thing and start writing web application front-ends in a language that is more geared towards UI programming. I can imagine having a nice declarative language (instead of HTML) to describe what the interface looks like, and a statically typed imperative scripting language to describe UI behavior. It would also be awesome if these technologies allow for painless integration of independent UI components (a bit like ActiveX controls). But those are just dreams...




I hear you. I have extensions to your points and disagree here or there but, in general, all your points come down to the same thing: the developer toolchain for JS really frickin' sucks.

Web development is a pain. Web developers have to deal with at least five separate technologies to get anything non-trivial to show up on the page. HTML, CSS, JS, server-side language, persistent store. Each one brings its own config languages or preprocessors, maybe some kind of build system, and, of course, mo' tech mo' problems as they say.

(An aside: I think select2, specifically, is really beautiful and an absolute pain to actually use with any other framework in real usage)

There's some truth to the argument that JS development is merrily rediscovering development methodologies pioneered decades ago:

1. "Yay! With RequireJS I can do real dependency management!" 2. "Did you see that article on how to do conditional breakpoints in Chrome dev tools?" 3. "Using type annotations in the Closure Compiler let you add some kind of type checking!"

All that said, it is getting better:

1. Always use a linter. JSLint if you wanna cry, JSHint otherwise. 2. Callback spaghetti in JS is equivalent, in my mind, to cryptic one-line pointer arithmetic in C/C++. It's a symptom not of the language itself but of the programmer's hostility to future maintenance. 3. Declarative widget-y tech is the future of web front-ends: between AngularJS directives and the evolving Shadow DOM specification (to name two), we're moving in the re-usable component direction.

We're never going to throw out JS. Ever. Every browser vendor would have to simultaneously switch to some staggeringly amazing technology all at once as well as convert all the old browsers as well. It's not going to happen.

JavaScript, if measured by installed runtimes, is the most popular, wide-spread language on the planet. Count the devices in your home that can run JS. That's its true strength, I think.


It isn't necessary for everyone to switch to something new at once. If one big browser accommodates a different language, someone will use it. If it is popular, it will be adopted more broadly.


Not to mention, it can be compiled to javascript at first, for backward complatibility. Actually, Google's Dart comes to mind, but I haven't really used it to make an informed judgement about it...


> 2. "Did you see that article on how to do conditional breakpoints in Chrome dev tools?"

I didn't - which article are you referring to?


It was kind of a joke, but here's the Chrome developer tools page on debugging JS: https://developers.google.com/chrome-developer-tools/docs/ja...


The problem with javascript and the tooling related to it isnt something to do with the existence of great tools. Ofcourse, tools that are pretty mature and really good, as found for other languages dont exist for javascript ( like the tooling for java for ex ) but that doesnt mean there is nothing out there.

I use Intellij and I have noticed that I dont do any mistakes likes missing commas, accidental global declarations etc because my IDE ( intellij ) tells me about them. It infact corrects me when I make any such mistakes. The real problem is with people still using simple text editors to write javascript code because they dont think there is any advantage of using a full fledged IDE which does anything , because they think that there is nothing out there which actually helps.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: