How do you ruby people find the good libraries when you need to perform a task? Is it all word-of-mouth (word-of-blog I guess)?
How do you ruby people find the good libraries when you need to perform a task? Is it all word-of-mouth (word-of-blog I guess)?
Should "rack" be called standard-http-server-api-with-support-for-middleware, and then "unicorn" be called pre-forking-web-server-using-standard-http-server-api-with-support-for-middleware?
No, but perhaps we could have:
WebServer = require_any_satisfying_protocol 'http-server/with-middleware-support'
WebServer.new
where each rubygem installed has a table of protocols each of its classes and modules support. For example, Mongrel would have a table that starts: {Mongrel::HttpServer => ['http-server', 'http-server/with-middleware-support']}As an example, their proposed HTTP interface can be found here:
1. In practice you almost never want to load a random library that says it supports a certain interface, you will want a specific library. Notable exceptions are glibc where the interfaces are well-defined over several decades but that brings us to...
2. Few libraries implement the same exact interface. Mongrel and Unicorn have totally different interfaces. Phusion Passenger is also a web server but works in a fundamentally different way from either of them. Hpricot and Nokogiri are both XML parsers but their usage API is different.
class Mongrel::HttpServer
class HttpServerProtocolAdapter < Gem::ProtocolAdapter
implements 'http-server'
implements 'http-server/with-middleware-support'
...
and the manifests (which would then look more like this:) {'http-server' => Mongrel::HttpServer::HttpServerProtocolAdapter,
'http-server/with-middleware-support' => Mongrel::HttpServer::HttpServerProtocolAdapter,
...}
would be generated automatically at gem installation by loading the gem and then probing for ProtocolAdapter instances in ObjectSpace.Of course, if you had a class that matched the protocol exactly, you could just use something like
class Mongrel::HttpServer
supports_protocol 'http-server'
end
and be done with it.This is all assuming that we don't actually want our protocols to be modules or classes or something else that we have to include in the adapter somehow (because this is Ruby, and we do well without needing IDuck.) Instead, protocols would just be externally specified things, with their name-strings perhaps being the URIs of standards docs. At most, if a Gem::Protocol was a reified type, it would be a unit test suite to determine whether a ProtocolAdapter actually supported its protocol (minimally, via a series of #respond_to?s.)
Java is, of course, one place where this is a bit better. log4j and jUnit both tell you what they do quite easily. (But then again, Apache Maven does not.)
We have Google these days, and if that doesn't help you, go on the #ruby IRC channel and ask what they recommend.
awk -> I forget what
grep -> global/regular expression/print
sed -> stream editor
perl -> I'll give you this one
cat -> concatenate
finger -> I'll give you this one
man -> manual
A large percentage of them are mnemonics.Nokogiri is the 5th result for me. How does anyone find libraries and then choose between them? I believe you should always do a little research unless your feeling lucky.
$ gem install rack-cache
$ irb
irb(main):001:0> require 'rack/cache'
=> true
irb(main):002:0> Rack::Cache
=> Rack::Cache
Only a japanese person could have come up with this clusterfuck — it's like dealing with Kanji!Humans brains are by nature powerful association engines. People tend to associate brand names with their purpose and (perceived) quality pretty quickly. If you've heard of that a once and the product turns out to be good then you are likely to remember it in the future. Why do you think Coca Cola is called Coca Cola and not Black Sweet Beverage? Heineken instead of Dutch Beer? Nike instead of Expensive Nice Shoes? Names do not have to be descriptive.
It confuses people for maybe a few minutes. Then they look for information, find it, and they move on. There's absolutely no point giving products generic names because in the long run it hurts the authors by being unable to differentiate themselves from others who do the same thing.
Don't know what "nokogiri" is? Search the internet and the first result will tell you. Looking for an XML parser but don't know its name? Search the internet and the first result likely gives a good recommendation.