Archive for the ‘ruby’ Category
git
I’ve been content with Mercurial as it’s fast and lets you do development and for the most part keeps out of your way. It has few dependences and is a great DVCS. However, the problem I am finding with Mercurial and one of the great benefit’s of DVCS is branching and Mercurial, I think, gets its branching legacy from CVS/Subversion.
To branch in Mercurial you basically clone the repository into a new repository and work in the new repository. For example, say you have repository A. Branching it involves running cloning A into B. You make your changes in B and merge them back into A when you are ready. This works but it sucks especially for Rails development which I do.
The way one usually does Rails development is you have a checkout of a repo and you run a development server and work on those changes. However, when you want to branch in Mercurial you have to go to the new directory and start a new server instance and develop, merge, stop the server, start new server, etc. For some of you this may be fine, but for me it is a pain in the ass!
This is one of the things I like about git all the branches are within the same directory tree so you don’t need to do all those change directories. You can basically branch within the same tree and work with that. No need to clone all these repos to different directories.
Now the things I dislike about git is that it’s written in C! When I went to install it on Debian it had n+1 different packages it had to install! Though, I am biased toward scripting languages I personally think it would have been easier to port the app in the long run.
However, another feature that I love about git is git-svn. It make branched development so easy as the branches are local so best of both worlds. This is especially since I work with a lot of subversion code bases. If I need to make different patches it makes it simpler to do so, especially when requirements change unexpectedly and you want to start a new branch without checking out the trunk again.
So I’m going to play with git for a bit longer, but overall for now I like it. The documentation has clearly improved since I last looked at it.
Ruby and the Way Forward
Ruby has just won me over. I mean there are so many things to love about it and several to hate, but I must say the language itself is quite nice. I have always been a Python fan, but I feel Ruby is a better Python. It is what Python should have always been.
Things I like:
- Any object is extendable. I love this because it keeps things pure. Who wants to figure out whether it is len(blah_list) when you can do blah_list.length. Objects have properties and those properties are extendable or should be easily so to meet the needs of the developer. I’m not saying other languages don’t have something like this, but Ruby just makes them so easy. I know this is ripe for abuse by people who may want to convert their Array objects to do array objects weren’t really meant to do, but overall it’s still a cool feature.
- Blocks! Every Ruby user uses blocks as an excuse and I’m also going to be one of them. However, blocks are wonderful. Python has them too and the recent with statement is going to make it even easier.
- Gems. Alright not really part of the language itself, but might as well be. My pain with Python has always been to install third party libraries and recently it has been getting better with easy_install and eggs, but considering the Ruby community dealt with that issue as the community has been growing is great since it makes it easy to deal with dependencies of libraries and if future Ruby releases have gems built in it will make it even better. This is one idea from Perl that is just awesome and Ruby implemented it pretty well.
- I love the Regex support as part of the language itself. I mean Python was great and all, but I found it a pain to use Regex through libraries then again maybe I’m just an idiot? But having full support in the language itself is just friggin awesome.
- ` for running system commands. Simple and returns a string so you can muck around with the output if you so choose. Great for those fast scripts.
Things I dislike:
- Ruby has some weird method names for some of the standard libraries. Like how the hell am I supposed to know that ‘test’.intern converts a string to a symbol.
- The global variables! It seems like these could be abused and would be best if they weren’t there. I mean all these things can be implemented mostly without them or with more logically named ones.
- Looking at the Ruby code there seems to be a break of style within code for various libraries. Python is amazingly well organized in a consistent style while the Ruby code mostly the core libraries seem to be inconsistent in their style. I may be anal in that I hate seeing
def method param, param2and
def method(param, param2)
in the same class for different methods. It just doesn’t look good! So I would think there should be a style set for the core language code itself. - Documentation. Ruby’s documentation isn’t really it’s strong point, but it is getting better. Meanwhile, Programming Ruby is an amazing book and I recommend it to everyone learning Ruby.