What are you doing in Ruby? What things does Ruby have over other languages?

I decided to learn Ruby, and I wanted to ask, what things did you feel, how did Ruby do better than other languages, the means that it has, and the position of the language in the industry today among other languages ​​is a strong competitor? What target audience does it target for web developers / GUI programmers / 10 scripts? Please give me your opinion :)

+7
ruby
source share
9 answers

Personally, I have 2 use cases for Ruby:

Service Scenarios . I have many tasks at work that I would classify as "service." These tasks range from manipulating data from an Excel spreadsheet and importing into a SQL Server database to clean up a directory full of files, to create test data that I don’t want to create manually. Some of these scripts are quick 10-line scripts, and some of them apply to small applications, which I use quite often.

There are a few things that make Ruby really enjoyable for this:

  • It is very easy to start with a script. Tools like Rake are for organizing tasks, and I don’t need to create a bunch of extra frames to get started.

  • Libraries I know that other languages ​​may have excellent libraries, but so far the Ruby libraries have suited my needs. And RubyGems makes it easy to install the library without having to manually download and install it.

  • Ruby has many built-in functions that make reading and processing files very easy.

  • DSLs . There are many tasks that are repeated and amenable to the creation of domain languages. Ruby has a very flexible syntax and has some functional aspects that give you more flexibility in how you write your programs. Often you can combine common functions in a DSL that suits your task.

Another thing I use Ruby for (to a lesser extent) is web development . The Ruby on Rails framework is what I mostly used, but I played a little with Merb before announcing a merge with Ruby on Rails.

I like Ruby on Rails for all the reasons I like Ruby. In fact, these are mainly Ruby features that make Ruby on Rails great. Rails itself is a domain-specific language written in Ruby, which makes web development a lot more fun (in my opinion) and faster.

I think a lot of people have the same attitude towards Ruby, and the community still seems very active and vibrant. I think this is a great language to learn what will be used for quite some time.

+8
source share

I code almost everything except Excel macros and heavy duty / long-term math functions with Ruby. And I usually prototype the latter in Ruby. I haven’t written any non-web interface material for a long time, and would have thought twice about using Ruby for this, although, to be honest, I would have thought twice about this. shoes and wxRuby are interesting. If I was going to write a game, I think that my limited ambitions will be satisfied by gosu

Currently, "everything" mainly consists of:

  • Rails and related materials.
  • Task automation and scripts
  • Project Euler Puzzle

"What is he doing better?" a bit subjective. I prefer it to Python and Perl, at least in part because of its fundamentally object-oriented design. I like its proximity, close to Perl, but more readable. I like the openness of the built-in classes, allowing me to add methods rather than create new classes. I am fascinated by the many alternative implementations that appear and potentially can use convenient syntax for new problem areas.

This is not lightning fast (although it speeds up), but, frankly, it’s basically fast enough: I don’t have much different experience between programs that take 10 milliseconds and 10 microseconds.

+4
source share

Ruby is a good language for developing and using "internal domain languages", DSL for short. DSL is a notation specifically designed to represent a specific business area; “internal” to distinguish between notations that are not compatible with the host programming language (for example, XML notations for project build files) and notations that are a variant of the host language (for example, the Ruby Make equivalent called Rake). See Martin Fowler's article .

+2
source share

Ruby does a better job of anything related to word processing, and is very good at being flexible, that is, provide developers with the ability to write very elegant, readable code. If you want speed, this is not the place, but for many things it does not matter.

If I were to give one thing in which Ruby excels it, then it is basically designed to be very readable. Matz writes about this in Beautiful Code, this well-written code is an essay to communicate ideas to other people, not computers.

+1
source share

What I like most about ruby, unlike python, is the blocks and the retry command. This is really useful and can lead to incredibly legible code.

+1
source share

One of the main reasons for learning Ruby is to fully utilize its fantastic RoR framework for building web applications. In addition, Ruby can do almost everything other popular languages ​​can do. Ruby is better documented, has a large community, and in the case of RoR, in particular, best practices are used. Ruby has amazing readability. It has some good concepts, such as mixins, blocks, etc., which makes it a great OO language.

0
source share

ruby is great for prototyping. its amazing how fast you can write a concept profile in ruby. language gives you everything you need and stays in your way.

0
source share

@gs: Ruby recently turned off the retry tool.


Ruby lambda expressions use a very light syntax, making them pseudo-invisible.

Unclear things are provided, such as anonymous blocks (currently I don't know many other languages ​​that have this provision).

Syntactic coherence exists even with manners that can be used instead of others; it has an almost English feel, creating an environment in which even the most ignorant beginners will feel comfortable. The code is much shorter and more compact than regular C / Java and Python mantles.

Everything is an object.

It allows you to use internal manipulation and language management for specific domains.

There are probably dozens more that I could list, and perhaps even more cons; I tend to write small quick and dirty programs that I need on a daily basis; I have not coded it for a very long time, but it should definitely be started by a beginner. I know, I like working with him :)

You should probably learn this if you want to learn Ruby. You should also read this too.

Ruby programming language http://www.rubyinside.com/wp-content/uploads/2008/02/hummingbird-book-the-ruby-programming-language.jpg

0
source share

In each case, when I will use the Perl script before: system administration scripts, text processing, access to databases such as Oracle, LDAP. Probably 95% of my current programming is done in Ruby. Web applications with frameworks such as Ruby on Rails and Merb.

0
source share

All Articles