My platform of choice is Ruby on Rails. In an early project, I implemented some reports by coding special purpose sql statements embedded within model methods. This worked well, and allowed the reports to run reasonably speedily. As I continued…
Rails to_xml, thar be dragons.
Ok, so I have been using to_xml to handle generating xml serialised lists for a restful xml interface. I came across this interesting situation. If you are serialising a collection which is implemented as a set of subclasses using STI,…
Doctest, a ‘gateway drug’?
I am quite a proponent of TDD/BDD, my framework of choice being RSPEC within Rails But, I also understand that for people unused to TDD, the upfront investment seems daunting. So, I was very interested to be told about… DOCTEST…
Bug, Buuuug, *BUG*!!!! I KNEW it.
I am a stalwart follower of the PEEPCODE screencasts. I particularly liked the series about RSPEC. But, in reviewing the code for it, and using the code subsequently, I found this little gem. class Hash def except(*keys) self.reject{|k, v| keys.include?(k…
in_batches_of
Rails is nice. Rails is REAL nice, but, you would expect me to say that, I am a rails developer. One thing that rails is not nice about is efficiency. It’s elegant, its compact, but, the simplest things can have…
History Repeats?
Oh, I hope not. I loved Java. Java it its YOUTH, when you could buy two books, the tutorial and the reference, and that was all you needed. Before Swing, before Beans, before it exploded into the publishers wet dream…
Agile ain’t about FAST….
… it’s about GOOD. Using Agile techniques, Rails for instance, or any of the other new frameworks popping up more quickly than mushrooms on a cowturn in a darkened room, and things like TDD, BDD, SPEC driven whatever, is NOT…
A Peepshow anyone?
Nudge Nudge, Wink Wink, Say NO MOWER! or so the old sketch goes. Well, here is a peepshow that even a mother could love. I am, of course, talking about the PEEPCODE screencasts. Wonderful episodes of skirt lifting, revealing the…
Models make decisions, views and controllers ask PERMISSION
Rails uses MVC. Its important to correctly partition what each section does. Views and Controllers should NEVER make decisions. Models should make decisions, and controllers and views should ask models for permission. For instance, if you have a a User…
Users, RSPEC and Behaviour.
The classic way in rails of implementing model behaviour control of controllers and views is to decorate your model classes with methods which expose behavioural information. For instance, for this message, we will consider an application which has users and…