Rant on Ruby ambiguity and syntax woes
Verfasst von henning am Sa, 2007-09-29 02:28
I've been part of the Ruby on Rails hype, as many others - I also wrote two small programs that are quite regularly used by me and Thomas, for whom I wrote a little helper to coordinate FAI development. Admittedly, neither of them ever made it being good enough to be published.
So, at the first glance, it looks very easy to do simple stuff with ruby/rails, and you can do some nice things very fast, without the hassles and complexities of setting up a Java project.
Still, the more I look at it, the more I wonder, if Ruby/Rails is a good way to go.
In developing a prototype for the new FAI GUI, I will check some interesting things:
But, I've come here to rant about some ruby stuff that starts to annoy me.
What about ambiguity?
I admit, it's saves some characters, but why do we have << class="blsp-spelling-corrected" id="SPELLING_ERROR_7">methods for the same functionality, and is it really necessary, to use special characters as method names? We learned from Perl that languages with too much ambiguity and shortcuts are likely to become "write only" - and not even the very authors of programs dare to touch them ever again, because they fail to understand them as soon as they stopped looking at them for more than 2 days. Don't get me wrong - I'm really impressed by the stuff Perl hackers can achieve with some lines of code - but the ambiguity and sometime cryptic syntax, implicit variables and stuff it provides stop me from learning it since ages. The more I get into Ruby, the more I fear Ruby will become the - fully object oriented - Perl of the next decade. Nothing to win here... In case you are tempted to tell me "this is just a single example" - yeah, right, what about:
Two things here:
This is:
So, at the first glance, it looks very easy to do simple stuff with ruby/rails, and you can do some nice things very fast, without the hassles and complexities of setting up a Java project.
Still, the more I look at it, the more I wonder, if Ruby/Rails is a good way to go.
In developing a prototype for the new FAI GUI, I will check some interesting things:
- What happens if you start writing an app that doesn't use a database to store it's data, but, say, the filesystem?
- Will it be easy to use the model classes in an external lib, for creating other frontends than web-based ones? (most important: command line!)
But, I've come here to rant about some ruby stuff that starts to annoy me.
What about ambiguity?
I admit, it's saves some characters, but why do we have << class="blsp-spelling-corrected" id="SPELLING_ERROR_7">methods for the same functionality, and is it really necessary, to use special characters as method names? We learned from Perl that languages with too much ambiguity and shortcuts are likely to become "write only" - and not even the very authors of programs dare to touch them ever again, because they fail to understand them as soon as they stopped looking at them for more than 2 days. Don't get me wrong - I'm really impressed by the stuff Perl hackers can achieve with some lines of code - but the ambiguity and sometime cryptic syntax, implicit variables and stuff it provides stop me from learning it since ages. The more I get into Ruby, the more I fear Ruby will become the - fully object oriented - Perl of the next decade. Nothing to win here... In case you are tempted to tell me "this is just a single example" - yeah, right, what about:
File.open(path) do |file|
while line = file.gets
p line
end
end
Two things here:
- What does the |file| syntax tell me as a human reader, exactly? (I searched, but never found a decent description of this
- Why do I need two blocks for one parsing action?
In Python, the same looks like this:
f = open(path)
for line in f:
print line
This is:
- Two lines less code
- only one loop block
- no special chars that are never really well explained (assume the : be a part of normal written human language)
- henning's blog
- Anmelden um Kommentare zu schreiben
- 276 Aufrufe
Neueste Blogeinträge
- Samsung Galaxy Tab - erste Eindrücke
- Running Redmine issue tracker on Apache Tomcat
- Recover an encrypted-lvm-root system from broken boot partition
- What I like about different programming languages
- Glassfish Webspace Server
- N810 - erste Erfahrungen
- JFormdesigner: Umbenennen einer Klasse
- Blogfaul, Community Comparison, Virtualisierung und die Wolke, Java-OpenOffice
- Oracle auf Shopping Tour
- Welche OpenSource Software fehlt noch?!
- henningsprang: Next talk in the configuration and systems management devroom will be about configuration management with RPM and YADT http://t.co/qWbNLTfV
- henningsprang: idea for devrooms @fosdem : if we all would take care more to shoot videos in our area of interest, all content would be recorded! #fosdem
- henningsprang: @flovison @fosdem and it works pretty crazy nicely and perfect! Thanks for this! :) #fosdem
- henningsprang: RT @flovison: @fosdem WLAN stats update - day 2 concurrent users peak was 1622 concurrent clients #fosdem http://t.co/Jiuckvld
- henningsprang: RT @snipeyhead: OH: "I can't commit code with a variable named $FuckYouRailsYouPieceOfShit. But I want to." #rails
