
Ask HN: How widely used is Ruby without Rails? - vanilla-almond
Is anyone using Ruby for web development without Rails? If so, what were using your reasons for <i>not</i> going down the Rails route and how have you found the experience?<p>If you aren&#x27;t doing web development, what non-web tasks are using Ruby for and how have you found the experience?
======
SamReidHughes
I sometimes use Ruby as a Perl replacement, where I'd use Perl as a Bash
replacement. Little scripts that invoke shell commands and the like, such as
one I made to build my website. It's a superior Perl replacement.

I wouldn't use it for serious, big software, because it's dynamically typed,
and worse, it has a grievously dynamic runtime.

------
brudgers
There's Sinatra for Ruby web development without Rails.
[http://sinatrarb.com/](http://sinatrarb.com/)

------
sethammons
We have Ruby for our sensu checks that run on our zounds of nodes. Ops folks
seem to enjoy it. I dislike Ruby, and my dislike compounds every time I touch
chef, nspec, mini test, or any Ruby test framework. So much magic and custom
DSLs.

~~~
vanilla-almond
Interested in learning more about 'so much magic and custom DSL'.

I'm learning Ruby at the moment and find the syntax very readable but I
haven't ventured into more complex topics and I certainly want to avoid
'magic' methods.

~~~
sethammons
I can get more specific, sure. I'll preface this as a minor rant. I work with
between 4 and 6 languages at work. I don't work with some of those languages
daily or even monthly. That means that I am not an expert in Ruby by any
means.

Ruby is the only language where I've accidentally copy-pasted unicode
whitespace and the language decided that that character must be an undefined
function:

    
    
      puts "hello"
    
      <main>': undefined method ` ' for main:Object (NoMethodError).
    

An example of magic. In our chef helper methods, you might see
"company_app_helper_verify_app_started myApp". Naturally curious, you look for
that function. It exists no where in your entire organization. Why? Because it
is actually defined in two different files, one function is
"company_app_helper" and the other is "verify_app_started," but because Ruby
is amazeballs, you can create new functions on the fly and so something
somewhere is conjoining the two methods into one method and doing magic to
make it work. You can argue "yeah, but that is not Ruby's fault." And I would
say that there are many Rubyists who love to do strange things like this.

Optional Parenthesis. Now it is hard to tell what is an argument and what is a
function call.

Testing. `expect(foo(4)).to be_nil`. You have to memorize a whole testing DSL
to know your options. What can go after "to_"? `expect{ stock.increment }.to
change(stock, :value).by(100)`... Like, while you can read it, you have no
idea how to compose it without knowing the testing DSL. And the following:

    
    
        describe "order" do
         it "is marked as complete" do
           expect(@order).to be_complete
         end
    
         it "is not yet shipped" do
           expect(@order).not_to be_shipped
         end
        end 
    

I can't see any value add to that over the following made up syntax that looks
like most other tests I'm familiar with:

    
    
      func TestOrder():
        order = new(Order)
        if order.is_complete != "complete"
          fail("expected to be complete")
        if order.is_shipped == true
          fail("should not be shipped yet")
    

The only difference being that in the second example, you just need to know
your language's normal code to do the tests. No need for a framework full of
custom extensions. Tests are just code.

I think a lot of programmers love to build up an encyclopedia of obscure
knowledge on how to do things in their languages. It gives them a sense of
dominance or something. Personally, I don't want strange syntaxes that help in
some obscure case. I want straight forward code that is both straight forward
to read and to write. I don't want custom DSLs, strange test structure, and
such. I want a new person on my team who is basically familiar with C-like
syntax to be able to be productive quickly.

~~~
vanilla-almond
Appreciate the reply. I don't feel experienced enough in Ruby to make an
informed judgement yet on the language, but I like what I have learned so far.

I wonder if the use of DSL reflects a poor choice for solving the problem
rather than an inherent problem in Ruby?

> _I think a lot of programmers love to build up an encyclopedia of obscure
> knowledge on how to do things in their languages. It gives them a sense of
> dominance or something. Personally, I don 't want strange syntaxes that help
> in some obscure case. I want straight forward code that is both straight
> forward to read and to write._

I agree 100% and this behaviour can be found in programmers across all
languages.

