TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

From Java to Ruby : What I love, what I miss

26 pointsby martinvanakenalmost 13 years ago

5 comments

Argorakalmost 13 years ago
The weak points are definitely there, but I think they can be mitigated by training or using proper tools:<p>Parameter types: use YARD and use its notations to describe parameters. It actually allows things like &#60;Document|Hash|#to_h&#62; 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.<p>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.<p>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 :).<p>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.
评论 #4217548 未加载
评论 #4217565 未加载
spullaraalmost 13 years ago
Few things to look at that meet somewhere in the middle:<p>- Java 8 (lambda, mixins and functional collections) - Mirah (Nutter's typed Ruby on the JVM) - Scala (like Java 8, but even more functional)
评论 #4220985 未加载
评论 #4217551 未加载
评论 #4217837 未加载
martinvanakenalmost 13 years ago
Thanks for all comments an replies, I did post a quick wrap up on what it means to pick a language : <a href="http://blog.8thcolor.com/2012/07/you-are-not-just-picking-a-language-follow-up-on-from-java-to-ruby-post/" rel="nofollow">http://blog.8thcolor.com/2012/07/you-are-not-just-picking-a-...</a>
anarchotrollalmost 13 years ago
The cons mentioned in the article above aren't Ruby cons per se, they are shared by all dynamic languages.
评论 #4217570 未加载
saint-loupalmost 13 years ago
I'm getting this:<p>"Error establishing a database connection"