Why does Ruby seem to have fewer projects than other programming languages? - ruby

I've found Ruby to be very attractive; I like the fact that everything is an object and its syntax is very appealing.
I was hoping that it would gain a lot of popularity this year, but I don't see lot of activity in Ruby.
For instance if we take the number of tags added in SO there are only about 700 questions tagged as "ruby." This may be because:
Ruby is so easy, noone has any questions.
This site attracts more from the.Net community and Ruby developers ignore its existence.
There are not as many Ruby projects as there projects in other programming languages.
Other resources show Ruby is not as popular as other programming languages.
What reasons do you think are behind this?
Links:
TIOBE Programming Community Index for October 2008
StackOverflow tags
Ohloh

You're mistakenly attributing something to Ruby. RubyForge alone reports over 1,000 open-source projects, let alone all Ruby on Rails apps that exist, and the projects hosted on Github, Sourceforge, and elsewhere.
Unless you spend a lot of time on other sites (Reddit is a good example) you will be unaware of just how .NET/Oracle/SQL Server/etc.-centric Stack Overflow is. (I use a Greasemonkey plugin to hide a broad swathe of these Windows- and "Enterprise"-centric technologies, because they don't interest me.)
I actually had the complementary experience to you: I started spending time on Stack Overflow, and had something of a "woah" moment when I realized just how many people spend their days futzing with ASP.NET. That's not a world in which I'd spent any time, so I had underestimated its size.
Some parts of the internet (e.g., Reddit) are primarily concerned with free software and its associated languages: Perl, Python, Ruby, PHP.
Some parts (e.g., Lambda the Ultimate) are concerned with more esoteric languages: Haskell, Lisp, Joy, Coq.
Other parts (e.g., Stack Overflow) are more mainstream: Java, .NET.
You cannot draw any conclusions about the popularity of a language by sampling just one of these 'pools'.

Ruby had its moment in the sun in 2005 - 2006 when Rails was making its way through the community and Apple decided that it would package it with OS X. So to pick 2008 as the year for Ruby to gain a lot of popularity seems amiss to me.
The Ruby language itself is, as you stated, very attractive. Its syntax and OOP model are what make it a hit with developers. You get equivocally the same product as you would with another language, but with what feels like less time wasted on internals.
Rails is really what I think is holding Ruby in the mainstream right now, more or less because of its ease-of-use and database handling. Web developers love it for that.
If you really want to see sites that have a lot of Ruby(on Rails) chatter on them, you could check out http://refactormycode.com or http://pastie.org. Those websites are built on RoR and are used very frequently by Ruby(on Rails) users.

Regardless of any real numbers, one thing I do know: When I go to look for a Ruby library for something I'm working on, I find something satisfactory over 90% of the time. And for some of the remaining 10%, it isn't that hard to write something myself. I do believe that 90% figure will rise over the next few years, too.
If I get what I need, I don't really care whether PHP or Python or C# has sixty bajillion applications and libraries written for them. :)

I find Ruby very attractive in several ways, but it has some issues holding it back.
The biggest I think is that Python already covers much of the same ground, has a larger library of projects, and thusfar better performance.
The other main problem I've had is also the thing that keeps it so popular: Rails. I think there are a lot of people that don't even think of Ruby as a standalone language. While I appreciate that Rails is supposed to be pretty great, it is not anything I deal with, and thus I get annoyed at having to wade through so much discussion of Rails to find an answer to a question in Ruby as a standalone language.
One last thing that has made me skittish about it is the 'more than one way to do it' philosophy it shares with Perl. I was not a fan of that.
It is really a matter of their already being a few hammers around, and Ruby's main distinguishing feature that most people tout currently is Rails.

There's a lot of activity with Ruby in web-based development. You just have to join the right communities and lists.
I don't think it will ever be as popular as C/C++ (because of the existence of already deployed code and a developer base) or Java (because I imagine it isn't quite as easy to understand at first).

