Welcome to our (ruby-talk ML) You are added automatically

Hi all
   This is GK.Sezhian working for BPL Telecom . If guys u can find some
time to answer some of my basic doubts it will be more helpful.as Iam
just bit confused to select among groovy (Java )/python /Ruby for my
future assignments

1.Has anyone of you tried rubyonrails web app in your
protyping/production ?

2.What is the adv Ruby gives over python
   ...on googling I found an article stating just they are
philosophically different??

3.OO becomes a overhead in some cases
  when a small coding stuff can achieve that .

4.I have just gone thro some perfomance results which rendered Ruby to
be very slow is it ?

5.Does Ruby have strong user groups in term of count like python?

6.Can I get some reference where ruby has Been used in large /criical
projects?

7.How is Ruby's performance with huge DB resultsets..

8.How about the DB features supported by
  Ruby..like Rowsets I java ...Transactional settings ...etc

9.What is the newest release in Ruby world like library,new language
features,tools ...

10. the end statement in ruby is bit tricky will it be changed ???

11.Template driven programming can reduces the developing time right ?
Then what is the need of Ruby creating a whole set of new language form
scratch ..i heard there are more than 200 odd languages available
(programming languages) ..
Here I mean to say what is the advantage of Ruby over grrovy/template
programming..

These are my inner quest questions...and iam looking for a compulsary
reason to switch to Ruby..
Thanks
Sezhian.gk

Thanks
Sezhian.gk

···

-----Original Message-----
From: ruby-india Moderator [mailto:ruby-india-owner@yahoogroups.com]
Sent: Saturday, April 09, 2005 12:17 PM
To: GK. Sezhian
Subject: Welcome to ruby-india

Hello,

Welcome to the ruby-india group at Yahoo! Groups, a free, easy-to-use
email group service. Please take a moment to review this message.

To learn more about the ruby-india group, please visit
http://groups.yahoo.com/group/ruby-india

To start sending messages to members of this group, simply send email to
ruby-india@yahoogroups.com

If you do not wish to belong to ruby-india, you may unsubscribe by
sending an email to ruby-india-unsubscribe@yahoogroups.com

To see and modify all of your groups, go to
http://groups.yahoo.com/mygroups

Regards,

Moderator, ruby-india

Your use of Yahoo! Groups is subject to

-----Original Message-----
From: ruby-talk-admin@ruby-lang.org
[mailto:ruby-talk-admin@ruby-lang.org]
Sent: Saturday, April 09, 2005 12:51 PM
To: GK. Sezhian
Subject: Welcome to our (ruby-talk ML) You are added automatically

Caution: If you reply this mail, the recipient is mailing list!
post articles <ruby-talk@ruby-lang.org>
commands <ruby-talk-ctl@ruby-lang.org>
maintainer <ruby-talk-admin@ruby-lang.org>

Welcome to our mailing list <ruby-talk@ruby-lang.org> !

This mail contains the fundamental usage of the mailing list server.

1 How to use this server

Please send commands in the mail body not subject to the address
<ruby-talk-ctl@ruby-lang.org>.

The command syntax is as follows:

  # help
  help

  # help
or
  help

Please send the "# help" to the address <ruby-talk-ctl@ruby-lang.org>
for help and server functions overview

  # help

to get general information on this list

  # guide

If you want to make a contact with the mailing list maintainer, please
e-mail to

  ruby-talk-admin@ruby-lang.org

ML server exists to decrease routine works by maintainers. Please try to
use server functions as could as possible.

        ruby-talk@ruby-lang.org Maintainer
        ruby-talk-admin@ruby-lang.org

1. Has anyone of you tried rubyonrails web app in your
   protyping/production?

Dozens -- if not hundreds -- of people have done this. Check out the
Rails website.

2. What is the adv Ruby gives over python ...on googling I found
   an article stating just they are philosophically different??

Essentially. That philosophical difference leads to a number of
practical differences, though, which will matter for your own
preference.

