6 ms·
I simply don't understand how can someone like javascript (or anything derived from it) when there are so many much better languages around. Can someone state s
by edem 10y ago
I simply don't understand how can someone like javascript (or anything derived from it) when there are so many much better languages around. Can someone state some advantages for web development for example compared to ruby, python, or clojure? All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules and a language which is even more poorly designed than PHP. Is it just because of node.js and the promise that you can use javascript from database to frontend?
- seanwilson 10y agoWell you don't have much choice for frontend for one. Typescript offers much stronger typing than Ruby, Python, Clojure and PHP as well.
- winter_blue 10y agoIf I were to start a new project today, I would use Elm[1] for the front-end. It's a very well-designed language (reminiscent of Haskell), specifically designed with HTML and DOM manipulation in mind. [1] http://elm-lang.org/ http://elm-lang.org/
- chriswwweb 10y agoIs using elm really worth it? I have not yet tried elm, but I wonder if it's advantages really justify the increased costs that this choice might bring? Isn't elm a little bit too young? I mean is the time you and your coworkers will need to learn it, the increased difficulty to hire skilled elm developers, the increased difficulty to find good training courses for new junior developers you hire, the increased difficulty to debug the code compared to js, the lack of third party libraries ... really worth it?
- winter_blue 10y ago> the increased difficulty to debug the code compared to js Elm has an amazing time-traveling debugging system: http://debug.elm-lang.org/ http://debug.elm-lang.org/ This is a cut above pretty much every other front-end JS framework, and languages that transpile to JS. > the lack of third party libraries It has JavaScript interop that's based around message-passing. The JS library is treated sort of like a service, and thus the Elm code is kept isolated from it: https://guide.elm-lang.org/interop/javascript.html https://guide.elm-lang.org/interop/javascript.html > the increased difficulty to find good training courses for new junior developers you hire The official docs are pretty good. A good programmer shouldn't have a trouble picking it up. The architectural benefits of using Elm (that lead to a high-quality, almost zero bugs website) is IMO worth it.
- leshow 10y agoIMO actually decreases costs because of the amount of errors the type system catches and the ease of refactoring. Elm also guarentees to NOT produce ANY runtime errors, that's quite a guarantee.
- seanwilson 10y agoSounds interesting and I'd love to code in a real functional language instead of functional style in an imperative language. I haven't looked into Elm but isn't this going against the grain too much? TypeScript seems to be gaining traction such as with Angular 2. I mean I could code in OCaml with a transpiler to JavaScript if I wanted to but it probably isn't worth the friction.
- Wintamute 10y agoSurely by using Elm you may improve the quality of your program, but you restrict your staffing choices down to the <1% of frontenders who either know it already, or are capable of quickly picking up a Haskell-esque language. Either that or you commit your client to huge up-front training costs. Or how about the scenario that goes like: "The contractor who wrote our web app in Elm left last month, but we need some bug fixes or complex feature adding. Can someone fix it? Anybody? No?" How do you sell that to a client?
- pjmlp 10y agoFor me frontend == native, so I have plenty of choices.
- edem 10y agoStronger typing than clojure? You gotta check out clojure.spec which is built into the language itself.
- seanwilson 10y agoAh, I'm not that familiar with Clojure. Is that commonly used? Are there any good examples of complex properties you can capture with its type system?
- edem 10y agoSee for yourself, Stuart Halloway (clojure committer) can explain it much better than me: https://www.youtube.com/watch?v=VNTQ-M_uSo8 https://www.youtube.com/watch?v=VNTQ-M_uSo8
- edem 10y agoYou have actually. For example ClojureScript compiles to JS.
- ceronman 10y agoI am a Python fan and I'm not a huge fan of JavaScript, but I do understand why many people love using JavaScript/TypeScript: 1. It's available in the Browser which opens a lot of possibilities. Yes, there are transpilers for other languages but it's not the same. 2. On the server side is really fast. In fact JavaScript is one of the fastest dynamic languages out there. Much better performance than Python (even with PyPy), Ruby or Perl. 3. With TypeScript you get amazing IDE support. Which is something that you just don't have with Ruby, Python or Perl. Yes, I'm aware of PyCharm, but it's not up to the things that you can do with VS and TypeScript. 4. I know the language has some design mistakes, especially around operators and other few things. But in the end the language is small enough and simple enough that it's easy to learn. And it's also easy to learn how to avoid the pitfalls of the language as well. So in the end that's not much of a problem. Besides that, even when the language is simple, it's still quite powerful because of its dynamicity, closures and prototype oriented programming. In the end you can be as concise as you are with Ruby, Python or Perl.
- chriswwweb 10y agoBeing able to reuse the code you wrote for the server in your client code and vice versa, is in my opinion not just a small feature, it can save you a lot of time and money. I joined a company where the backend was written in PHP and the frontend in javascript. There was a ton of duplicate code, just because the backend and the frontend had been written in different languages. By using UMD modules and switching our backend from PHP to nodejs by building a custom isomorphic framework saved us a lot of time. We now don't have two development teams but just one, it's really great having everyone write (speak) the same language and makes hiring, sharing knowledge and training much more efficient. Yeah javascript is not perfect, but I disagree that is totally bad and that you can't write good code with it. We also use typescript because it is not just about types it does much more for us. For example allows us to write our code in ES6/ES7 (with core-js) and transpiles it on the fly (on save file) to ES5 UMD modules. Visual Studio and the nodejs tools make it easy to debug our backend code.
- edem 10y agoThe code duplication is not necessarily the result of using two different languages. On the other hand you can use for example clojure for the whole stack (Clojure for backend ClojureScript for frontend).
- izolate 10y agoBest thing about JavaScript is the speed of development. Once you master it, all other languages & ecosystems feel verbose, archaic. Modern JS (ES2015+) combined with a code style (Standard, Airbnb) is beautiful, sometimes more so than Python. Bad modules isn't a problem inherent to JS. NPM has its faults, but the JS community is the largest, and the fastest moving of all. Everything you need already exists, and it's probably actively maintained, if not accessible for you to submit a PR. PHP? Lol, no. JS > PHP.
- jrs95 10y agoI think the same argument could be applied to PHP though. If you've never used or seen Laravel, it's quite nice: https://laravel.com https://laravel.com If you need concurrency, Facebook's Hack has support for async/await and some other nice things. I'm not saying this is necessary better, just that PHP has a bad rep that it may not deserve at this point (which is pretty similar to JS imo)
- WayneBro 10y agoYou mean the so-called "Standard" code style? Not many people use it. Why even list it...and first? Airbnb style is the most popular one by far. This bears repeating whenever the so-called "Standard" js style is mentioned, lest any readers think that it's actually a standard that people use. It's not. Every time it's been introduced on HN, it's been roundly criticized for the name and the lack of semi-colons. I'm not here to argue about semi-colons. But again, for anybody who missed it - the so-called "Standard" js style is NOT a standard, it's not even a de-facto standard and it's not even popular at all. Don't use it.
- WorldMaker 10y agoStandard is a very nice style and makes for very readable code, especially for those with more of a functional background. (Standard makes JS [and TS too with tslint-config-standard] feel a lot more like the OCaml relative that it is.) Just because you don't like the name, don't think it is "popular", doesn't mean that no one is using it or likes it. (I like it a lot, personally.)
- emodendroket 10y agoWell, the fact that it's a VM that is installed on practically everything is really cool but beyond that I can't see why you'd prefer to use it.
- tomca32 10y agoFor me, it's first class function support. Of course, there are other "real functional languages" like Scala, Haskel or whatever, but they very uncommon. JS is the only commonly (Clojure is very uncommon) used language with real first class functions and not some silly hack like Ruby/Python lamdas, procs, or blocks. To be fair, it seems that Java 8 has first class functions. I can't say much about it since I didn't get a chance to play with it yet.
- collyw 10y agoHow are they a hack in Python?
- randomguy1254 10y agolambda bodies can only be a single expression
- collyw 10y agoThere is more to functional programing in python than lambda functions. Normal functions can be created and passed around.
- randomguy1254 10y agoSure, but I think that is the point. You can do that, but its not as convenient and becomes harder to read. And besides, those are free functions you speak of, not closures. To emulate multi-line closures becomes even more obtuse.
- collyw 10y agoI find it more readable than lambda function syntax personally. And still way nicer than messing around in JavaScript.
- randomguy1254 10y ago
- danneu 10y agoI used Clojure for three years before realizing that all of the dynamically typed languages you listed still have the same hard problems: making large code changes and reasoning about existing code. I also realized that in the real world, technical superiority is overrated, and the difference between these languages is overestimated. Javascript is ubiquitous, runs in the browser + server, everyone I meet in the wild has to know it, and it has static typing options. It's not easy to shove those aspects under the rug to justify another language. It takes something else, mostly depending on just who I'm working with and then on what we're building.
- talmand 10y ago>> All I see is a slow tangled mess of dependencies and broken libraries with a package manager which lets you change already released modules... Ah yes, let's blame the tool for the bad things people do with the tool.
- edem 10y agoIt does not make a difference whether the language is bad or the tool is bad because if in this case npm is a de facto tool for the ecosystem you will have to use it. Same with java: it is not the language which is problematic but the "enterprise" projects which need all kinds of factories/builders/etc which make development incredibly slow.
- talmand 10y agoOh, I'm sorry, I didn't get the memo that says if you work in Javascript you have to use npm. Did that become mandatory in ES2015 or ES2016? But again, you are blaming the tool for the bad things people do with the tool.
- edem 10y agoAre you using npm? How many js developers use it around you? 90%? 95%? As I said in my previous comment it does not make difference in the end whether the tool is bad or the language. If I have to use that tool to leverage the good parts of the ecosystem (eg. use all the libraries in nmp) I can either choose not to use it and lose the the advantages of it or choose to use it and have a crap software which is in the hands of a private company and who can take over my packages (even which I have published years ago) without question.
- talmand 10y agoYes, I use npm every day. So what? You are still blaming the tool for the bad things people are doing with it. As for the taking over packages problem, that's an easy thing to prevent. You can use the tools from npm without allowing that private company from messing you up. Download and use them locally.
- qudat 10y agoWhen you compare pip to npm, it's a no brainer, npm wins that battle. Pip is getting better but so is npm. Js code looks a lot like python to me now as well, especially when referencing generators. The speed of development is it's strongest advantage. However I do think that from an architecture point of view something like golang could be considered more sound.