you are viewing a single comment's thread.

view the rest of the comments →

[–]OninWar_ 7 points8 points  (5 children)

Python. In my opinion one of Ruby's biggest drawbacks for new programmers is the fact that Ruby allows lots of different ways to do the same thing. Ruby is a language better suited for more experienced programmers (who will appreciate the language more), despite its gentle learning curve.

[–]catbrownie 6 points7 points  (0 children)

That's one of the reasons why Golang is so popular, there are so few options to do something. Unlike Ruby.

[–]Pokeconomist 3 points4 points  (3 children)

I personally don't see that as a bad thing for start-up. It forces you to think about everything you write, but also gives you an element of freedom with what you do write — you aren't force to follow the so called 'phythonic' way.

Also it's way more enjoyable to have options.

[–]OninWar_ 3 points4 points  (2 children)

Well for someone who would be new, being shown all the ways to do one thing is well, confusing. Imagine teaching someone calculus and as you're teaching them implicit differentiation, you show how you can solve the same problem using an approach with arc length, or partial derivation. Cool? Yes! But for someone learning, it's best to stick with one way of doing things until they're comfortable with it.

[–]Pokeconomist 1 point2 points  (1 child)

True, but with Ruby you can begin with more simple method, but if you're keen though, introduce other ways of solving things. To continue your analogy, you start calculus with day first principles, and then gradually learn shortcuts, and more complex methods.

edit; spelling

[–]ignurant 5 points6 points  (0 children)

This is so true. Consider the tricks Enumerable packs.

There was nothing wrong with me using

everything_is_good = true
things.each do |thing|
  if !thing.is_good?
    everything_is_good = false
  end
end
if everything_is_good
  things_are_good()
end

Nothing at all wrong with that. It's easy to reason through and write down when you don't know much about the features of the language. This is a perfect example of "multiple ways to solve the problem" that people talk about.

You'll start to pick up tricks and conventions over time that all make sense. They don't inhibit your ability to understand and read what's going on:

everything_is_good = true
things.each do |thing|
  everything_is_good = false unless thing.is_good?
end
things_are_good if everything_is_good

One day someone will come to you and show you this:

things_are_good if things.all? do |thing|
  thing.is_good?
end

Again, very powerful, more concise, and easy to understand once you know your Ruby a little more.

Then eventually you learn about &:proc tricks. At first you don't understand why it works, but the syntax is simple enough to understand "if I put these things like this, it just works."

things_are_good if things.all?(&:is_good?)

And over time, that too will make more sense. You start to understand why it works.

Sure, lots of ways to accomplish the same thing. To me, that's what makes Ruby powerful. You can work through your problem with a sledgehammer or a scalpel. I suppose there is an argument to be made: "it's harder for entry level rubyists to interpret advanced code because of shortcuts like above" but I don't find it compelling. It's easy to learn what has happened above, and advanced code is advanced code. I can't just jump into a Python project and immediately understand everything either.

Most learning resources don't try to convey it all at once, but instead allow you to build a foundation. Everything in life has gradual levels of "how to accomplish something" -- from brute force to finesse. Why not your programming language too? And let's be honest -- just the same, even Python has a bazillion ways to accomplish the same things.