Redditech Blog 2.0

Thanks to all those who have and who continue to read and leave comments that help me make the content of this blog more professional and useful.

This blog has now moved to Blogger as a hosted site.
Blogger is the Google Apps alternative to Wordpress.

This was done as I wished to focus more on building my skills as a writer and actually producing higher quality content, and less on the administrative tasks of running blogging software myself.

Please check out The Redditech Blog 2.0 to see updated content from Redditech.

Notes on Unit Testing

Walking a coworker through the concept of test driven development and unit testing I designed some notes on it. So I thought I’d copy them online for future reference.

TDD steps:
A. Choose a test or suite of tests. Design it/them.
Design mode involves asking the following questions:

1. What do I assume exists? (the Setup phase)
2. What do I test for? (the Assertion(s) phase)
3. What do I reset after? (the Teardown phase)

Designing tests well will save you much headache later down the road. Take my word for it. If not, go through the rest of the steps, hit the headaches and pitfalls then read back the “I told you so” statement I have waiting here for you :)

B. Write the code for the unit test(s) according to the above plan.

The Setup and Teardown phases may be best written first because you are changing then restoring the state of the software system within the setup and teardown phases. This will happen when you need test data present that should not be persisted beyond the scope of the test. You would always want to leave the system clean, i.e. in the exact state it was in before you ran the test.
This is done by ensuring the Teardown phase removes any system changes made in the Setup phase and both are ideal to be written together before the core unit tests in the suite are written.
O, and make sure once you write your Setup, Teardown and test methods that the project actually does compile.
This would almost certainly require you to create “stubs” (i.e. empty or unimplemented) classes for those new objects you intend to be testing in addition to referencing already tested classes and their methods.
Don’t worry that you’re referencing unimplemented classes in your tests just yet, that’s why you’re writing the tests, so that when you get to writing them you know exactly your progress in coding them.

C. Run NUnit (or test suite of choice) and ensure all tests fail.

At this point you may choose to call a coding checkpoint with your team lead/peers to ensure that you have truly written a useful and complete suite of tests, and to fill the gap in ensuring there are no critical tests you may have overlooked that should have been designed and coded in this cycle.

D. Write the code that enables the tests to pass.
This is the meat of things. You know what you’re testing for, so you now implement the logic to make this happen. All those nicely stubbed objects now get substance in your quest to empower them with the logic needed to pass the tests.
Once all your red lights (fails) turn green (pass), you’ve just made a significant step towards completing this development cycle.

E. Refactor your code to make it more efficient.
This is important. Getting all tests to pass is good, but we don’t always do things the right way the first time. Look back at the code that passes each of the test.
Could it be optimised in some way?
Did you take any shortcuts in a moment of weakness/time crunch to make the test pass that you need to correct now to make the code more robust?
Will this code be chewed up by your peers for its lack of pattern usage, adherence to coding standards, complete documentation etc at a code review or revered as a masterpiece in coding and a job well done?

F. Code Review.
This is the often missed/sacrificed step, but it is as important as all others. You’ve gone through the previous steps and done the best job (hopefully) you could getting your code optimised.
You are now ready to have it validated by your peers. Don’t avoid it because you fear getting criticisms, this is good, since it shows you where you have to grow in building better code later down the line for other tests.
And it will obviously lead to better code delivered to the client.
Of course if you’re the one asked to participate in the review, remember the five C’s when giving feedback in these reviews that will make it a good one, i.e. be Caring, Consistent, Clear, Current and Concise with your feedback.

G. Integrate review feedback and be done.
Once you have aggregated your peer feedback, ensure that you have integrated it into your current code set.
Once you have done a proper job checkpointing with your lead during the development process your peer feedback should only be minor tweaks in code. It should not lead to a major rewrite of code, and any time it leads to this you either are not comprehending the feedback given or really did do a half-assed job in the first place moving through the previous steps.
Checkpoint with your lead if you are unsure how integration should occur, or if you find it is taking more time than a minor rewrite should to ensure you are understanding the feedback given properly.

H. Call it done. Move on.
There you go. Once these steps are complete, you’re done, you can move on to developing a new set of tests for another feature set and repeat the cycle.

What’s going on with Wordpress 2.2?

So I think I may have found a bug in Wordpress 2.2, which powers my blog. For some reason while posting and updating an article entitled “Maximising Google Reader” my homepage will display the article twice. A look at the database level though indicates only one posting stored for the article. I’m hoping this is a one time event, and that future posted articles do not have a similar rendering on the main page.
Now I need to play around to see if I can duplicate the bug and submit it to the good folks at Wordpress for a patch/workaround.
Ah, the joys of being the early adopter :) —Update—So as soon as I posted the article, the duplication disappeared. Then I edited the “Maximising Google Reader” article to add a mood (provided by the plugin Moody). After this, the duplication came back. I added a “mood” to this article as well, to see if this is the cause of the error.
This apparently wasn’t the problem either, as the duplication disappeared (again!). And now it’s appearing with this article!! This is really quirky. I can’t be sure when I post whether this article is going to be published one or several times anymore…arggh!

