7 ms·
I can understand it. If you want to just get something together quickly then dynamic languages do have an edge. They allow you to say "just give me whatever and
by pyrophane 10y ago
I can understand it. If you want to just get something together quickly then dynamic languages do have an edge. They allow you to say "just give me whatever and if it fits, it fits" and if you aren't that concerned about it breaking you can build something extremely fast.
- hota_mazi 10y agoYou're just repeating the same claim without any evidence. Why is it faster to write code in a dynamically typed language? Most modern statically typed languages have type inference so you don't even need to write type annotations for the most part, assuming these extra characters were the reason. So what's that mysterious reason that makes writing dynamically typed language faster?
- mikerybka 10y agoYou don't need to wait for them to compile.
- sgift 10y agoUnfortunately, modern JS has Transpilers, which you have to wait for, so no, that's not the case anymore. I have not seen any NodeJS project which didn't have to be transpiled (i.e. compiled to a different JS version).
- chrisco255 10y agoTotally false. Node.js pre-dates Babel by about 6 years so I wonder how that could possibly be true. Second, most ES6 features are already included natively in latest versions of Node so no need to transpile at all. You can even get async/await out of the box.
- sgift 10y agoNo one cares how you wrote 6 years ago, today the way to do it (as I've been told by many people who write NodeJS applications all the time) is to use transpilers. And: > most ES6 features Most. Ugly word. Really ugly word.
- deleted 10y ago[deleted]
- throwanem 10y agoThat's a way to do it. It is not the only way to do it, even if some people do it that way all the time. I might add a transpiler for Typescript to my stack soon, if that language turns out as pleasant to work with as I've been hearing. If I do, it'll be the first time I use one. And I've been working with Node, in production, since 2013.
- sgift 10y agoGo away. I've invested weeks to learn something which at least resembles NodeJS best practices and now you come along and say "nope, we do it different" ... :( (That was a joke btw. Thanks for the info. The consensus seemed to be that Babel is the way to go, but if your variant works for you good to hear. I will still stay with it. I like ES6 imports in Node.)
- throwanem 10y agoHey, you do you. I'm just here to say that not everyone agrees, or should, that real-world best practice necessarily involves a giant pile of transpilers and bundlers.
- iopq 10y agoFor example, I've been doing a lot of Rust coding. The code in question looks like: iter.next().ok_or(ErrorKind::NotEnoughArguments.into())?.parse().chain_err(|| "cannot parse argument")? the compiler responds with cannot infer type information for `_` the solution is of course to do iter.next().ok_or::<Error>(ErrorKind::NotEnoughArguments.into())?.parse().chain_err(|| "cannot parse argument")? then the type inference is decidable in a dynamic language, you wouldn't have to worry about this; in fact, you wouldn't need to call .into() either - there's just less typing and compiler errors
- skolsuper 10y agoYou're leaving out a lot when you say it'd take you "five minutes with a simple Maven/Gradle build". What's a maven? What's gradle? What's groovy and where can I learn it? I literally don't know the answers to these questions so the same task would take me hours, possibly days. Getting from zero to JSON api in node.js is fast by comparison. Note I am not arguing whether or not it's better in the long run to be the guy that went from zero to node.js or zero to Java, that's a separate discussion.
- hota_mazi 10y ago> You're leaving out a lot when you say it'd take you "five minutes with a simple Maven/Gradle build". What's a maven? What's gradle? What's groovy and where can I learn it? You have similar concerns with node (What's npm? etc...) These are peripheral and necessary knowledge on both platforms. > Getting from zero to JSON api in node.js is fast by comparison It's only fast because you already have the knowledge. Two equally proficient developers in Java and node will set up and get a server up and running in about the same amount of time. The idea that it's a faster to achieve in a dynamically typed language is a myth.
- skolsuper 10y ago> It's only fast because you already have the knowledge. No, when I said "from zero" I meant from zero knowledge. > You have similar concerns with node (What's npm? etc...) What's the "etc..."? Install node and you get npm with it. Writing a REST service IS simpler with Node when going from zero, I know because I have done (or at least attempted) both from zero in the recent past. > The idea that it's a faster to achieve in a dynamically typed language is a myth. Doesn't seem like you're open to discussion on this
- mattmanser 10y agoThis is a classic case of you forgetting all the learning and concepts you needed to get to "zero".
- 10y ago
- pbreit 10y agoSaid dynamic language, not dynamically typed. Would be surprised if anyone considers Java more productive than Rails, Python (Django, Flask, etc) or Express.
- coldtea 10y ago>So what's that mysterious reason that makes writing dynamically typed language faster? Less ceremony.
- lmm 10y agoBut no ceremony is necessary in the cases where types can be inferred - and in the cases where types can't be inferred you probably do want to to be explicit about them even in a dynamic language.
- coldtea 10y agoIt's not just the types, it's the whole APIs, culture etc. Java, for example, is no picnic, whether it can now infer some types or not. In Python I don't even need a main().
- lmm 10y agoI agree Java is a high-ceremony language, but not all statically typed languages are like that.
- hota_mazi 10y agoHow is if __name__ == "__main__": main() different from a main()?
- cookiecaper 10y agoIt's only needed if you're importing the file as a library/module somewhere.
- squeaky-clean 10y agoYou don't even need that. print("hello world") will run just fine
- coldtea 10y agoIt's different in that it's optional in Python.
- nepeckman 10y agoThe slow part of static languages isn't just typing out the annotations. Its needing to describe the type in the first place, and needing to change that type description if the shape of your data changes. If you want to prototype quickly in a dynamic language, you don't need to mess around with any sort of class description as you decide how you want your program to work.