2 - Not many rubyist come here. I you look there is a TONNE of Ruby projects. Just not here so much.
Check out what is happening on Github, rubyforge etc. I mean, Rails for starters is massive.

Here's my theory:
Industry Adoption - Although ruby is used in the real world, other languages (e.g. Java, C++, C#, etc.) have been accepted as "safe languages". No one ever got fired for picking Java, or C#, but CIOs' eyebrows have been known to raise when ruby is mentioned.
Talent Pool - When selecting a language, you want to know that you can find a good pool of talent. The more popular the language, the larger the pool, and the greater number of experts (statistically) (statistics do lie 50% of the time ;) ).
My hopes:
I believe the ruby talent pool will grow over time and the productivity offered by ruby will present a huge incentive for its adoption.
More and more colleges will teach it.

Please don't take TIOBE too seriously. Checking search engines for instances of "language-name programming" as some sort of indicator of popularity isn't very meaningful.

More than likely because it is younger than a lot of other languages and, on the web side of things, isn't as easy to implement as PHP and Python. Ruby has also gained notoriety as a web scripting language due to Rails which may be turning off some developers who are looking for client-based languages to work with.
Is Ruby not popular? I think it is but it hasn't really reached a critical mass yet to be widely accepted.

Related

GUI tools that are actively developed and well documented for Haskell

