So, I have busy the last couple of weeks hacking away at a pretty large model. It is the primary model used for the entire Time Keeping module in my application, and as such, it needs to contain some significant domain logic.
Initially, in the spirit of having proper testing, I was attempting to use Test::Unit as my testing framework. However, having experienced unit testing in Java, in particular a continuous testing plugin that monitors your project in real-time and indicates failing tests almost immediately, I was compelled to search for the same type of responsive environment while developing in Rails.
The first stop on my journey towards continuous testing took me to the Autotest plugin. This plugin was quite useful in that it monitored your source files, and on each save, it ran the tests (be they functional, unit or otherwise) that may possibly have been affected by your recent changes. And to some extent, this worked... after a few seconds of saving a file, the corresponding tests would run, showing the results in the Test::Unit GUI provided in the RadRails IDE.
Those few seconds of waiting bothered me though. Because of that wait, my development process just felt slower. I felt more anxiety to write a series of tests, rather than one at a time since I could spread that time delay over a larger chunk of development effort. but, it felt 'wrong' to rush ahead too far, since the spirit of unit testing, and specifically Test Driven Development, is to write a test, watch it fail, write just enough to make it pass, and repeat. Writing too many tests at once seemed to go against the spirit.
And so, I began another search... this time to find a way to speed up the time it took for Test::Unit to do its thing. And then I ran across RSpec. In my search, this RSpec project kept coming up...
So, I looked at RSpec... and cringed. I did not want to learn a whole new DSL... a whole new syntax... I just wanted to make my tests run faster. But every search for faster testing seemed to always throw this RSpec system in my face.
Finally, I had enough. I re-directed my research to RSpec, and the accompanying Behaviour Driven Development (aka BDD). I can't say that first (or second or even third) impressions left much of a mark, except for the fact that persons mentioned that the RSpec runner launched faster than Test::Unit.
So, I took the dive, and began using RSpec. And as I got more and more comfortable, I have realised that it has totally changed the way I think about my problems. I am not trying to be dramatic for the sake of drama. But my statement still holds... RSpec changed how I thought about my programming problems.
Typically, when thinking about a problem, I would think about the solution. I would envision how the code for a particular method would work, and then mentally test my proposed solution to see how it stood up. If satisfied, i would begin implementing that solution in code... filling in the blanks that my mind couldn't see. If I weren't satisfied, I would adjust my solution, and 're-test it' again. That was my essential programming technique for small-scale problem-solving.
Analysing my thinking process now though, I realise that now, my first step is to think about the specification of how the method would work. When thinking about the problem, I think of how that method should respond in various solutions. Although I do sometimes think about the actual solution, my focus while thinking is now almost totally on specifying how the solution should work in given scenarios.
The funny thing is that, with proper specifications, the solution, i.e. the internal code of the method, usually becomes obvious.
In other words, the general flow moves away from me trying to come up with tests to verify that some piece of code I am considering towards trying to put into words what that code should do, and then writing the code to comply with those specs.
The funny thing is, the outward difference between BDD and TDD is really non-existent beyond the syntax. However, I realise that BDD, by changing the language that is used, drives you more quickly to the aim of the game.... to develop an executable set of specifications for your code, which also serves as a low-level regression test suite.
PS. I still find that RSpec takes too long to respond to file changes when using the Autotest plugin. However, because of the difference in focus, I tend to write a series of specifications for a small aspect of functionality, and use the resulting error messages to guide me in developing the solution code.
I still would like to find a way to increase the responsiveness of the Autotest... but that's a problem for another day
Sunday, July 22, 2007
Thursday, July 12, 2007
The Inaugural Rails Post
I've started doing some research on Ruby on Rails, and I must say, I'm impressed... so much so, that I decided to create a semi-major application in it to observe what the experience would be like. So, this is going to be my Rails Journal, so to speak.
What is the application I am building? Well, with the aim of not disclosing too much and getting myself in trouble, it's a client-server application that allows employees to interact with the HR department. The original version of the application was actually a web app, built using Coldfusion, and recently, my company was contracted to build a new version of the application using a development tool called Servoy. Unfortunately, the experience wasn't the most pleasant.
My aim is to attempt to rebuild that same application using Rails, as a way of determining whether Rails is suitable as a platform for our company's development projects moving forward. Thinking about it logically, I believe Rails is ready and capable, but I'd have a hard time convincing my boss to give it a try without something concrete to use as proof. And hence, HR on Rails was born (for lack of a better name for my project).
In a way, this project will actually be quite a good test as to the viability of Rails. I was not present for the building of the original system in Coldfusion, nor was I part of the current project when most of the ground-work was being done. By the time I joined the project, most of the infrastructure was already set up so that I don't have any experience in building the majority of the applcation. Thus, in Rails, I will have to come up with a base infrastructure myself. As well, since each member of the development team was solely responsible for a specific module, I don't have any experience in developing the functionality of any particular module beyond my own. So, I'll be getting the full Rails experience by being forced to create most of the application's functionality from scratch. At the same time, my familiarity with my own module will help serve as a launching point for creating functionality, once I get past infrastructure set-up.
So, I intend to write about my journey through Rails, as I bring HR on Rails from concept to reality. Hopefully, it will be a fun ride...
What is the application I am building? Well, with the aim of not disclosing too much and getting myself in trouble, it's a client-server application that allows employees to interact with the HR department. The original version of the application was actually a web app, built using Coldfusion, and recently, my company was contracted to build a new version of the application using a development tool called Servoy. Unfortunately, the experience wasn't the most pleasant.
My aim is to attempt to rebuild that same application using Rails, as a way of determining whether Rails is suitable as a platform for our company's development projects moving forward. Thinking about it logically, I believe Rails is ready and capable, but I'd have a hard time convincing my boss to give it a try without something concrete to use as proof. And hence, HR on Rails was born (for lack of a better name for my project).
In a way, this project will actually be quite a good test as to the viability of Rails. I was not present for the building of the original system in Coldfusion, nor was I part of the current project when most of the ground-work was being done. By the time I joined the project, most of the infrastructure was already set up so that I don't have any experience in building the majority of the applcation. Thus, in Rails, I will have to come up with a base infrastructure myself. As well, since each member of the development team was solely responsible for a specific module, I don't have any experience in developing the functionality of any particular module beyond my own. So, I'll be getting the full Rails experience by being forced to create most of the application's functionality from scratch. At the same time, my familiarity with my own module will help serve as a launching point for creating functionality, once I get past infrastructure set-up.
So, I intend to write about my journey through Rails, as I bring HR on Rails from concept to reality. Hopefully, it will be a fun ride...
Amazed by the new 'Web'
I've become a bit of a Google fan-boy these days...
Just recently, I configured my work email to be accessible via Gmail and having used that web client for a while, along with this 'Blogger' system, I must say... we've come a long way. It is truly amazing how the Web has been transformed.
I mean, a lot of people don't seem to have any appreciation as to just how far we've come with regards to website interactivity in general... this being especially true for those who are relatively new to the online experience.... after all, this is all they know. But, things have truly come a long way.
My boss and I have been having a continuous argument about the future of software development. "The world of desktop applications is dead - everything will soon be on the Web, " he claims. When I first heard him say it, I thought it was a blanket statement that couldn't possibly be true. After all, we all know that the Web, despite the attractiveness of accessibility from any machine, is still a slow and clunky experience in comparison to desktop software. Yes, there is an abundance of uses for web applications, especially in the corporate world, but there are still many things that can't be done effectively on the web. Or so I thought...
I can see his point of view much better now, having spent some time using Gmail and Google Reader.... Gmail, in particular. And I must say... I am impressed. In fact, I dare say that, in comparison to a desktop email client like Thunderbird, I actually prefer the Gmail experience. What I've realised is that this new Web (the Web 2.0, as they call it) is changing the game. It's not so much that Web software moving closer to desktop software in terms of functionality... it's that Web software is actually changing the whole UI metaphor... and it's for the better.
Don't get me wrong... I love desktop software. But I find myself being drawn to Web software more and more. And it's not like my driving reason is because of the mobility - for the last 8 or 9 months, I've been using a single laptop for work and at home almost exclusively. However, the interactivity.... in particular, the difference in interactivity... dare I say, the improvement in interactivity of Web software vs. desktop software is truly drawing me in.
As I said.... we've come a long way....
Just recently, I configured my work email to be accessible via Gmail and having used that web client for a while, along with this 'Blogger' system, I must say... we've come a long way. It is truly amazing how the Web has been transformed.
I mean, a lot of people don't seem to have any appreciation as to just how far we've come with regards to website interactivity in general... this being especially true for those who are relatively new to the online experience.... after all, this is all they know. But, things have truly come a long way.
My boss and I have been having a continuous argument about the future of software development. "The world of desktop applications is dead - everything will soon be on the Web, " he claims. When I first heard him say it, I thought it was a blanket statement that couldn't possibly be true. After all, we all know that the Web, despite the attractiveness of accessibility from any machine, is still a slow and clunky experience in comparison to desktop software. Yes, there is an abundance of uses for web applications, especially in the corporate world, but there are still many things that can't be done effectively on the web. Or so I thought...
I can see his point of view much better now, having spent some time using Gmail and Google Reader.... Gmail, in particular. And I must say... I am impressed. In fact, I dare say that, in comparison to a desktop email client like Thunderbird, I actually prefer the Gmail experience. What I've realised is that this new Web (the Web 2.0, as they call it) is changing the game. It's not so much that Web software moving closer to desktop software in terms of functionality... it's that Web software is actually changing the whole UI metaphor... and it's for the better.
Don't get me wrong... I love desktop software. But I find myself being drawn to Web software more and more. And it's not like my driving reason is because of the mobility - for the last 8 or 9 months, I've been using a single laptop for work and at home almost exclusively. However, the interactivity.... in particular, the difference in interactivity... dare I say, the improvement in interactivity of Web software vs. desktop software is truly drawing me in.
As I said.... we've come a long way....
Popping My Cherry
Well, this is my welcoming call to the world of 'Blogging'. It's quite anti-climatic, if you ask me.
Of course, I am no stranger to the whole 'let's talk about me' phenomenon - I've been keeping a fairly regular journal of my rather mundane life since 2000... it's now a 1100+ page monster that seems to hang Word on a regular basis... so much so that recently, I've have to split it into two out of frustration.
Come to think of it, my history with journals hasn't really been the best... specifically when it comes to letting others read the crazy things that go on in my mind.
(I've allowed two ex-girlfriends to look through it, with the same end result... they getting pissed about something I've written. In fact, that might actually be a major contributing cause to their 'ex' status... it's a funny thing about women... they claim to want honesty, but the reality is that, at least in my experience, they don't respond that well to it. But I digress...)
With that type of history, why in the world would I want to start a blog? When I figure out the answer to that one, I'll get back to you....
Of course, I am no stranger to the whole 'let's talk about me' phenomenon - I've been keeping a fairly regular journal of my rather mundane life since 2000... it's now a 1100+ page monster that seems to hang Word on a regular basis... so much so that recently, I've have to split it into two out of frustration.
Come to think of it, my history with journals hasn't really been the best... specifically when it comes to letting others read the crazy things that go on in my mind.
(I've allowed two ex-girlfriends to look through it, with the same end result... they getting pissed about something I've written. In fact, that might actually be a major contributing cause to their 'ex' status... it's a funny thing about women... they claim to want honesty, but the reality is that, at least in my experience, they don't respond that well to it. But I digress...)
With that type of history, why in the world would I want to start a blog? When I figure out the answer to that one, I'll get back to you....
Subscribe to:
Posts (Atom)