Tuesday, July 24, 2007

Ouch, Ruby bites ;-)

Today I learned that closures ain't that pretty as I tought :-(

Imagine this code:

array.delete_if {
|entry|
if entry == "deleteMe"
return true
end
return false
}

What would you expect from this code? Probably not an exception: unexpected return (LocalJumpError).

Seems that the closure itself is executed at the scope of code it was defined. So return there means return from to scope array.delete_if is. Strange isn't it?

There's worse, to return value from a closure you need to use a rule that says - last evaluated expression is used as a return value from a block. So code above should look like:

array.delete_if {
|entry|
if entry == "deleteMe"
true
else
false
end
}

That forces to control flow in your block.

I don't like it. I hate it. Isn't there any better way?

Maybe I'm too fresh to ruby and there is one that I'm not aware of. But that's a big minus. Makes your code look like a (put the right word here ;-).

Friday, July 20, 2007

My 5 cents on Ruby

So I've been playing with Ruby for whole two days!

I had to update our backup script for subversion repositories (was written in shell) so I decided that it would be nice to learn something by the way.

I can't publish the script (sorry, corporate policy :-( but I can write about my feelings about ruby.

Let's start that it was easy to find tutorials and documentation. That a must have for any new language that wants to be popular. I've been satisfied with ruby documentation available on-line. I haven't checked ri manuals yet. I used only simple stuff from core library.

Ruby's nice, easy to start with. I recently started using python. So I can compare how easy was to start with any of them. I must say I think it was easier with ruby. But I have some concerns about this language - read on.

First I must say I'm impressed with ruby's closures - a closure is an anonymous block of code that can be executed or passed into a function, etc. So you can for example call a method with some code that you want it to execute, you don't have to specify interfaces, implementation like in Java. You just write you code. Easy as that!

Closures are great for controlling resources and preventing resource leak. Let me explain. If you want to read something from file you can do something like that:

File.open("path", "r") do |file|
integerValue = file.read.chomp.to_i
end

What it does? It will open a file, run your code, close the file. In case there's a problem reading the file resource will be closed and you don't have to worry about it. Between "do" and "end" there's an anonymous block of code that will be given to open as an argument.

What else I like? Exception handling is interesting. First it doesn't follow of common naming convention as: try/catch/finally. You can begin (try), rescue (catch), ensure (finally) and else! "Else" is used when you want to do something only when there was no exception. Nice, isn't?

Other interesting things - you have block of code with beginning and end so it's not like in python - you don't have to keep your indentation.

Function is not a function - it's a message (like in SmallTalk). Objects respond to messages. It's easy to create a proxy that sends different messages to different objects, you can add some tracing on your objects easily, you can decide in code which messages are active on the runtime!

The world of mix-ins - sometimes there's some functionality that can be shared between many objects. Ruby allows you to keep it in some separate module and include it to your objects. Yup, you don't have to extend a class, you can just share some code.

Strange things - you can define a new function (message endpoint) on an object - an instance not a class. In this case all other objects of the same type will not have it!

Type safety is strange. It's nothing you're used to. Ruby implements tactic if something ducks treat it like a duck. That's possible because every function is a message so you can just send any message to any object.

You can do something like that:

duck = MyDuck.new
dog = DockThatDucks.new

animalsThatDuck = [ duck, dog ]

animalsThatDuck.each do |animal|
animal.duck
end

Dog that ducks is a duck, isn't it? ;-)

I enjoyed using ruby but I'm full of concerns. Sure it's nice to code but I'm not sure that you can build something big on it. I feel that it's too close to become next PERL in which it's easy to write something, it's impossible to read code ;-)

Closures are a tempting tool but they can be overused. Also mix-ins. It can be a PITA to find what's extending what and why or when.

Wojciech some time ago wrote about project done by ThoughtWorks in JRuby on Rails. I wonder how their code looked like. That code could prove that either Ruby's is or not good for large projects. Sure it's cool (as any other new, shiny thing ;-) but will it survive next years?

I'd like to get more familiar with Ruby on rails then I'll can tell more.