I've spent the better part of my morning and afternoon playing around with GUI frameworks in Haskell, as I need some visualization and interaction capabilities and I'm not in love with writing my core functionality in Haskell then piping out to a front end written in another GUI; I'd prefer to do it all from one language. The better part of that better part has been spent compiling and patching source code, or Googling obscure compilation errors.
I've spent plenty of time reading SO questions, plenty of time on haskell.org, and plenty of time reading documentation. What I've encountered is a very large swath of outdated or poorly documented information. I can boil it down to these three things:
A glut of options built on top of Gtk+ bindings. I don't care for Gtk+ very much, mostly because I find it to be quite unpleasant to look at, especially on OS X. Griping about the UI looking out of place and/or just plain ugly might seem silly, but that's important to me. Especially if I want other people to utilize any of the programs that I create.
wxHaskell, which is stable and incredibly easy to install but many of the existing tutorials seem to be for wx-0.1x and the conventions for bridging the wxWidgets 2.9.x docs to wx-0.90.x are very very spotty and hard to grok, when they even exist.
qtHaskell, which seems to be mostly abandoned (correct me if I'm wrong), only compiles with newer versions of GHC after applying a year-old patch, and spits out a massive amount of warnings that indicate they will soon become compile errors in newer versions of GHC.
In effect, I'm looking for Haskell's answer to Java's Swing; a library that is robust, maintained, well documented, easy to get started with, makes an attempt to be native in look and feel, can keep up with GHC's development pace, and not at high risk for abandonment. This seems to be exactly zero GUI frameworks, but then it seems that most of the "official" resources/wikis/pages/docs related to GUI frameworks are woefully unmaintained so I decided to turn to the community to see if there was something I just wasn't finding. I'm not terribly worried about the framework being cross platform, just so long as it works on modern versions of OS X.
To reiterate, I'm not really looking for someone to send me a link to haskell.org or the WikiBook. I've been there, and I didn't like what I saw. Most of the information there is just so out of date that it only creates more work, not less.
I realize that my "demands" are a little extreme, especially for a language with a smaller community like Haskell, but I was hoping that someone out there could be of assistance to me. In the mean time, I intend to simply try and ride out wxHaskell or qtHaskell until I succeed or die.
I hope I'm not coming across as gruff or frazzled.
wxHaskell is good, yes, and my go-to GUI middle level library. I admit there's been a focus on updating the code before the docs in the new version.
For modern, functional-reactive-programming fun stuff on top of it I gor for reactive banana, which is actively maintained, and has the added benefit that Heinrich Apfelmus himself may well turn up here to answer your questions.
Threepenny-gui is the most recent contender in the space of Haskell GUI libraries.
Its main selling point is that it is very easy to install, because it uses the web browser as a display. It's also easy to get started with.
On the other hand, it doesn't even attempt to have a native look and feel – the UI is built solely on HTML. (This may change in the future, as we have the option of using XUL). Also, the API is still very much in flux, so be prepared that new major versions of the library are likely to break backwards compatibility. (On the other hand, this means that it's actively developed. :-))
(Disclosure: I'm the author / maintainer of the threepenny-gui package.)
I feel your pain; this answer is an attempt to provide some alternatives that may be good enough and perhaps help you with your search.
First, there is a language called Concurrent Clean. It is supposed to be similar to Haskell, has GUI support and is meant for writing real-world applications. It differs in some respects; for instance, its I/O is based on unique types rather than Monads, which as far as I'm concerned, is a good thing :). Here is a link:
http://wiki.clean.cs.ru.nl/Clean
Next, I dug around for a Haskell compiled to the JVM, in the hopes that it would piggy-back on the Java libraries, ala Clojure. No dice. What I did find was a SO thread discussing the lack and the challenges thereof:
Haskell on JVM?
From that thread however, two other options were brought up. One is Frege:
http://code.google.com/p/frege/
The other is CAL:
https://github.com/levans/Open-Quark
There's also work on functional reactive programming in Haskell. It's supposed to enable things like GUIs, although whether or not you'll actually get a GUI out of it is another matter:
http://www.haskell.org/haskellwiki/Functional_Reactive_Programming
It's sad. Here we have the JVM and .NET and yet zilch for Haskell. It's worse than that; .NET has shown an alarming tendency to ditch promising implementations. Whatever happened to IronScheme, IronLisp and IronHaskell? All dead as far as I can tell.
Not good :(

Automation of webbrowser using watir and ruby

I have installed ruby 1.9.2 and watir on my windows 7 system. Now I want to automate my web browser. Suppose there are 10 different links which I want my browser to browse after certain amount of time. How do I do this? I am new to ruby and watir. Can someone suggest me how the process of coding would be or suggest me a site or an ebook where I can get material regarding this.
Since a lot of the basics of scripting (conditional logic, loops, waiting, etc) are relative to the basic Ruby language and not the specific classes and methods implemented by Watir, I'd suggest starting off with a good book on scripting with Ruby.
My favorite is by one of the original folks responsible for Watir itself, Brian Marick "Everyday Scripting with Ruby: for Teams, Testers, and You".
In terms of watir, there's the tutorials in the Watir wiki, and the book that Zelkjo is working on.
The thing you describe, is 90% scripting (repeating a given type of action, with a different input, after a specified time interval) and 10% watir (navigating to the link value), so I'd start with the scripting stuff first.
For someone on a budget, I would also offer the following "free" books (I put 'free' in quotes because I'm familiar with all the time and effort that goes into authoring a book, and these are not 'free'. They come at the expense of a lot of blood, sweat and tears on the part of authors/editors etc. who have then been generous enough to then offer up their work without pay. I think calling them 'free' devalues the labor that went into creating them.)
"Programming Ruby: The Pragmatic Programmers Guide" is often installed by the Ruby installer (depending on version) or can be accessed at the link above. I've used this more as a reference than a learning tool, but it might work for you.
Why’s (Poignant) Guide to Ruby, available in both HTML and PDF versions, is somewhat iconic in the Ruby community. I found the writing style amusing and got some good stuff out it it, but then I'v been programming in a variety of languages since the days of teletypes and 110baud acoustically coupled modems.
Mr. Neighborly’s Humble Little Ruby Book - I've not read this one, but it seems well regarded if a tiny bit out of date. Aaron Sumner said of it "it’s relatively short (under 150 pages) and in a very friendly, accessible tone. If you’re still getting familiar with the Ruby language itself, it’s as good an introduction as there is out there."
All of those are I think more geared to someone who already understands programming, and not as good for a new tester starting out doing automation. For that you'd be better served spending the money for Marik's book, Since he's worked as a tester, and understands testing, and the book is largely aimed at testers, I thus think you can get far more out of it. Seriously it may not be free, but consider it an investment in your education and career.
I would suggest that you browser Watir web site: http://watir.com/
I have also started writing a book (current version is 0.6):
https://github.com/zeljkofilipin/watirbook
https://github.com/zeljkofilipin/watirbook/downloads

How long to will it take to learn Ruby as a scripting language?

I am required to automate software tests for my job and I currently use groovy to do this. However, I am thinking about adding Ruby to my repertoire. Mainly because I can see myself working on a rails project in the future.
How long do you think it would take to become relatively proficient at scripting with Ruby? I am talking mainly navigating around a DOM with webdriver/webrat and programatically doing text/file changing work.
One weekend of intense dedication.
Seriously, it's a matter of how much time you have got on your hands and what's your previous experience. If you've dabbled in Perl or Python, you'll probably have an easier time picking up Ruby than if you had just used Java before.
Depends on how much experience you have with other programming languages. You should be able to learn the basic ruby syntax in an afternoon. And then work on learning the testing libraries might take another couple of days of playing around with them. You certainly wont be a ruby expert but you should be able to hack together some test scripts pretty quickly.
You could start here -
Ruby in Twenty Minutes
Then maybe go here -
17 Videos Covering Basic Ruby Techiques
If you have programming experience I would say 2 weeks of intense focus on ruby will get you 99% of way....the major features of ruby that distinguish it from other scripting languages are its intrinsic use of iterators (you almost never code for or while loops) and associated code blocks. Once you become familar with these the rest of it falls into place.
A minute to learn ... a lifetime to master.
With no previous technical experience I started learning ruby, html, css etc at the same time and it took me 2 years before I could get something up and know what was actually going on. Rails of course makes all of this faster and if you already know other programming languages you could tackle the basics and be functional in 6 months.
Ruby has Nokogiri, which is an excellent HTML/XML parser. It supports both CSS and XPath accessors, making it very easy to navigate through a parsed HTML file's DOM.
Building on top of Nokogiri is Mechanize, which was based on Perl's WWW::Mechanize. It makes it easy to navigate through a website's pages, extracting fields, filling out forms and submitting them, tracking cookies and sessions, etc. Because Mechanize is built on top of Nokogiri, you can get at the underlying DOM and use the same CSS and XPath accessors.
Ruby has several different testing environments. Test::Unit comes with Ruby and is easy to use. There's also Autotest, RSpec, Shoulda and Cucumber to name a couple others. Autotest is nice because it will watch your directory and run tests as you modify the files, so you're instantly aware if you break something.
I came to Ruby from a Perl and Java background, with C/C++ before those. To me, Ruby is like a child of Java and Perl because it has some similarities to both, but at the same time the things that were annoying with both those languages are nicely sidestepped on Ruby. It's almost as if Ruby was the logical growth, or next generation, of the other two. I think that's partly the benefit of hindsight, and of Matz' intention to make Ruby be a language for programmers, not machines.
I tried learning Rails in parallel with Ruby, but caught Rails as it changed from v1 to v2. All the books were out of date and wrong, most websites were wrong, and finding good information was tough. Eventually I realized the confusion was in the documentation and backed away from Rails for six months and concentrated on Ruby, using it daily at work. I began using it almost exclusively because I was able to more succinctly express ideas in it than I could in Perl. I could write more tersely in Perl, but it wasn't as readable, which is important to me because that helps make code maintainable.
Now, a few years later, I prefer Ruby over any language I've ever used. I still program in Perl but evangelize Ruby at work, and use it any time I need to write something that touches a database, because of Sequel, or to write web front ends to the databases using Rails, Sinatra or Padrino, combined with HAML.
Depends, are you using any other scripting languages? Ruby is pretty straight-forward to some people. I found it easy to remember most of the common method names. If you've worked with other languages to any decent extent then it shouldn't be more than a week to be deeply enjoying the language. If it's your first time programming, you need to get a good solid grip on Object Oriented Programming to truly appreciate it.

Is there a website to look up common, already written functions?

I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
Possibly a wiki of some type that contains free code that anybody can edit and improve?
Edit: I can code things fine, I just don't know HOW to do them. So for example, right now, I'm trying to localize a robot/car/point in space. I KNOW there is a way to do it, just based off of range and distance. Triangulation and Trilateration. How to code that is a different story. A site that could have psuedo code, step by step how to do that would be ridiculously helpful. It would also ensure the optimal solution since everybody can edit it. I'm also writing in Matlab, which I hate because it's quirky, adding to my desire for creating a website like I describe.
StackOverflow.com. No, I'm not joking.
At its best, people come here saying "hasn't some library done X already", and very often the Collective Wisdom answers "yes". But the biggest obstacle is lack of a description language: even here, a big problem for many posters is describing the problem clearly enough for others to recognize it as something they've seen before.
And if people can't understand what you're trying to do, no search engine will.
Firstly, two caveats:
Copy and pasting code you don't understand is a bad idea. Make sure you understand exactly what the code does before you use it.
Make sure you respect the license of the code you are copying. This is important!
Those caveats aside, it's often language dependent. Languages with an open development ethos (not just an open source implementation, think Python as compared to Java) tend to have official archives of open source libraries. For example:
Perl (which probably started this trend) has CPAN
Python has PyPI and Python Cookbook
PHP has PEAR
C++ has boost
Ruby has gems
R has CRAN.
Haskell has Hoogle and Hackage
Furthermore, don't forget to look in your languages standard library. Some modern languages have massive standard libraries, which have often contained the functionality I am looking for:
Java has its API documentation
C# and VB.NET have the massive MSDN
Non-openly developed languages often have non-official community archives. For example:
C# tends to have a lot of code at CodePlex and CodeProject
MATLAB has the Matlab Central File Exchange
A third category of sites are language agnostic. They are often best search through POG (plain old-fashioned Google). For example:
Stack Overflow
SourceForge
The confusingly language agnostic Java2s
Planet source code
Github
Finally, a fourth category of sites that I find increasingly useful are source-code search engines:
Google Codesearch
Koders
You may also be able to find useful source code, or at least get help writing something, through various pastebins.
Pastebin is language-agnostic
HPaste is mostly Haskell, but has a little in other languages.
Often, at the end of the day it is easiest just to google it, though.
There is a wiki that contains free code that anybody can edit and improve:
Rosetta Code.
As a means of an overview there is the "Solutions by Programming Task" page.
From the former page:
"Rosetta Code is a programming chrestomathy site. The
idea is to present solutions to the same task in as
many different languages as possible, to demonstrate
how languages are similar and different, and to aid a
person with a grounding in one approach to a problem
in learning another."
Cutting and pasting code you find on the Internet into production code would be like chewing gum found in the street. - Mike Johnson
With that in mind, try sites that host opensource projects like GitHub, CodePlex, code.google.com, etc.
I'm not sure this question is language agnostic, but I use GitHub this way ;) Other languages may have places where this is possible.
Safari Bookshelf from O'Reilly has many, many books that contain many implementations from which to choose.
http://my.safaribooksonline.com/
I was a subscriber for a few years before coming to my current job, where we have a corporate account! It's one of the best perks, and one of the best resources I have available. I haven't bought a computer book in years.
Aside from sites like this (Stack Overflow) I don't think there's many, maybe CodePlex, but I almost marked you -1 for assuming that code found on the Internet is yours to copy.
I'd suggest reading about software licencing, I hope you'd at least comment where you got it from.

It's a good idea use ruby for socket programming?

My language of choice is Ruby, but I know because of twitter that Ruby can't handle a lot of requests. It is a good idea using it for socket development? or Should I use a functional language like erlang or haskell or scala like twitter developers did?
The company I work for uses Ruby for our web site. We have so far handled a little over 34,000,000,000 hits. We have no problem handling around 10,000,000 hits per day. Peak hits have exceeded 40,000,000 hits per day.
Scalability depends on a lot of factors. Our databases do a disproportionately high percentage of writes compared to reads, for example. While most websites do about 90% reads to 10% writes, we are closer to 50%-50%. My point is that scalability is affected by a lot of factors. If you are database-limited, as is often the case for web apps, it won't matter what language you use, you'll be waiting on your database.
There's a lot to think about if you are looking at handling large scales. Sharding databases, memcached, etc. etc. etc. etc. The language you use for your application is just one aspect, and often, though not always, a small aspect of scalability.
Ruby may be a good option for you, but there's a lot to like in other languages. Erlang tries hard to make it easier to recover from errors, for example.
I'm not sure that any "lessons" that the Twitter team has learned about Ruby (more specifically, Rails) and scaling would apply to your project. They're looking at WAY more traffic than most people can reasonably expect to see.
As far as sockets and Ruby go, check out I like Unicorn because it's Unix. It's quite an interesting read about doing sockets in Ruby.
I'd like to provide a bit of context first. I'm pretty active with the Scala community, and I would choose Scala over Ruby for any project.
So, having said that, keep with Ruby unless you actually hit barrier. If Ruby is your language of choice, it might just be that you'll never be happy with the choices you mention, particularly the statically typed ones.
It might be good to learn a new language, to have something to fall back on if you need an alternative. In your case, I'd recommend Clojure or Erlang. Scala is a good statically typed, OO language with functional programming perks. It might be easier to learn than the others, but people who really like dynamic typing don't convert to static typing easy.
As for Haskell, it's one of the most awesome languages out there (and much more well support and popular than the equally awesome alternatives), and can open your mind like nothing else. It's also tough to master.
If ruby is your favorite language, yes it is a good idea. It is always better to use what you know and what you like
Whereas you may get better performance from a functional language such as Erlang the suitability of Ruby will really depend on what you are trying to achieve. For example how many requests are you going to be handling is probably the first question, if the performance benefits of using Erlang don't make much difference use something you are comfortable with, why learn a new language if you don't have to?
You at least have the option of staying in your favorite high level language if you use a fast, concurrent language like Haskell, Erlang or Scala. With Ruby, performance bottlenecks will mean switching to compiled C (or Haskell, or ...) for speed anyway.
Ruby has the advantage of good frontend frameworks.
I have also used Ruby for many projects though I've recently moved to Scala and like it quite a bit. One thing that I've heard good things about (but never tried myself) for network stuff in Ruby is EventMachine. It uses the Reactor Pattern just like twisted and it seems quite solid.
The key is to have a low level library in C/C++ that does the socket multiplexing for you. Socket multiplexing is what makes a TCP server process truly multi-user. such libraries in C (which is what you want) could be libevent/libev... and in c++ boost::asio. Python has twisted that does it behind the scenes.
If you get such a library and use it in ruby you should be able to implement most socket programs fairly well. This is especially true on UNIX oses which favour multi-process to multi-threading.
Having recently written (actually still doing so now), a project using sockets with Ruby and Java I would say no. The ruby socket implementation is poorly documented unless you plan on writing a basic blocking chat server. I found writing in C or Java simpler, Ruby wraps up native sockets and your kinda left wondering how the hell to use it now. I have previously written plenty of socket code on windows, Linux and other platforms in C, with less stress.
My Ruby code now is very small and works well, getting to that point was a real pain.

Resources