A
Alexander Kellett
Well, it would obviously need to be adapted, but I loved this article:
http://dirtsimple.org/2004/12/python-is-not-java.html
excellent read and link. thanks
Alex
Well, it would obviously need to be adapted, but I loved this article:
http://dirtsimple.org/2004/12/python-is-not-java.html
* Zach Dennis said:- ruby has a lower percentage of dr. diagnoses carpal tunnel sydrome
cases then java (ok, this is just an opinion...=)
Definitely in my case. I switced over a year into RSI and it makes a huge
difference.
I know a lot of Java coders who say 'use an IDE to generate code to save typing'
but i like to see what code is being written on my behalf. A tool to churn out
code smells like bandaid to a brokenly verbose language to me...
I prefer to use my keypresses wisely in solving my problem rather than nursing a
compiler.
REXML vs. JAXP. I rest my case.
Edgardo Hames said:
I'm going to collect responses in a public Ta-Da list at
http://jimweirich.tadalist.com/lists/public/14055 (which is already way
over 10 items!). Later (possibly this weekend) I'll sort through the
collected suggestions, edit them down to my top ten and publish the
result.
Objection on # 2
Everything is *not* object.
By believing the quote 'in Ruby, Everything is object' already made my life hard.
All but variables are...
- ruby has multiple inheritance through mixins (this is sooo nice to have)
PA said:(5) Discipline. Because of its inherent flexibility, Ruby require more
self-discipline.
Objection on # 2 Everything is *not* object. By believing the
quote 'in Ruby, Everything is object' already made my life hard.
Everything *is* an object in Ruby. Variables are labels for objects;
they aren't anything that a programmer can access in any way --
which makes them irrelevant to the consideration.
Zach Dennis said:- you can use string interpolation, ex: "x: #{@myvar}" instead of
having to say "x:" + myvar'
- ruby doesn't force you to have 1 file per public class, you can have
all the public classes you want in a file (not that you have to do this,
but it's a nice option to have)
Ruby seems to lose here. The syntax #{@myvar} is a rare case of
ugliness.
On the other hand, if you *want* to put each class in a file, you end
up having to painfully "require" each file every time you want to
access a class. Java can automatically find classes in the current
package and load them. Or is just me? Is there a Ruby Way?
Cheers,
Navin.
Navindra said:Ruby seems to lose here. The syntax #{@myvar} is a rare case of
ugliness.
On the other hand, if you *want* to put each class in a file, you end
up having to painfully "require" each file every time you want to
access a class. Java can automatically find classes in the current
package and load them. Or is just me? Is there a Ruby Way?
=> "we're all out of powdered toast!!!"From: "Navindra Umanee said:Ruby seems to lose here. The syntax #{@myvar} is a rare case of
ugliness.
Hi,
It's funny how we can disagree over such "simple" syntax. Fact is,
@is_not_a_method, and it has the escope explicit (always better then
implicit, right?), besides being only one character. Perfect, Matz,
thanks.
Navindra said:Ruby seems to lose here. The syntax #{@myvar} is a rare case of
ugliness.
I don't know what the official ruling is, but when using variables you
can drop the {}.
@a = "here i go again"
puts "#@a"
@@a = ["here", " i", " go", " again" ]
puts "#@@a"
Also you have to way in heredoc support, which java dont got:
a = "interpolation"
b = "easier"
c = "You know what I'm saying"
str =<<END
i love string #{a}.
it makes my life #{b}.
#{c}
END
puts str
The larger area of text you have to write the nicer it gets in ruby and
the more it sucks in java to have to write " + ". Especially when you
have really long strings and are dealing with newlines, spaces and tabs.
I like to neatly format my source and have it be a max of 72 to 80
characters per line. I hate writing long text in java because I end up
having ugly source on 10-15 lines with a gazillion " + " and \n's that
is hard to visually parse out or I have 50 lines of + " ..." on it's
own line.
No matter what you say, I prefer doing interpolation over " + " anyday.
I've writtent 15 times the amount of java code in thepast few months for
work-related reasons then i have in ruby, you would think I'd prefer the
" + " way...
On the other hand, if you *want* to put each class in a file, you end
up having to painfully "require" each file every time you want to
access a class. Java can automatically find classes in the current
package and load them. Or is just me? Is there a Ruby Way?
This totally depends on how you use your code. Most likely you won't
need to access every file from it's src file. And if you do it is best
to design a loader class:
In main.rb you have:
require "gui/gui"
require "data/data"
- gui/gui.rb which loads all required files for module GUI
- data/data.rb which loads all required files for module DATA
in gui.rb you have:
require "layout"
require "fonts"
require "2dapi"
require "3dapi"
and similar in data/data.rb.
You don't have to require each individual file you just have to design
your program. I am not saying what you say wouldn't be nice, and someone
may already have a modification to *require* for this to work, but you
are not hindered right now in doing this, it just requires more
discipline on the design and access of your code.
And back to a java principle...alot java code are for one or two lines
of code that use ((MyClass)getGenericObject()).setThis( true );
In Ruby you don't have to say "require myclass" just to do that. You
just say:
get_obj.this = true
Zach
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.