4 ms·
> I never felt like I have more bugs in dynamic typed languages. What I felt is that I don't have to waste time writing stuff like ArrayList<Whatever> when jus
by bjz_ 10y ago
> I never felt like I have more bugs in dynamic typed languages. What I felt is that I don't have to waste time writing stuff like ArrayList<Whatever> when just something = {} works perfectly well in practice.
Java is a pretty terrible language when it comes to static types. If you have a language that allows you to work with types in a succinct and expressive way, you end up with a powerful modelling tool that can help you reason about and design programs. The side-effect of this is to have far less runtime crashes (you know what cases to check for, like nullable data), great documentation for your future self and your fellow devs, and a greater liberty to do large scale refactors without worrying about breaking things.
- gregschlom 10y agoAgreed. Kotlin is an excellent example of such a language, and I'd highly encourage anyone, especially devs with a strong Java background, to try it out.
- gregschlom 10y agoAgreed. Kotlin is an excellent example of such a language, and I'd highly encourage anyone, especially devs with a strong Java background, to try it out.
- twblalock 10y agoThe self-documenting nature of statically typed programs is something that critics often miss. Making a contribution to an existing codebase is far easier when it is statically typed. You can very easily understand what you ought to do, because the constraints of the type system help you figure out exactly what things are, what arguments you can pass to a method, how the other programmers used the types, etc. In contrast, contributing to an existing codebase in PHP or Rails is much harder. Nothing will stop you from sending the wrong arguments to a method, or adding members to classes that should not be modified, or even simply refactoring and forgetting to change all of the usages of the types and methods you modified.
- Retra 10y agoWell, the converse argument is that most dynamically typed languages allow you to explore the codebase in a REPL by playing with it. And there's a reasonable amount of noise that is added by static types, since often the types don't tell you how to use them, so you have to read the docs anyhow. Which really means there's a big difference between static types that everyone knows and uses, and those that someone invented for particular use. That difference seems more significant than the static/dynamic divide.
- twblalock 10y agoThere are statically-typed languages with REPLs, e.g. Scala, C#, F#, and the upcoming Java 9, so REPLs are not an advantage of dynamic languages. There are even REPLs for C++. Many people's impressions of static languages are based on Java from 10 years ago. It's really quite different now.
- bjz_ 10y agoI find the Haskell, SML, and OCaml repls very nice to use as a exploratory tools. It's made all the nicer due to the types, because you can quickly iterate on gluing things together in different ways. It's something I miss with Rust, although there is progress being made to implement one.