Alex Pooley's Blog

Hello there, my name is Alex Pooley and I'm a freelance web developer residing in Perth, Western Australia. My passion is in the development of web sites that solve everyday problems. Here's a gallery of some of my notable work. If you need a web site designer or developer, contact me with further details. Lastly, you can read more about me.

Ruby On Rails: Testing

December 27th, 2005

Why don't you subscribe to my blog while you're here? I'm a freelance web developer and I blog about Ruby, Rails, and business online.

Go ahead and subscribe to my RSS feed. Thanks for visiting!

Started
...............
Finished in 1.733 seconds.

15 tests, 136 assertions, 0 failures, 0 errors

“Ruby On Rails”:http://rubyonrails.com is a fantastic piece of work. The great thing about RoR is that it has made a heap of decisions for you, so all you have to do is fill in your business logic. What I have only recently realised since getting a bit more serious about my development is that RoR has testing baked right in to the system. RoR provides scripts that you run to create a basic framework for each logical unit of code (E.g. People, Cars, Employees). Not only does RoR create the framework for your business logic but it also creates complementary tests, and even mock data! This saves a heap of time. Beyond this, the mock data (fixtures) can be dynamic so you can store encrypted passwords as code so you always know what the mock password is. RoR’s integration of tests goes further than what I have described. I wonder if I can describe the functional spec of my project through tests and docs then palm off the grunt work to someone else? Hrmm….

Something I suspect many RoR users don’t realise is that they can run:

rake --tasks
<p>to see a bunch of powerful RoR "bonus" features such as:</p> <ul> <li>Cloning the test schema automatically from the development schema.</li> <li>Dumping the schema to either a RoR based schema language for DB independence or alternatively SQL if you don"t mind incompatible SQL hell.</li> <li>Running functional or other tests. Even running only recently changed stuff.</li> <li>Auto doc generation.</li> <li>Database upgrade/downgrade. You write patches using RoR"s helpers so no more cryptic SQL upgrade scripts. You end up with something like:</li> <pre> class AddUserEmail < ActiveRecord::Migration #Auto run when upgrading db. def self.up add_column :users, :email, :string end #Auto run when downgrading db. def self.down remove_column :users, :email end end

Now, even the least database fluent developer can understand that.

  • You can even freeze/unfreeze the current version of rails your working with. This is particularly helpful for those on shared hosting who have no control over the version of RoR installed.
  • Many Java nerds will automatically point to Ant when reading this stuff. But I get all of the above stuff for free! There’s no need to stuff around with XML configuration or customisation. I’m not hugely familiar with the Java world but I’m sure there are tools to do all this stuff. Even so, wouldn’t you rather these solutions just “be there” and ready to go? Also, I’m not tied to some flashy bloated IDE which is good because sometimes I code on an old P3 server through vi, screen, and a remote SSH session - the way God intended us to code.

    Anyway, it’s bloody brilliant. Get your head out of the sand and check it out.

    Christmas: The Untold Story

    December 25th, 2005

    Christmas is a nice time of the year. It’s a time where I’m forced to stop being busy and try to enjoy myself. Anyway, one down side for this time of the year is the amount of Christmas stuff on TV - it’s horrible! Luckily Allison, my fiance, bought me a “book”:http://www.georgerrmartin.com/gallery/crows02.html for Christmas (the next book in an excellent series) so I won’t need to subject myself to yet another B grade Christmas show. Despite all the snoring stuff on TV, I did come across one documentary about the birth of Jesus but this was not your average run of the mill Christian documentary!

    The documentary looked at the birth of Jesus through the eyes of science. One part of the documentary that especially caught my interest was events that apparently occurred around 7 BC. You’ve at least heard of the three wise men that travelled to see Jesus by following the Star of Bethlehem? Keep in mind that astrology, as opposed to astronomy (they were the same thing at this point in time anyway), was significant during this period.

    # 7 BC - Jupiter and Saturn move very close to one another three times that year, creating a bright star like appearance. Also, astrologically Jupiter is “The Messiah” and Saturn is “Planet Protector of the Jews”. It’s proposed that this event served as a sign.
    # 6 BC - A conjunction of Jupiter, Saturn, and Mars occurs.
    # 5 BC, April - Comet.

    It was suggested in the doco that 1 and 2 were signs that would suggest to astrologers that “something big was coming”. While the comet in 5 BC would create a long structure pointing from the heavens. The comet has been proposed as the Star of Bethlehem. On top of this, the doco said the comet would have appeared to come from the East which was a sign of an immediate event to astrologers, as opposed to a Western comet which would have been a delayed event.

    Both conjunctions occurred within the constellation of Pisces, this has implications that have been “outlined here.”:http://astrology.about.com/od/celebrityfamous/a/jesusbirth_2.htm

    Anyway, several people in the doco suggested that the three wise men part of the story never actually happened - they said it was a little too neat. On the counter, there is some link between Magi
    visiting King Harod and asking to see the newly born King of the Jews”.

    Here’s some links you can follow up with:

    * “http://newsinfo.iu.edu/news/page/normal/1203.html”:http://newsinfo.iu.edu/news/page/normal/1203.html
    * “http://astrology.about.com/od/celebrityfamous/a/jesusbirth_2.htm”:http://astrology.about.com/od/celebrityfamous/a/jesusbirth_2.htm
    * “http://www.tccsa.tc/articles/star_dates.html”:http://www.tccsa.tc/articles/star_dates.html
    * “http://www.firstscience.com/SITE/ARTICLES/christmasstar.asp”:http://www.firstscience.com/SITE/ARTICLES/christmasstar.asp

    Well, I’m off to be merry! I hope you have a great holiday season.

    Social Software Failure Factors

    December 24th, 2005

    These days there is a large emphasis on social software. Their appeal is partly due to their viral nature, mass potential, and hype. I happened to stumble upon “a page”:http://arnoldkling.com/econ/succfail.html that discussed social systems in terms of real world societies. Here’s a list of seven failure factors listed on the page that indirectly hint at things to avoid on your own social software ventures.

    * Restrictions on the free flow of information.
    * The subjugation of women.
    * Inability to accept responsibility for individual or collective failure.
    * The extended family or clan as the basic unit of social organization.
    * Domination by a restrictive religion.
    * A low valuation of education.
    * Low prestige assigned to work.

    buy mp3 music uk vpn