Tuesday, July 10, 2007

So, consultants seem to be able to code...

Referring to my previous post - it's already July and yes - they (almost?) did it - Mingle has been released on 30th of June (so according to the promise - in June 2007 - but apparently at the very latest moment).

I wrote "almost?" as Mingle isn't still (even today) publicly available, but rather as an "early access".
On the other hand, first reviews (e.g. here) seems promising.

I like the concept "everything is wiki" and that "the tool is for you and not vice versa". I like nice web UI, drag and drop, various features.

I don't like licensing model. Definitely it would be good to have some decent price for the full product (Professional or Enterprise version or whatever you call it) regardless of the number of users. Without it, Mingle for typical small software company (or IT department) with, say, several project teams, each 5 - 10 persons (so in total say 45 people) is quite costly.
My quick math:
45 total users - 5 free users = 40 paid users
40 x $59 x 12 (months) = $28320

Wow, that's lot of cash. And it has to be paid every year... For such money, you can have a set of several decent tools all together, like: JIRA ($4800), Confluence ($8000), FishEye, Clover and more. And these tools don't need to be paid for every year. What if you use free tools (like e.g. Trac, Subversion or even Eclipse or NetBeans)? It is quite drastic comparison.

There is some special enterprise licensing (50 users and up), but as the terms are not publicly disclosed, I don't like it and cannot fully count it.

Still, what I am trying to say is: typical startup, or a small agile outsourcing company or a subcontractor having a few dozens of developers would have to pay $28K annually just for single tool. Whereas this would not be probably an issue in richer stable companies and countries (but believe me still it can...), I wonder how much potential users working in European emerging markets, Asia or just in any start-up would have to resign and turn to some cheaper or free alternative.

Coming back to the tool itself: looks promising, but needs more "battle tempering" and evolution influenced by the market - real users. In 2 or 3 releases it will probably deserve second try. Meanwhile I am counting that the licensing model will also evolve.

As usual: We will see...

Adobe Flex development process goes public

Probably many of you heard in April that Adobe was going to open source their Flex development framework.
Today, quite accidentally, I've bumped into their public bugtracker - guess what: it's JIRA (http://bugs.adobe.com/flex/).
It's great to see which (and how many) Adobe employees work on what issues, it's great to be able to cooperate with them. Yet even greater thing is to use to force by reading the source :)

The transparency - one of the biggest assets leading to better software (not only).

Another thing: JIRA as a bugtracker of choice for Adobe Flex provides a great case study for Atlassian. But IMHO they deserve it.

Fly in the ointment: Flex JIRA is with its current 24 000 issues one of the slowest public JIRA instances I've ever visited. 24K issues is not a problem for JIRA. Has Adobe chosen too poor hardware? Or has the popularity (number of concurrent visitors) exceeded expectations of the authors?

We will see...

Monday, July 9, 2007

There's new sheriff in town ;-)

Do you know what's ADD or CDD or GMPM? No? You're kidding me, right?

So you really saying that you don't know? Man, you're really outdated on the most modern software development methodologies ;-))

Go and learn quickly more or you're be out of the business soon...

Wanna get 5000 bucks?

Jeff Atwood decided to donate part of revenue coming from his site to .NET community.

Why .NET community and not XYZ community? Because he thinks this community brought him revenue the most.

Now he wants to donate 10000$ to a few open source projects. Main donation will be 5000$ and other follows: 2500$, 500$. You can enlist your own project if it meets criteria.

Interesting idea, don't you think?

I think that this will generate even more revenue for him as the word spreads and people go to his site.

That's a cool way of promoting yourself and helping other!

Google Master Plan

Have you seen Master Plan?.

Is it science-fiction or common sense? What do you think about? I think many people ask the same questions. Haven't you thought about it once or twice?

Thursday, July 5, 2007

A little task

First read this - about term Gaygler used by Google employees, then check photos from gay parade.

See what's on vehicle bellow "Google"? Check this out - http://www.google.com/jobs/gayglers/.

Now write in comments what do you think, be honest.