Live data from Hacker News

JavaScript is Good, Actually

ashfurrow.com

61–70 of 369 posts

Re: JavaScript is Good, Actually

#61

Switching back to Java after having spent a long time in JavaScript land with modern standards made me realize how great JavaScript had become. The biggest reason for JavaScripts greatness to me is JSON. I couldn't understand how Java developers put up with such bulky ways to deal with data. After some time in Java land I've come back to appreciating its strengths again though. Code completion is nice. I'm kind of ho…

JSON has its strengths and weaknesses, and while Java doesn't have first class support for it the Jackson libraries are excellent!

Unfortunately given that java does type erasure, you don't get the kind of full featured JSON lib that Json.Net is in the .NET world. Presumably you'd have to somehow annotate to the deserializer what each individual list/array's generic type is for it to properly deserialize, separate from the type definition itself.

Re: JavaScript is Good, Actually

#62
post #31

To me JavaScript is very similar to VBA. Based on its own merits it’s a pretty average language with lots of design flaws. But it has a monopoly for what it does (browser/cross platform vs ms office scripting) and most of its users never really got a chance to solve the same problems with a better language. And like VBA, it is probably the only language known to the bulk of it user base (semi-amateur web designers vs…

The crucial difference with VBA is its openness and community-driven evolution. VBA is stewarded and designed almost entirely by Microsoft whereas there are many many stakeholders involved in Javascript, and it's certified by an independent body and has lots of different variants that complement each other. Also it has many "cousins" such as actionscript or swift which you can get up to speed quite quickly in once you know JS. I don't believe VBA has the same degree of transferable skills.

Re: JavaScript is Good, Actually

#63
post #14

Earlier quoted context omitted.

Typescript is the only reason I would consider Javascript "good." Without the type safety and the refactoring tools that type safety makes possible, applications may be easy to write initially, but unbearably difficult and time consuming (read expensive) to refactor and maintain an application of even basic to moderate complexity.

What about: - easy accessibility of higher order functions (AKA functions as a first class object from the get go) - graceful inclusion/addition of concurrency-handling functionality despite the language being single threaded (this might be much more to do with the context javascript was to be used in) I agree with your sentiments on the value of type systems and compile-time type checking, but so many languages are…

> easy accessibility of higher order functions (AKA functions as a first class object from the get go)

C and Assembly are probably the only languages left where this isn't the case.

And even C has the blocks extension on Apple platforms, although I would take the "easy" part out of it given the lifetime semantics.

Re: JavaScript is Good, Actually

#64
post #39

Semantics and configurability is what what makes a language great. JS doesn’t have function environments, i.e. every unlexical lookup goes to global/window and that cannot be redirected. It doesn’t have green threads (at least). There are generators, but one cannot just yield without marking all the functions generators too (async/await in modern terms). Stack traces are lost when generators throw(). JS has no good i…

All but maybe a few small % of the TIOBE index would fail all or some of those requirements... So while the enthusiast side of me heartily agrees with you, the professional programmer side of me has seen plenty of good code despite a lack of those features. Just because I know that better language features exist doesn't condemn every language lacking them as unusable.

Re: JavaScript is Good, Actually

#65

Switching back to Java after having spent a long time in JavaScript land with modern standards made me realize how great JavaScript had become. The biggest reason for JavaScripts greatness to me is JSON. I couldn't understand how Java developers put up with such bulky ways to deal with data. After some time in Java land I've come back to appreciating its strengths again though. Code completion is nice. I'm kind of ho…

If you don't need to exchange the data with other apps, serialization in Java is actually quite decent.

You still need to make `ObjectStream os = new ObjectInputStream(new FileInputStream(filename))); MyObject mo = (MyObject) os.readObject();` which is the most basic form I can think of (you've got to put in all them bloody `try/catches` as well don't forget, along with `public class MyClass { public static void main(String[] args) { ...` etc. etc.).

Whereas javascript you can just go `require(myjsonfile)`

I love java, but Javascript is indeed great for some of these kinds of things :-)

Re: JavaScript is Good, Actually

#66
post #43

Personally what I love about JavaScript is that it brought the basics of functional programming to the masses. Obviously it's far from pure FP, but I think it's much more at the heart of JS than it is say Python. The Scheme parts of JS are the good parts. I think some of the resurgence of FP is down to JS. The wealth of libraries available is pretty impressive [0] [0]: https://github.com/stoeffel/awesome-fp-js

I got interested in functional programming through JavaScript. It might have been React w/Redux that initially demonstrated the value of immutability and pure functions to me.

One day I got curious about monads and spent over a month trying to wrap my head around it, which obviously set me on the path to Haskell which is now my favorite thing in the world.

Re: JavaScript is Good, Actually

#67
post #28

As a long time JS dev I don't claim expertise in other languages, but every time I go back to check out new features in C++ or Java they feel more and more like JavaScript with types than "C with classes".

Actually C++ these days is moving more towards strong typing and immutability - imho the exact opposite of JavaScript...

I think JavaScript is moving in that direction too. There are some formal proposals for bringing types and community seems to like the individual attempts such as TS and Flow as well.

Re: JavaScript is Good, Actually

#68
I am primarily a C++ dev and had to use JS for web development. Having no previous scripting experience, I was gobsmacked at the ease and freedom it offered, especially wrt string processing. You need to have been a monolingual C++ dev to appreciate what I said.

I don't hesitate to say I like JS. These days I try creating any small experimental programs I need in JS and run them in FF instead of starting the whole build process with C++ code. If there is file i/o needed, I use an extention that I have created for this purpose. When necessary, converting this prototype into C++ code is not a big deal.

As for its flaws, well, which language doesn't have flaws. Part of being an experienced dev is to learn, respect and avoid the shortcomings of the technology you use, aka paying attention. Its arguable that some flaws in some systems are worse than some flaws in other systems since the design factor comes into play, but with something as pervasive and monopolistic as JS, there is a clear choice to be made - create something better for the community or shut up and live with it. I am sort of doing both. (To pull off the first one, I need some serious credeitials, which I hopefully earn in the near future.)

Re: JavaScript is Good, Actually

#69
post #28

As a long time JS dev I don't claim expertise in other languages, but every time I go back to check out new features in C++ or Java they feel more and more like JavaScript with types than "C with classes".

Actually C++ these days is moving more towards strong typing and immutability - imho the exact opposite of JavaScript...

Due to auto and templates large parts of the strong typing can be moved to the compiler. When writing modern C++ one can be quite fast (not as fast as JavaScript) but get some verification, by the compiler, which fastens development time (i.e. typos in identifiers are located easily, whereas in JS you need to run the tests and then have to find the root cause)

Re: JavaScript is Good, Actually

#70
post #43

Personally what I love about JavaScript is that it brought the basics of functional programming to the masses. Obviously it's far from pure FP, but I think it's much more at the heart of JS than it is say Python. The Scheme parts of JS are the good parts. I think some of the resurgence of FP is down to JS. The wealth of libraries available is pretty impressive [0] [0]: https://github.com/stoeffel/awesome-fp-js

Seeing JS as a functional programming language is actually the way of learning how to use it properly.
Post reply on HN