4 ms·
Well we do share the C# background, but I lastly used C# about 8 years ago, a lot has changed. As much as I would love to have a Ruby background, Ruby (mostly
by eranation 13y ago
Well we do share the C# background, but I lastly used C# about 8 years ago, a lot has changed.
As much as I would love to have a Ruby background, Ruby (mostly on Rails) for me is a hobby language / framework, can't use it at work, sadly.
I actually come from 10 years of writing mostly Java and JavaScript. I (used to) like Java, but I will replace both Java and JavaScript with Scala in any of my new projects without hesitation. Including taking into account on-boarding new team members, including taking into account how complex people can get with Scala, trust me, bad developers make spaghetti from anything, Java included, and spaghetti is not the worse thing, bad buggy code is. you'll be shocked how many Java developers don't know the contract between hashCode and equals in Java. in Scala, if you use a case class (or data class in Kotlin) you get default equals and hashCode for you, so for you little DTO bean, you'll avoid having duplicates in a set (very common Java newbie bug).
Also I tend to find that huge amount of Java bugs end up having the same 2-3 exceptions - and most notoriously the NullPointerException. With Scala options, it's diminished significantly.
p.s. I did some college projects with C++, and can read it but I can't really understand the comparison to Scala, really.
So I personally won't be worried about Scala replacing Java mainstream industry world.
1) it will take a lot of time for it to happen even if HN was full of ("Scala is even better than Go / Haskell / Clojure, my eyes are opened!"
2) even if it does, I am (very subjectively) about 10X more productive with it, and write / read code much more easily with it than with the same code written in Java, but this is only because me and my team constrain ourselves to avoid abusing the language. E.g. there is nothing wrong with if(option.isDefined) if you don't like pattern matching. or using dot notation and avoiding infix notation when not really needed. I also don't care about using vars, or using while loops when it's more readable, I always provide a named function to my operators, and only use implicit conversions when it really needed and helps code readability (for example to use it for actual CONVERSIONS and avoid method overloading hell and not just to pimp a library)
I also avoid one liner terse code that no one can read (or debug) and the end result is 10X more happiness, productivity and fun than with boring old Java.
I also use it with Spring, Java EE and Maven instead of sbt. Scala if used this way, is indeed a better Java. But it needs guidance, so perhaps it indeed needs a "the good parts" book / style guide / Linter
p.s.
If you spent some time to learn Scala and tried it on a project, and still prefer using Clojure, I'll believe you. if you say you prefer Scala over Java, I will force myself to respect you and avoid being accused of an ad hominem attack :)
- cygwin98 13y agoIf you spent some time to learn Scala and tried it on a project, and still prefer using Clojure, I'll believe you. if you say you prefer Scala over Java, I will force myself to respect you and avoid being accused of an ad hominem attack :) Thanks for the detailed reply. You're one of the HNers whose opinions I highly respect. Wish HN had the following features like Twitter. My understanding of Scala is very superficial. So my opinion is obviously very biased at this moment. I've been immersing myself in Clojure and ClojureScript on and off for most of this year. Learning Scala will be on my todo list for the new year. Hope I will have something to share then. I may change my opinion though, should the new version of Scala rectify most of the flaws, given the fact that Rod Johnson joined TypeSafe, who tends to have the gift to simplify complexities. And no, I don't like Java either and consider that it's reasonable that the community needs a more expressive language on JVM and leave Java as a supporting role to write underlying performance-critial JVM libraries just like C to the native libs.
- eranation 13y ago:) you made my day, thanks, same goes to you! p.s. I created http://scalatutorials.com/tour http://scalatutorials.com/tour as an attempt to get the basics covered quickly, it's very early work in progress, but I got good feedback so far. Also http://codebrew.io http://codebrew.io is a great place to start playing with the language without installing anything (it even has code completion, and runs in the browser, no installation needed) Looking forward hearing your take on it after playing with it some more.