From Java to Ruby : What I love, what I miss
blog.8thcolor.com
blog.8thcolor.com
Parameter types: use YARD and use its notations to describe parameters. It actually allows things like <Document|Hash|#to_h> which go far beyond what you can describe with types. While in the Java world, you would just overload methods for such things, Ruby allows you to describe all this in one place. Turn flaws into benefits.
Refactoring: strangely, I never miss this. I think bad refactorability is a weak-point of your code, not of the tooling. Ruby allows you to take the Single Source of Truth-Principle (aka DRY) to the extreme, which can allow you to turn most refactorings into search-and-replace operations.
Interfaces as contracts: I hate Java Interfaces, mostly because they don't allow implementations. In Ruby, you can use Modules to a similar effect and raise NotImplementedError on methods that were not implemented correctly. Thats maybe the hackiest thing in this collection, but there is no one-size-fits it all solution :).
I think the theme here is "no static guarantees" and thats definitely true, but after years of programming in dynamic languages, I rate those problems far lower than most others. Most of those things can be mitigated by thinking a lot about your code, which you should do anyways.
I used to think so too when I was doing Rails but since switching to static languages for mobile development I've changed my thinking.
There's something a little bit magical about quickly renaming a function and knowing that every caller of that function has been instantly updated. It changes the way you write code. I'm constantly, aggressively refactoring when I write Obj-C or Java and my code is cleaner for it.
Thanks for catching this one.
I'll certainly take a look at YARD.
- Java 8 (lambda, mixins and functional collections) - Mirah (Nutter's typed Ruby on the JVM) - Scala (like Java 8, but even more functional)
But my money is currently on Kotlin.
Worked a lot with Java, but also dynamic languages (lots of Python, but also Smalltalk and Ruby). My experience was similar: I was missing something on either side.
Currently I like Scala a lot, and it has a console as well as great collections.
"Error establishing a database connection"