3 ms·
One of the big issues I see with JS is a bit of an abstraction problem. See, in the Java world, lambdas were introduced, and I can write code with them using R
by kuschku 10y ago
One of the big issues I see with JS is a bit of an abstraction problem.
See, in the Java world, lambdas were introduced, and I can write code with them using RetroLambda, and it will run on old JVMs, too.
But Java 8 has them natively.
And I can write a modern Java8 project with nano and javac. No transpilers, nothing.
While in the JS world, even now that browsers are starting to support ES6, everyone just adds more and more steps to the build process, instead of trying to simplify them.
Ideally, if I write code, I want it to be simple, without any such tools.
I want to be able to write one file containing dependencies, my code in a few files, execute one command, maybe two, and have a fully working product. And have it work for years, even while dependencies update.
One config, one command, and my code. Not any single LOC or invocation more.
That’s doable with JS – you just need a dependency format where dependencies can define macros over the language, and they’re handled by a transpiler or compiler, and you can import them normally. And just like that, a lot of this stuff would go away. TypeScript would just use its own frontend to the transpiler, and in your config you’d just define a different plugin.
In the gradle and java world, all that exists, with language-plugins, and annotation processors.
Yet in the JS world, it’s not like that, you have dozens of abstractions on top of another.
> This is solved by understanding the language and the tools you are using.
The problem is that the JS world is simply more complex than the Java world.
A helloworld JavaFX app is about 30LOC of config, and 20LOC of code and imports. And compared to a production JavaFX app, no more config will be added. It’s just that. That’s all you need. And easy to understand.
For React, it’s an entirely different beast (see the mentioned link)
- treehau5 10y ago> While in the JS world, even now that browsers are starting to support ES6, everyone just adds more and more steps to the build process, instead of trying to simplify them. To build on your Java comparison -- this is would be akin to using a new feature that is still in the JSR approval process, and then downloading an edgey JVM platform (maybe OpenJDK nightly, or something like that) and then complaining when your app gets more complicated. The solution to that problem is to stick to the stable syntax until the new becomes fully supported. Admittedly, this is a problem with browsers where instead of 1 environment, there are 8 with some 1 offs, but again, there is IBM JDK, OpenJDK, Oracle JDK, Android Java (whatever that's called, Dalvik or something?) > The problem is that the JS world is simply more complex than the Java world. I strongly disagree. Have you seen "enterprise fizzbuzz"?* I don't mean disrespect but you are kidding yourself if you think Java isn't as complex (if not more) than the current JavaScript ecosystem. I spent 6 years programming in Java and never felt I scratched 10% of the surface. * https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris...
- kuschku 10y ago> I strongly disagree. Have you seen "enterprise fizzbuzz"?* I don't mean disrespect but you are kidding yourself if you think Java isn't as complex (if not more) than the current JavaScript ecosystem. I spent 6 years programming in Java and never felt I scratched 10% of the surface. But that’s the point. That’s all just code. Just normal code. Not additional command line utilities. Even Enterprise FizzBuzz can be compiled simply with gradle or maven. No processors. No transpilers. > To build on your Java comparison -- this is would be akin to using a new feature that is still in the JSR approval process, and then downloading an edgey JVM platform (maybe OpenJDK nightly, or something like that) and then complaining when your app gets more complicated. But I can do that. And I just have to import one single plugin – https://github.com/evant/gradle-retrolambda https://github.com/evant/gradle-retrolambda, and never configure it! Nothing to configure, nothing else. One import, and I’m done. Look at that fizzbuzz enterprise build.gradle, it’s 29LOC! The problem of "good defaults" was never even considered in the JS world, it seems.
- treehau5 10y agoAgain, this is not a good example of why the javascript ecosystem is worse / java is better. > But that’s the point. That’s all just code. Just normal code. Not additional command line utilities. First, Maven does not come standard with java. Second, in a previous reply, I mentioned that if you are not comfortable with the latest and greatest, then stick to the current standard. There is nothing wrong with that, and you can be productive. If transpilers and babel seems too scary to you, which given you mention maven and gradle I assume not, then don't use them, use polyfil, which is just like that retrolambda you linked. Most all of ES6's features are sugar anyways. Your intimate knowledge of tools and frameworks for the Java ecosystem will not equal another. What's a plugin? Ohhh you mean OSGI? No? Oh well I am lost. What is gradle? Oh it's a new build tool? Well sorry I only know ant, and my coworker uses sbt. He's hipster like that. > The problem of "good defaults" was never even considered in the JS world, it seems. touché for java.