Archive for April, 2008

Quick Ruby Thoughts

Tuesday, April 29th, 2008

I have to say I’m liking a lot about Rails. Ruby, not so much. Probably the most annoying thing about Ruby is the syntax. It is MUCH too complicated and after working with it for awhile, I still don’t quite understand all the rules. Things that puzzle me:

dot notation vs non-dot notation. When to use which?

collection.select {| x | x > 5 }

vs

collection select {|x | x > 5}

they both seem to work. Also, use of parens around argument lists – also seems to be optional. Two different block definition syntaxes is also annoying.

Less syntax would be most welcome.

Hoppin’ on the Rails

Friday, April 4th, 2008

I’ve got two new clients – on is taking over expansion of an existing Ruby on Rails application. The other is the replacement of the application I wrote in the previous article. I want to stick a new codebase on the existing database. Since rails excels at CRUD and I’m short on bandwidth and hand-off-ability is a concern with the new development, I’m going to use rails for that one too.

I mean, I can only learn so many frameworks at once. So here we go – working through Agile Web Development with Ruby on Rails.

Software Design Tip: Minimize Number of Languages

Tuesday, April 1st, 2008

I was recently asked about taking over support for an existing application. I’ll leave out what it does – suffice it to say it is web based, has a simple 3-5 page UI for the public to buy something, and about a 15-20 page set of back end interfaces for trained customer service and admin people to use. So less than 30 screens overall mKay?

The application was said to be written in Java. I know Java – I don’t like it, but I know it. If its small, I could be persuaded to pick up the maintenance.

However, I got a source drop and I was totally appalled. First, it suffers from the usual Java framework-itus.

Its J2EE – so we got Jetty container. They used Hibernate – so we have generated Java code based on some XML schema files. There’s also a mysql database – which duplicates the information in the Hibernate XML schema files. It uses cocoon – cocoon make use of xml and xsl to define navigation and transformations. There is also reporting that uses xsl. Workflows use flow – more xml only they used the Javascript extension so the workflows are actually defined using server side javascript.

Got all that? We have Spring, Coccon, Flow for Javascript (flowscript), Hibernate, Jetty, Javascript, Html, CSS, SQL, XSL and god knows how many dozens of distinct flavors of XML. For a 25 page web app. Wait, did you notice I didn’t mention Java? There is Java – the Hibernate generated classes are used – but indirectly – they may as well not exist at all since all the application code is some fractured XML or Javascript fragment stashed who knows where.

It seems we’ve lost track of something here. “Locality of Reference” In general, all the stuff that deals with the product selection page ought to be visible by looking into the file representing that page, then maybe drilling into components. The problem here is that, everytime I have to drill down, I have to switch languages. And context switches are bad for programmer productivity – mKay?

I’ve turned down the job. I don’t have time to learn all that junk for this little app. The client needs a new installation – for 25 pages that do mostly CRUD to mysql. If I do it, I’m thinking plain old PHP with an ORM. If I can find an ORM for PHP.

So far I’ve looked at Doctrine (not yet ready for production but it looks cool), Propel – and some others. The really off-putting bit is their slavish insistence on creating the xml mapping file – just like Hibernate. Of course, I have an existing database. The XML file they want is in the db. It just isn’t XML. Still, all the information is available for query – so why are they bothering me with this junk? Read the damn schema and make me some classes. I’ll eliminate the many to many mappings by hand. Sheesh. No wonder there’s a software crisis.

Hey framework people, stop making me write monkey code – figure out how to eliminate extra work – not make it. One meta model is enough.