Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Can you please help to make decision?

Reply
Thread Tools

Can you please help to make decision?

 
 
7stud --
Guest
Posts: n/a
 
      09-30-2007
> Look under 'block' not 'code block'.

Ahh. "Blocks" as in "Proc's and blocks".

> That is not really the issue, remember I was talking to a
> beginner. 12.to_s means it is Integer's responsibility to
> convert itself to a String str(12) means it is Kernel's
> responsibility to convert Integer's to Strings


Do you really think a beginner cares about that or even has any idea
what you are talking about?

> the second just does not feel OO to me.


What about when you write:

puts result
input = gets
p = lambda {"hello world"}
printf("%.2f \n", 4.56789)
require "somefile"
sleep(2)

Do you avoid those 'global' method calls because they look too much like
str(12)? Or, to maintain your OO purity do you write things like:

Kernel.puts "hello world"

> I give it to you for Syntax errors, but when it come to Stack Traces
> OMG Ruby beats Python by magnitudes.


def func1
func2
end

def func2
puts y
end

func1

ruby:
-----
r8test.rb:5:in `func2': undefined local variable or method `y' for
main:Object (NameError)
from r8test.rb:2:in `func1'
from r8test.rb:7

python:
-------
Traceback (most recent call last):
File "6test.py", line 8, in ?
func1()
File "6test.py", line 2, in func1
func2()
File "6test.py", line 5, in func2
print y
NameError: global name 'y' is not defined


I don't see any substantive difference, but to my eye the python output
looks more orderly and is easier to read.


> Personally, I find Pythons documentation boring and dull,
> but good if you are familiar with programming (and English).


That's more credit than I'd give it!
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
7stud --
Guest
Posts: n/a
 
      09-30-2007
Here's a simple test for the op. Which of the following do you think is
easier to understand? Can you guess what each program does?

language1:
--------

colors = ["red", "blue", "green"]

colors.each {|color| puts color}


language2:
---------
colors = ["red", "green", "blue"]

for color in colors:
print color
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
SpringFlowers AutumnMoon
Guest
Posts: n/a
 
      09-30-2007
Byung-Hee HWANG wrote:
> Fist of all, sorry for poor English, I am not professional English
> speaker. I have some plan to do study computer language for my work. But
> still I do not make decision what to do study between Ruby and Python. I
> never have experience to use any computer language. I think Ruby's
> design is clean, whereas it does not have many libraries to use
> somebody.
>
> Can you please help to make decision?



I think one thing is the "fun" factor, that i have programmed in BASIC,
Assembly, Fortran, Pascal, C, C++, Perl, Python, Ruby, and PHP.

I'd say Pascal was delightful as it was well structured. C is powerful.
Perl and Python is quick for writing code. But recently I just have had
a lot of fun writing in Ruby. I haven't had that feeling in years.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
SpringFlowers AutumnMoon
Guest
Posts: n/a
 
      09-30-2007
7stud -- wrote:
> I would choose python.
>
> 1)
>>a clean (probably one of the cleanest) object oriented design, example:

> <snip>
>
> Convert the number 12 to a string:
>
> ruby: my_str = 12.to_s
>
> python: my_str = str(12)
>
> I have a hard time understanding how either method has an advantage over
> the other. It's totally irrelevant in my opinion. Personally, I think
> using a number to call a method looks ugly. But I can adapt pretty
> easily.


if viewed as "hey number 12, i give you a message, and the message is
'tell me what you are in a string format', and the number 12 tells you",
that's be kind of cool.

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
7stud --
Guest
Posts: n/a
 
      09-30-2007
Byung-Hee HWANG wrote:
>
> Fist of all, sorry for poor English, I am not professional English
> speaker.
>


Whoops. Maybe these will be easier to understand:

language1:
---------
numbers = [10, 20, 30]

numbers.each {|number| puts number}


language2:
---------
numbers = [10, 20, 30]

for number in numbers:
print number
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
William James
Guest
Posts: n/a
 
      09-30-2007

7stud -- wrote:
> Byung-Hee HWANG wrote:
> >
> > Fist of all, sorry for poor English, I am not professional English
> > speaker.
> >

>
> Whoops. Maybe these will be easier to understand:
>
> language1:
> ---------
> numbers = [10, 20, 30]
>
> numbers.each {|number| puts number}
>
>
> language2:
> ---------
> numbers = [10, 20, 30]
>
> for number in numbers:
> print number



numbers = [10, 20, 30]
==>[10, 20, 30]

for number in numbers do
p number
end
10
20
30

 
Reply With Quote
 
William James
Guest
Posts: n/a
 
      09-30-2007
On Sep 30, 1:25 pm, 7stud -- <(E-Mail Removed)> wrote:
> Here's a simple test for the op. Which of the following do you think is
> easier to understand? Can you guess what each program does?
>
> language1:
> --------
>
> colors = ["red", "blue", "green"]
>
> colors.each {|color| puts color}
>
> language2:
> ---------
> colors = ["red", "green", "blue"]
>
> for color in colors:
> print color



E:\Ruby>irb --prompt xmp
colors = ["red", "blue", "green"]
==>["red", "blue", "green"]
puts colors
red
blue
green

 
Reply With Quote
 
James Edward Gray II
Guest
Posts: n/a
 
      10-01-2007
On Sep 30, 2007, at 8:47 AM, 7stud -- wrote:

> Ruby also relies heavily on regex's, and regex's are never going to be
> easy to read for anyone. regex's are not beginner friendly, and that
> might be a big barrier for a beginner trying to learn ruby. There are
> lots of people who just can't learn regex's.


I'm staying out of the Ruby vs. Python debate, but the above is just
plain wrong and I wish people would stop saying things like this.

For some reason, regular expressions are surrounded in this aura of
mystery. Perhaps their syntax heavy nature makes them seem odd to
people unfamiliar with them at first glance, but for some reason
many, many people believe things like the comment posted about.
That's a real shame.

Regular expression is a simple pattern language anyone can learn
quite easily. I once taught them to my wife in the space of evening,
to help with a work project. She's an above average skill-level
computer user, but definitely not a programmer. She had no trouble
grasping the concepts and still uses regular expression to this day.

Please, sit down and really try learning regular expression before
adding to the fear factor surrounding them. I promise, it's time
well spent.

James Edward Gray II

 
Reply With Quote
 
M. Edward (Ed) Borasky
Guest
Posts: n/a
 
      10-01-2007
James Edward Gray II wrote:
> On Sep 30, 2007, at 8:47 AM, 7stud -- wrote:
>
>> Ruby also relies heavily on regex's, and regex's are never going to be
>> easy to read for anyone. regex's are not beginner friendly, and that
>> might be a big barrier for a beginner trying to learn ruby. There are
>> lots of people who just can't learn regex's.

>
> I'm staying out of the Ruby vs. Python debate, but the above is just
> plain wrong and I wish people would stop saying things like this.
>
> For some reason, regular expressions are surrounded in this aura of
> mystery. Perhaps their syntax heavy nature makes them seem odd to
> people unfamiliar with them at first glance, but for some reason many,
> many people believe things like the comment posted about. That's a real
> shame.
>
> Regular expression is a simple pattern language anyone can learn quite
> easily. I once taught them to my wife in the space of evening, to help
> with a work project. She's an above average skill-level computer user,
> but definitely not a programmer. She had no trouble grasping the
> concepts and still uses regular expression to this day.
>
> Please, sit down and really try learning regular expression before
> adding to the fear factor surrounding them. I promise, it's time well
> spent.
>
> James Edward Gray II
>
>

+1

BTW ... I *still* hate them, but I use them.

 
Reply With Quote
 
John Joyce
Guest
Posts: n/a
 
      10-01-2007

On Oct 1, 2007, at 12:20 AM, David Orriss Jr wrote:

> In article <(E-Mail Removed)>,
> Byung-Hee HWANG <(E-Mail Removed)> wrote:
>
>> Fist of all, sorry for poor English, I am not professional English
>> speaker. I have some plan to do study computer language for my
>> work. But
>> still I do not make decision what to do study between Ruby and
>> Python. I
>> never have experience to use any computer language. I think Ruby's
>> design is clean, whereas it does not have many libraries to use
>> somebody.
>>
>> Can you please help to make decision?

>
> I don't think Python has ever gained the traction that Ruby has,
> especially with the advent of RoR.
>
> My opinion, go with Ruby.
>

Huh? Python's got lots of traction! Just not the buzz.
Python is widely used and shipped with systems.

Try both.
Go with the one that suits you best!
You have many things to consider. Browse the books and sites for all
languages you're considering.
A bad book can be a big turn-off to a good language.

You can't go wrong with either one.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
make pls don't work , i help you make web ,help you do business onthe internet xiaobb03@gmail.com Digital Photography 0 03-13-2008 11:28 AM
Can you spare 10 minutes to do a survey? You can be a valuable help to university researchers! daniel DVD Video 0 03-02-2007 02:19 AM
Stupid question. Please, only stupid responders. If you're not sureif you're stupid, you probably aren't. =?ISO-8859-1?Q?R=F4g=EAr?= Computer Support 6 07-18-2005 05:11 AM
HELP! HELP! PLEASE, PLEASE, PLEASE tpg comcntr Computer Support 11 02-15-2004 06:22 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments