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

Is javascript really so bad?

Edit: Why did this question get down voted? It was an honest question...




It probably is if you have to deal with > 25k LOC code base like what Angular has.


Well, there's their problem...

Edit:

Ok, for the down voters. Angular is HUGE. And all that code has to get shoved onto the client side when someone visits a page. And that's JUST for the framework. We aren't even talking about the application code yet. More and more clients are mobile. Nobody sees a problem here? You're using more (precious) data, it's slower to load and slower to run. It's just a nasty little trend going on.

NOW LET'S SEE SOME FREAKING DOWN VOTING!!!


Please don't comment about downvotes or bait other users into downvoting you. Those are rules of the site:

https://news.ycombinator.com/newsguidelines.html


Only if you have caching disabled. If you use a CDN, the library is likely already on the users computer. That said their 25k loc code base is 123kb (45kb gzipped)


I find a common theme among the people who freak out about 45-100kb of js are often the people with 3MB of images on their page.


Not unless you try to make it look like Java.


It can be a challenge for sizable codebases, especially ones with many contributors and that undergoes steady refactoring.

That feeling you get when you see code with lots of type checking... A lot of engineering effort could be recovered with static typing.


Oh, I have no problems with strong typing. In fact I think it's a good thing to add to angular. Angular, (And I say this as once upon a time contributor to Protractor) however, is kind of a step in the wrong direction, and I concluded this before they started flapping about with all these giant course corrections.


To be fair, JavaScript started out as a language that looks like Java.

"JavaScript was designed with Java's syntax and standard library in mind. In particular, all Java keywords were reserved in original JavaScript, JavaScript's standard library follows Java's naming conventions, and JavaScript's Math and Date objects are based on classes from Java 1.0" -- http://en.wikipedia.org/wiki/JavaScript#JavaScript_and_Java


That cherry picking you just made just completely reversed what was actually said in that article:

"A common misconception is that JavaScript is similar or closely related to Java. It is true that both have a C-like syntax (the C language being their most immediate common ancestor language). They also are both typically sandboxed (when used inside a browser), and JavaScript was designed with Java's syntax and standard library in mind. In particular, all Java keywords were reserved in original JavaScript, JavaScript's standard library follows Java's naming conventions, and JavaScript's Math and Date objects are based on classes from Java 1.0,[116] but the similarities end there.

The differences between the two languages are more prominent than their similarities. Java has static typing, while JavaScript's typing is dynamic. Java is loaded from compiled bytecode, while JavaScript is loaded as human-readable source code. Java's objects are class-based, while JavaScript's are prototype-based. Finally, Java did not support functional programming until Java 8, while JavaScript does, as it contains many features based on Scheme."

And read this part too, it has much relevant info: http://en.wikipedia.org/wiki/JavaScript#Beginnings_at_Netsca...


Aye, I did cherry pick a bit, sorry about that. But still, if you go to Brendan Eich's wiki page [0], it says that he wanted to put Scheme in the browser, but was commissioned to create a language that resembled Java instead. I guess he ended up doing a little bit of both :)

[0] http://en.wikipedia.org/wiki/Brendan_Eich#Netscape_and_JavaS...


> A common misconception is that JavaScript is similar or closely related to Java.

He said it looks like Java, I believe. Not "it's similar to Java".


And the article says it started out looking like Java. It didn't for long.


And you will try to do it when your codebase will become bigger.


The 90's called, they want their Java applets back.


Yes, it is really, really, really bad.

http://wtfjs.com

Whole web is a mess and people are trying to monkey-patch it.


This list has some weird examples. It's like the author makes some crazy requirements for Javascript.

For example, I don't think it's particularly bad that array[-1] and array.charAt(-1) return different values.

Also, I don't get the Math.Max() example with booleans. Seems perfectly logical to me.


> Whole web is a mess and people are trying to monkey-patch it.

That has been true for the last 20+ years, but it gets less and less accurate as time goes on. The web today is way less messy than it was even 3 years ago. The way we write JS is way less messy, the way we write CSS is way less messy. Standards have improved, lighten up.


I don't personally find TypeScript a rejection of JavaScript in the way that some other transpiled languages are. It feels to me like optional typing plus a bunch of features JavaScript will get in ES6 or beyond.


Any dynamically typed language is absolutely horrible once you break a certain line count.


Citation needed. Static typing isn't a panacea.


The parent's post doesn't mean anything, but the please don't do a "citation needed". Even if he had a citation it wouldn't mean much.

That said, static typing does help with intellisense/code completion, on-the-fly error checking, refactoring, etc...


At that point, maybe it's better to take a few paces back instead of just one. This is an example of taking only one pace back.




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

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

Search: