Live data from Hacker News

Ruby is beautiful (but I'm moving to Python)

wit.io

31–40 of 68 posts

Re: Ruby is beautiful (but I'm moving to Python)

#31
In Ruby, everything is an object and responds to messages. And it turns out that we can ask a number if it’s even or odd. In other words, numbers have our criterion function built in, and we don’t have to define it at all.

I absolutely hate this. In fact, I'm not a huge believer in object-oriented programming in general.

    even?
Is not an operation that integers perform. Integers do not contain methods -- they are data. even? is function that operates on integers. Integer is a type. Objects are object types. An object which contains an integer is an object-integer type. An object-integer type is not the same as the integer type. Why do we constantly feel the need to wedge objects into everything in existence when often what we really need are algebraic data types, functions, and namespacing/modules?

As you can tell, I like the ML family.

Re: Ruby is beautiful (but I'm moving to Python)

#32

In Ruby, everything is an object and responds to messages. And it turns out that we can ask a number if it’s even or odd. In other words, numbers have our criterion function built in, and we don’t have to define it at all. I absolutely hate this. In fact, I'm not a huge believer in object-oriented programming in general. even? Is not an operation that integers perform. Integers do not contain methods -- they are data…

>Why do we constantly feel the need to wedge objects into everything in existence

Because... it's convenient?

Do we need a reason?

Re: Ruby is beautiful (but I'm moving to Python)

#34

In Ruby, everything is an object and responds to messages. And it turns out that we can ask a number if it’s even or odd. In other words, numbers have our criterion function built in, and we don’t have to define it at all. I absolutely hate this. In fact, I'm not a huge believer in object-oriented programming in general. even? Is not an operation that integers perform. Integers do not contain methods -- they are data…

I'm increasingly not a fan of OOP. If I wrote this article again, one of the things that would change is this sentence.

Re: Ruby is beautiful (but I'm moving to Python)

#36
post #13

Seems like it would be a huge opportunity for people to start creating these science Ruby gems. Not my field, personally...

It's been tried before. mum, Numerical Ruby and SciRuby were all attempts. The fundamental issue I believe they all had is lack of community. There is a quite large community of folks using Python for scientific computing. Many are not professional developers but rather scientists / engineers who aren't as open to jumping around to different languages as a developer would be. These issues combined with the fact that…

>It also doesn't help that such capability have to be implemented as C extensions due to performance requirements.

If you think the NumPy and SciPy stacks are pure python, you'll probably be surprised to find a lot of C and fortran sitting under the hood.

Re: Ruby is beautiful (but I'm moving to Python)

#37

In Ruby, everything is an object and responds to messages. And it turns out that we can ask a number if it’s even or odd. In other words, numbers have our criterion function built in, and we don’t have to define it at all. I absolutely hate this. In fact, I'm not a huge believer in object-oriented programming in general. even? Is not an operation that integers perform. Integers do not contain methods -- they are data…

Your rant isn't an argument, it's an opinion. I can just as well say integers are objects like any other and even? makes perfect sense as a method on them because that's the entire point of objects in the first place, binding state and behavior together into a single smarter package because it's a convent method of organizing code.

Re: Ruby is beautiful (but I'm moving to Python)

#38
post #19

I wrote this article almost a year ago as a tribute to my favorite language at the time. (That title now belongs to Clojure.) It feels like if you want to do scientific computing in Ruby, you're met with obstacles at every turn, but with Python, you're greeted with open arms and tested libraries. That could change (and I'm beginning work on a stats library for Ruby), but it will take time. This was partially a call t…

I had a similiar experience myself actually. You should actually check out the R language if youre interested in scientific computing. Speaking of the python communittee i watched many videos from djangocon this year and was really impressed by the openness of the leaders of the project. Also django i think is rally starting to gain more momentum. Alot of very cool things going on with the framework and communitee..

From the article:

"I’ve already used Ruby at work to dramatically speed up some of our vaccine screens—for processing and summarizing data—but I’ve always had to pipe my numbers into R for statistics and graphing. Because unfortunately, despite all the hubbub around Ruby, no one is crunching numbers with it! I’m sick of R, though, and I want a complete solution for my numbers needs."

Re: Ruby is beautiful (but I'm moving to Python)

#39
post #13

Earlier quoted context omitted.

It's been tried before. mum, Numerical Ruby and SciRuby were all attempts. The fundamental issue I believe they all had is lack of community. There is a quite large community of folks using Python for scientific computing. Many are not professional developers but rather scientists / engineers who aren't as open to jumping around to different languages as a developer would be. These issues combined with the fact that…

>It also doesn't help that such capability have to be implemented as C extensions due to performance requirements. If you think the NumPy and SciPy stacks are pure python, you'll probably be surprised to find a lot of C and fortran sitting under the hood.

I know they are not written in Python, that comment wasn't meant to be a knock on Ruby's performance in any way. Its simply the case that writing a highly performant vectorized computation library in a language that doesn't allow direct memory manipulation is a non-starter.

Re: Ruby is beautiful (but I'm moving to Python)

#40

In Ruby, everything is an object and responds to messages. And it turns out that we can ask a number if it’s even or odd. In other words, numbers have our criterion function built in, and we don’t have to define it at all. I absolutely hate this. In fact, I'm not a huge believer in object-oriented programming in general. even? Is not an operation that integers perform. Integers do not contain methods -- they are data…

I don't get your argument. What's the difference between

    module Numeric
      def even?
        # ...
      end
    end
and

    even? :: (Numeric t) -> a
Both declare functions that consume something implementing the Numeric type/protocol, and return something else. I don't see the practical difference between them, other than the calling syntax of the result.
Post reply on HN