4 ms·
Although I understand the point, I think it's more accurate to describe Groovy as the "Ruby" of Java rather than Python. Groovy's philosophy and syntax are all
by zmmmmm 13y ago
Although I understand the point, I think it's more accurate to describe Groovy as the "Ruby" of Java rather than Python. Groovy's philosophy and syntax are all very Ruby-like, while many things about it are completely orthogonal to the same in Python.
Where Python is usually trying to have just "one way" to do things, Groovy offers you a million. Python actually share's much of Java's annoying desire to keep the default namespace clean and hence make you import modules to do just about anything useful. While Python puts simplicity and cleanliness on a pedestal, Groovy is unashamedly pragmatic, letting you do any dirty thing you feel like or need to do to get your job done.
In complete contradiction to Python's direction of eliminating it (eg: forcing brackets on print() statements) Groovy gives you incredible amounts of optional syntax - add semicolons? if you want ... or not ... except sometimes the syntax gets ambiguous they are required. Use brackets on your function calls? If you want ... or not ... except sometimes the syntax gets ambiguous, so they are required. The author didn't even mention optional static typing which not only enforces type correctness on parts of the code you apply it too, but dramatically speeds them up. So much freedom makes it easy for Groovy code to end up messy and unstructured compared to Python.
I'm currently in a situation where I switch between Groovy and Python coding on alternate days. I definitely prefer different things about each. Groovy definitely seems more powerful when I just need to get a simple job done. It is incredible what you can cram into a single line.
I hope Groovy continues to prosper, but I worry it's getting lost among the hype around more "sexy" languages. I think it's by far the best language for many jobs.
- bonemachine 13y agoI don't think it's about sexiness -- Python has brought many associations to mind over the years, but sexy has never been one of them -- just that there are only so many languages that can compete in the same ecological feeding space that (Python,Perl,Ruby,Groovy) are all pretty much butting heads against each other over. If anything, Python seems to be dominating in large part because of its unabashed lack of sexiness (or what passes for it in modern programming circles: cleverness, and cuteness).
- pjmlp 13y agoActually, it is more like "Groovy, the Smalltalk of Java" :)
- trailfox 13y agoIf I recall correctly Groovy was directly inspired by Python. I don't have a link, but I remember reading that the creator of Groovy was inspired after seeing a book on Python.
- vorg 13y ago> Groovy gives you incredible amounts of optional syntax - add semicolons? if you want ... or not ... except sometimes the syntax gets ambiguous they are required. Use brackets on your function calls? If you want ... or not ... except sometimes the syntax gets ambiguous, so they are required. When the syntax get ambiguous, it's up to the developer to know they're required, just like with parentheses around expressions using infix operators of various precedences. The compiler or IDE won't tell you - you just get the incorrect result from running the code. > The author didn't even mention optional static typing which not only enforces type correctness on parts of the code you apply it too, but dramatically speeds them up. Groovy's original use case was quick and dirty scripts running tests, Grails scripting, and more recently Gradle, none of which use the static typing in Groovy. Gradle even still ships with Groovy 1.x. Unlike Groovy dynamic typing codebase, only one developer wrote the static typing codebase and it's still a little buggy. Best wait until Grails uses it before trusting it.