3. OO becomes a overhead in some cases when a small coding stuff
   can achieve that.

Clarify. Ruby doesn't force you to code in an OO style. Don't think
in terms of Java-OO, because it's not remotely the same. Ruby's OO
is truly transparent and fully integrated.

4. I have just gone thro some perfomance results which rendered
   Ruby to be very slow is it?

There are lies, damn lies, statistics, and then there are
benchmarks. Ruby is slower than other languages for some tasks,
faster than other languages for some tasks. Generally, it is more
pleasant to develop in than other languages, and is faster for
*developing*.

5. Does Ruby have strong user groups in term of count like python?

There are more Python users than Ruby. But the number of Ruby users
is increasing.

6. Can I get some reference where ruby has Been used in large
   /criical projects?

Look on RubyGarden for RealWorldRuby.

7. How is Ruby's performance with huge DB resultsets..

Probably very good.

8. How about the DB features supported by Ruby..like Rowsets I
   java ...Transactional settings ...etc

Sorry, I'm not clear on what you're after.

9. What is the newest release in Ruby world like library, new
   language features,tools ...

Clarify.

10. the end statement in ruby is bit tricky will it be changed ???

There's nothing tricky about the end statement. It will not be
changed.

11.Template driven programming can reduces the developing time
   right? Then what is the need of Ruby creating a whole set of
   new language form scratch ..i heard there are more than 200 odd
   languages available (programming languages) .. Here I mean to
   say what is the advantage of Ruby over grrovy/template
   programming..

Sorry, but I don't know what you're talking about here. (1) Ruby is
over ten years old (it was first released in '93). (2) Ruby has its
place. (3) What do you mean by "template-driven programming." (4)
Ruby reduces development time, too, by being a higher level language
without the artificial restrictions of statically typed languages,
which is where templates (C++ style) make sense.

-austin

···

On Apr 9, 2005 4:52 AM, GK. Sezhian <g_sezhian@thuraya.com> wrote:
--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

GK. Sezhian wrote:

Hi all
   This is GK.Sezhian working for BPL Telecom . If guys u can find some
time to answer some of my basic doubts it will be more helpful.as Iam
just bit confused to select among groovy (Java )/python /Ruby for my
future assignments

1.Has anyone of you tried rubyonrails web app in your
protyping/production ?

Yes.

2.What is the adv Ruby gives over python ...on googling I found an article stating just they are
philosophically different??

Saying these two are "just" philosophically different is perhaps not completely accurate. More important, while there are many languages that , technically, can help you achieve the same goals, you may prefer to use a language that maps well to your own particular style of thinking.

See also
http://www.ruby-doc.org/RubyEyeForThePythonGuy.html

3.OO becomes a overhead in some cases
  when a small coding stuff can achieve that .

Ruby is OO, but you can ignore it if you choose. If you think the situation is best handled using procedural programming, Ruby gives you the choice.

4.I have just gone thro some perfomance results which rendered Ruby to
be very slow is it ?

No. It compares favorable with other interpreted languages.

5.Does Ruby have strong user groups in term of count like python?

Oh yes.

6.Can I get some reference where ruby has Been used in large /criical
projects?

7.How is Ruby's performance with huge DB resultsets..

Don't personally know.

8.How about the DB features supported by
  Ruby..like Rowsets I java ...Transactional settings ...etc

Don't personally know, though I think that depends on the DB, not Ruby per se.

9.What is the newest release in Ruby world like library,new language
features,tools ...

There are new things all the time:

http://rubyforge.org/

(And a Ruby 1.8.3 preview should be coming along soon, too.)

10. the end statement in ruby is bit tricky will it be changed ???

Tricky in what way?

11.Template driven programming can reduces the developing time right ?

Maybe. Depends on what your are developing, right? And what other tools a language offers.

Then what is the need of Ruby creating a whole set of new language form
scratch ..i heard there are more than 200 odd languages available
(programming languages) ..
Here I mean to say what is the advantage of Ruby over grrovy/template
programming..

Tough question, as it may depend on any number of factors. Do you need to run on the JVM? Are there specific libraries you require?

These are my inner quest questions...and iam looking for a compulsary
reason to switch to Ruby.

I am unaware of any *compulsory* reason to use Ruby, but it is a fun, expressive language with a minimum of syntax surprises and arbitrary rules.

The best argument is experience. If you haven't already done so, try reading the free version of Programming Ruby

http://www.ruby-doc.org/docs/ProgrammingRuby/

and try writing some code, and see for yourself.

Please feel free to ask more questions, and best of luck whatever you decide.

James

···

--

http://catapult.rubyforge.com
http://orbjson.rubyforge.com
http://ooo4r.rubyforge.com
http://www.jamesbritt.com

Most of your question have already been answered better than I could so I will just give answers for the ones where I have anything to add.

GK. Sezhian wrote:

1.Has anyone of you tried rubyonrails web app in your
protyping/production ?

I have tried RubyOnRails and I am quite happy with it. There's lots of more users doing this and both the RubyOnRails mailing list and the IRC channel are experiencing steadily increases of activity.

3.OO becomes a overhead in some cases
  when a small coding stuff can achieve that .

It is not like that in Ruby. Ruby isn't Java and doesn't *force* you to use classes where a simple function would do.

While Ruby lets you do things in a procedural manner it still is a heavily OOP language under the hood. For example the following is a valid Ruby program and I'm not defining any classes there:

   5.times { puts "Hello World!" }
   puts Time.now.utc

   puts "Please enter something:"
   user_input = STDIN.gets.chomp
   puts "In reverse: #{user_input.reverse}"

   puts 2 ** 16

And so on. Everything you see there is still a method call, but you can ignore that aspect.

4.I have just gone thro some perfomance results which rendered Ruby to
be very slow is it ?

Ruby is not as fast as it would like to be in all areas. There's quite a few implementations of faster and optimized interpreters going on (Just like in the Python world) and one of those projects is planned to be merged back into Ruby itself before the end of this year.

In other areas like web development Ruby and its frameworks already seem to be well enough to compete with Java.

In any case, it is usually easy to rewrite slow parts of Ruby in C. (Ruby's C interface is easier to use than that of other languages.)

For the RubyOnRails guys there's also the important point of scaling well -- if you add another server will the performance effect be close to doubling? With Rails this is the case.

5.Does Ruby have strong user groups in term of count like python?

This mailing list is one of them, but you're likely also interested in the Rails one.

Have a look at

http://weblog.rubyonrails.com/archives/2005/03/26/the-rise-of-interest-documented-by-the-ml/

6.Can I get some reference where ruby has Been used in large /criical
projects?

The wiki page on RubyGarden others mentioned already has quite a few of those, but here's more Rails-based use cases:

http://wiki.rubyonrails.com/rails/show/RealWorldUsage
http://wiki.rubyonrails.com/rails/show/OpenSourceProjects

7.How is Ruby's performance with huge DB resultsets..

I don't think there is a bottleneck there, but you probably ought to re ask this question on the Rails mailing list as well.

Rails is not the only web development framework, of course, so you might also want to look into the performance of the other choices available.

7.How is Ruby's performance with huge DB resultsets..

I don't think there is a bottleneck there, but you probably ought to re ask this question on the Rails mailing list as well.

Rails is not the only web development framework, of course, so you might also want to look into the performance of the other choices available.

I agree with this answer, but would add:

In my experience Ruby is pretty slow if you have to iterate through lots of data[1], correspondingly you wouldn't want to implement a database in Ruby due to performance considerations. Therefore when you use ruby with a database backend, you have to make the backend do all iteration, and you use Ruby to coorindate actions of the database[2]. In this mode languages like Ruby are fine.

Ruby is a very nice language, but it has its own idioms, so it takes a while to learn them (I'm still learning them). One that I like very much is:

File.open("input.txt", "r") do |file|
  @context = load_context_from_file(file)
end

What do I like about that? I like that you don't leak the file descriptor if an exception is thrown by the load_from_file function. This is a really neat way to avoid leaking system resources and it is concise and straightforward. In C++ I used to do stuff like:

ifstream input("input.txt");
context = load_context_from_file(input);

This won't leak a system resource either because _input_ has static scope and so gets free'd, even if an exception is thrown. I missed this "resouce bound to a static scope ideom" in other languages, e.g. java and ocaml, until I found it in the Ruby standard library. Finding it in the standard library gave me a lot of confidence in Ruby because I figured, hey these guys really know what they're doing.

In modern systems there are all sorts of system resources that need to be accounted for and so this idiom often gets resued. I haven't looked into how multithreading works in ruby yet, but this idiom would also work quite nicely for mutexes and condition variables I imagine.

Lastly let me say I've looked around at quite a few languages and invested some time in learning to use many of them and my favorite is Ruby. Sometimes I have to use Ocaml for speed, and Ocaml has its own charms, but I always wish I was programming in Ruby.

One final warning in regards to Ruby. Since it is dynamically typed, you absolutely have to invest in writing and maintaining software design and interface documentation. But maybe that is a good thing, and since the language is so concise maybe you have time to do it.

Well that was my two bits worth.

regards,

Richard.

[1] I had some programs that generated large datastructures all in ruby without pushing the computation down into either a database backend or a custom C backend, and it was quite slow compared to a similar program written in Ocaml.
[2] This is kind of what you're supposed to do with databases anyway, but maybe a language like Java, and a big processor, lets you get away with iterating though big results sets to filter them or whatever, when you should be pushing that computation down into the SQL expressions maybe even using stored proceedures.

In modern systems there are all sorts of system resources that need to
be accounted for and so this idiom often gets resued. I haven't looked
into how multithreading works in ruby yet, but this idiom would also
work quite nicely for mutexes and condition variables I imagine.

Indeed, @mutex.synchronize { do; stuff; here }

Regards,

Bill

···

From: "Richard Cole" <rcole@itee.uq.edu.au>

There's a really nice quote by Matz that sums it up for me:

   But if I look at the code, I need to apply the rule with my brain too.

This was taken from an interview: artima - The Philosophy of Ruby (A good read, I recommend it if you haven't). I'm taking the quote out of context, but for me that sums up the difficulty that I have with Ocaml, and what I like about Ruby. Let me demonstrate this with a little bit of code.

This is some ocaml, don't read it too carefully:

let sibling_sym_metric_one
  (lattice: ('a,'b) concept_lattice)
  (pos: int -> (float * float))

···

Ara.T.Howard@noaa.gov wrote:

On Sun, 10 Apr 2005, Richard Cole wrote:

<snip summary>

nice summary. can you comment on ocaml further? specifically why you wish
you were programming in ruby while using it? i've recently started learning
it and am curious as to others' experiences.

  =
  let count_sib_sym parent children =
    let points =
      fold_left (fun x z -> insert (pos x) z) empty children
    in
    let (parent_x,parent_y) = pos parent in
    let count =
      fold_left
        (fun x z ->
           let (pos_x,pos_y) = pos x in
             if is_member ((2.*.parent_x) -. pos_x,pos_y) points then
               z
             else
               z - 1
        )
        0
        children
    in
      count
  in
    lattice#index_fold_left
      (fun (x,v) z -> z + (count_sib_sym x (lattice#lower_covers x)))
      0

What does it do? Basically it iterates over a lattice (think of it as a DAG or a tree) and for each element the algorithm counts the number of children that have a symetric sibling, that is: children who have a sibling whose x-position relative to the parent is -1 times the parent relative x-position of the child.

I'm practiced at writing stuff in this style (for good or bad), and also I wrote the function, so I know what it does, but I haven't found very many other people who understand that code. Maybe I'm just bad at writing Ocaml code, but in Ruby it becomes

def sibling_sym_metric_one(lattice, position)
  count = 0
  for parent in lattice do
    points = Set.new
    for a in lattice do
      parent_relative_point = [pos[a][0] - pos[parent][0], pos[a][1] - pos[parent][1]]
      points.add(parent_relative_point)
    end
    for child in lattice.lower_covers[parent] do
      sym_rel_child_pos = [pos[child][0] - pos[parent][0], pos[child][1] - pos[parent][1]]
      sym_rel_child_pos[0] *= -1
      if points.include?(sym_rel_child_pos) then
        count = count + 1
      end
    end
  end
end
    I find the Ruby version so much easier to understand. (I haven't compiled or tested it, so maybe it contains errors). It also begs some refactoring (there's a repeated function for instance). When I program in Ocaml I find myself constantly using fold_left instead of for loops and that is just hard work on my poor brain.
   Ocaml type checks the code which catches very many errors before the program is ever run even once. I'm constantly suprised by bugs that I get in my ocaml code that somehow make it through the type checker, they're usually on of two sorts, (i) some sort of variant of loosing a minus sign in algerba, e.g. folding in the wrong direction in a case when it matters, or (ii) the algorithm was totally wrong to begin with (when it was concieved in my mind).

In Ruby I write a lot of unit tests because I expect errors. Also you can't ask the interpreter what the return type of a function is, or what the types of the arguments are, its all implicit so you need to invest more time documenting the code. But that's a good thing right?

I'd like to have interfaces in Ruby so I can specify type constraints on arguments and return values, the are constraints there implicitly already, I want to make them explicit. Problem is that getting the addition of interfaces to Ruby right, and finding out how to use them properly, is hard.

What I like about both Ruby and Ocaml is that you are not bound to a brain dead static type system, e.g. Java. You have quite a lot of freedom.

One warning in respect of Ocaml objects --- generic methods are a bit of pain and require quite a bit of work. I also can never make up my mind between the functional half of Ocaml or the OO half, and so I ended up wraping the functional half in an OO half which was quite a lot of donkey work.

Ocaml encourages abstraction. The more abstraction you use the smaller your programs becomes and the more repeated code is removed, but at the same time the program can become harder to understand because they end up being the composition of a lot of abstractions. Which goes back to the quote I started this message with.

The other thing about abstractions is: If you write a library of functions on demand, as you need the functions, then over your implemented functions there's a kind of logic which enables you to refactor it, to abstract it, the thing is, one single counter example (i.e. one new function) can totally change your logic and invalidate a lot of refactoring or design. This is kind of a problem with XP driven design, but I don't have a solution for it.

One last thing, let me have a go at translating that ruby code back in Ocaml (sans types):

method sibling_sym_metric_one lattice position =
  count <- 0
  lattice.each (fun parent ->
    let points = new Set in
    let parent_point = pos parent in
    lattice#each (fun a ->
      let a_point = pos a in
      let parent_relative_point = Point.minus a_point parent_point in
      points#insert(parent_relative_point)
    )
    (lattice#lower_covers parent).each (fun child ->
      let rel_child_pos = Point.minus (pos a) (pos child) in
      let sym_rel_child_pos = { rel_child_pos with x=rel_child_pos.x *. -1 } in
      if points#is_member sym_rel_child_pos then
        count <- count + 1
      end
    )
  )

That's better, having been informed by the Ruby code, but I still prefer the ruby version :slight_smile:

That's two more bits worth.

regards,

Richard.

Richard Cole wrote:

In Ruby I write a lot of unit tests because I expect errors. Also you can't ask the interpreter what the return type of a function is, or what the types of the arguments are, its all implicit so you need to invest more time documenting the code. But that's a good thing right?

I'd like to have interfaces in Ruby so I can specify type constraints on arguments and return values, the are constraints there implicitly already, I want to make them explicit. Problem is that getting the addition of interfaces to Ruby right, and finding out how to use them properly, is hard.

I agree and would be interested in your views about http://ruby-contract.rubyforge.org/