Maximising Google Reader

One of the major problems I have using the Internet these days is the managing the sheer volume of content I am exposed to and absorbing it intelligently enough to use it. Along came RSS, Really Simple Syndication and with it RSS Aggregators, programs that would automatically organise your RSS feeds in an easily browsable format.
I never really took to any aggregator software, other than ITunes, and that was limited to aggregating my regularly listened to podcast content. Then about 2-3 weeks ago I started using Google Reader. I must say, this application is quite well done, and follows my experience using other Google Applications in providing a rich user experience inside a very usable interface. Its features continue to show the great potential available inside a well designed web application.
The “wow” feature for me with this application was the provision of JavaScript which, when embedded inside my blog’s sidebar widget, allows me to produce a list of links to the articles I have marked as “shared” inside Google Reader under my blog’s aptly titled “What I’m reading” header.

This has now freed me from needing time to write what I consider honestly the most boring of blog posts, a linking post, in order to share what I honestly consider useful web content for both personal and professional growth.
My focus can now be set on writing more introspective articles with what I hope to be better original content. I hope to focus these articles on how I’ve applied the lessons taught to me by my mentors at Medullan and those that I’ve also taught myself. Real world experiences working on successful project delivery and what I’ve learnt in my own personal and professional experiences as I continue to grow in the leadership roles there will definitely be my mantra when writing these articles.
I’d also hope to write some more articles focusing on books I’ve been reading and the content of these and my own personal lessons learnt from these. Thanks to Google Reader, I think I can now utilise the limited time I have for blogging on writing these types of articles now.

DZone – the Digg for developers

I stumbled upon DZone quite by accident but already I like its concept. Hardcore, tech knowledge for active programmers, peer reviewed and approved in the same spirit of Digg articles.
There’s an RSS feed as well so you can manage the information flow with your favourite aggregator.

Wordpress 2.2 screwed up my CSS


Forgive the look of the site for the time.
I did 2 upgrades, first to mySQL 5.0 from mySQL 4.0, then from Wordpress 2.1.x (can’t remember what version i was on) to Wordpress 2.2.


Main issues:


1. My Sidebar widget doesn’t load. Apparently this is a “feature” of Wordpress 2.2, but I haven’t figured out where it’s activated yet.


2. My CSS is screwed up. So my navigation right menu is now somewhere at the bottom of all my posts…it’s kind of late, so hopefully I can figure out the issue tomorrow.


I’ll probably revert to 2.1.x if I can’t figure out the issue by Monday and wait for a successful Google Groups search to reveal the answer to my dilemma before attempting another upgrade.

Update: Thanks to a last minute change of theme to “Water 1.1” all the CSS issues seem to have been fixed. The Sidebar widget will be missed, but I figure it’ll take me all of a minute to adjust to the Wordpress integrated Sidebar. Yay! Upgrade successful!

Notes on SCRUM

I was watching a video on YouTube on SCRUM, and made a few notes. Thought I’d post them here for reflection/discussion

SCRUM

-Made for small teams

-Helps develop consensus

-Allows a flexible schedule and flexible deliveries

-Frequent reviews

-Easy

Book recommended:(Agile Project Management Using SCRUM)

(more…)

Software Development – Part I – The Ground Rules

I am currently reading “The World Is Flat” v2.0 by Thomas L. Friedman and there was this short but powerful statement in it that totally summed up software development in today’s world in a way I knew but never quite quantified before.

“Every new product – from software to widgets – goes through a cycle that begins with basic research, then applied research, then incubation, then development, then testing, then manufacturing, then deployment, then support, then continuation engineering in order to add improvements.”

Further articles in this topic will explore each of these aspects in a small, but hopefully quite usable, post that will help guide future software developers (such as myself) into a successful path for product implementation.

The difference between Response.Redirect() and Server.Transfer() in ASP.Net

A healthy discussion was started today during a coding run about the difference between Server.Transfer() and Response.Redirect() as a best practice. Our search led to this page, which indicated that each indeed has its purposeful use.

Difference between int.Parse(), Convert.ToInt32() and TryParse() in C#

Working on a Medullan project I saw int.Parse() being used interchangeably for
Convert.ToInt32() so I wondered what was the difference.

This link has the answer.


After writing this at 2am during a coding run, my CEO (who’s also a seasoned coder in his own right) recommended the TryParse() method for consideration. The TryParse() functionality has been extended to all common .NET data types as of ASP.NET 2.0, something that indicates it’s been performance tuned to be more extensible and perform better than similar existing functions.


So now I had a three way comparison, and not being one to reinvent the wheel and do load testing comparisons myself to figure which was most efficient, I ended up finding this article which showed why this is in fact, the new best practice for common data type conversions.