Posts

Showing posts from 2008

AAAA Unit Testing

A while back Oren wrote about the Arrange, Act, Assert syntax for unit tests. I've seen several other discussions on this and I am not sure if he is the originator but I'll attribute him either way. The syntax I most commonly use ressembles an Arrange, Assert, Act and Assert (AAAA) pattern. Arrange the system in it's initial configuration. Create any collaborators and mocks you may need. Initialize services. Assert that the initial state is correct. For me this is important since so many layer of dependencies exist in modern applications. This is analogous to a control group in the scientific method. In this step I would also test the inverse of later assertion such as the non-existence of objects that should only exist after the Act step. Act on the system by creating/deleting/updating new objects or invoking services. Assert again that the system is in it's expected state. I've caught a lot of bugs using this method. Asserting the initial state may also be a good...

Memcached for Monorail Update

Memcached for Monorail is a session replacement for the Castle::Monorail framework. It uses memcached on the back end for distributing the session across a web farm. I have added some additional notes about Memcached for Monorail . I have also uploaded a binary release . Although I recommend getting the source . No time to discuss much more but feel free to ask questions and I'll answer them. The Memcached session provider is currently being used in a production environment with great success but it definitely has room for improvement. It's aimed squarely at extending the Castle::Monorail session so if you are looking for something more generic than please look else where...or consider switching to MVC with Castle::Monorail ;-)

Monorail installed on a 64bit OS

Installing Castle::Monorail on 64bit IIS7 proves to be much easier than I thought. You must use the 64bit handlers. To make this easy you can just add the handlers to your Web.Config: 136 system.webServer > 137 handlers > 138 add name = " IconHandler " path = " *.ico " verb = " * " modules = " StaticFileModule " resourceType = " File " /> 139 add name = " Monorail-64 " 140 path = " * " verb = " * " 141 modules = " IsapiModule " 142 scriptProcessor = " %windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll " 143 resourceType = " Unspecified " /> 144 add name = " Monorail " 145 path = " * " verb = " * " 146 modules = " IsapiModule " 147 scriptProcesso...

Javascript: Equality versus Identity

Javascript has 2 basic forms of comparison operators : === and == . == is the standard equality operator while === is the identity operator. The equality operator will perform casting and usually test both sides as strings. The identity operator compares the value each side the type, but it does not work like instanceof. Recently we did some experiments with the different return values. The Expressions Expression Result "test" == "test" true "test" === "test" true String("test") === "test" true new String("test") == "test" true new String("test") === "test" false new String("test") === new String("test") Before Firefox 3.0.1: true After: false new String("test") === String("test") false Here are some type tests we performed Expression Type typeof("test") "string" typeof(String("test")...

Hire the Right People

I believe my team of engineers has been very successful. This is no accident. I look for, and like to, surround myself with smart people. I'm not being egotistical. I don't consider myself the sharpest tool in the shed, but I do know a sharp tool (smart engineer) when I talk to one. Hiring the right person is harder than it sounds. The top two impediments, in my experience, to hiring the right person have been " Hiring People that are Non-Threatening " and " knowing nothing about the job you are hiring for ." Non-threatening can mean a lot of things. A non-threatening person can be a yes-man. Yes-men will agree with you on everything and never make you uncomfortable by pointing out flaws in your plan. Yes-men are often hired on the basis of philosophy rather than actual skill. Non-threatening people can also be that dull-tool that won't outshine the person who hired them. In both cases the company is stuck paying wages to an under performer. More often, ...

Watin Installed

I've spent the last few days getting our testers up to speed on Watin . Watin is an Automated Web Acceptance Test Tool We are using Watin CTP v2.0 . So far I have learned a few things about Watin that I didn't know when I wrote my original Watin Review. If you are completely unfamiliar with Watin I recommend you read my review first. Our descision to go with Watin was based on 4 factors. (1) Watin handles AJAX applications very well, (2) Watin doesn't inject Javascript into your code, (3) Watin supports Firefox (Not 3.0 as of this writing) and (4) it's open source (we can mod the code). Watin Smarts Watin has a good set of algorithms for handling the WaitForLoad stuff. WaitForLoadTimeout is the amount of time the underlying framework should wait for a page to load even though you have asked the framework to find an element. Example: browser.goto("http://www.google.com"); browser.Button(Find.ByValue("submit")).Click(); In the example above the thread...

SVN LDAP and Active Directory

We just upgraded to the 1.5 series of SVN . Almost all of our "team" tools have some hook into Active Directory (AD) for authentication. For SVN this is done via the AD LDAP interface. It turns out that some of SVN's auth_ldap libraries have changed and now our repository sits dead in the water. For those who don't know, SVN is really just a very elaborate Apache web application. Apache handles the network communications while SVN does the versioning stuff. That being the case the real problem exists with the instance of apache that comes with SVN 1.5.0. I believe the LDAP module libraries shipped with SVN are out of date . I have considered switching to the mod_sspi for authentication. Others have got it to work . Has anyone else had luck with this? The benefit (I suppose) of SSPI would be the seamless inferance of domain credentials. In short, the SVN client should use your windows logon credentials to authenticate against the server. This is how CVSNT works but I...

A Project Dashboard

Lots of talk at work about implementing a project management suite. I'm not a big fan of any of the current offerings. So, I've been working on an Excel spreadsheet to track project velocity and health. What I'm attaching pretty much tells me everything I need to know about a project's health. The spreadsheet has 2 worksheets; Data, Dashboard. The Data workbook holds all the raw data about each iteration. Only Columns A thru F should be filled in. The rest of the columns are calculated using those values. Also, I have hidden all the rows from below the last row to row 1400. I do this so these rows aren't calculated into the charts on the Dashboard worksheet. As I add rows I unhide it. The Dashboard workbook has several charts that I find useful. The release progress chart is a sort of burn down chart. It not only includes burn down but also tracks points completed. I like this chart because it gives me a rough estimate of a project's halfway point. The estim...

Back from Iraq!

Image
As many of you know I have been in Iraq for about the last 12 months. I just returned and I am excited to get back to my family and job! I'm also excited to be blogging again!

Accountability Model or Making Commitments

Image
Below is a post that I have mulled over for a while. I'm not satisfied with it but I would love some feedback. I'd like to address two areas that are often considered taboo in the Agile field; Accountability and commitment. Just like the pig in the " Chicken and Pig Make Breakfast " story, agile teams make commitments. Teams commit to stories and they commit to estimates. As an agile project progresses through the 5 Levels of Planning it also moves through progressively higher levels of accountability; Nice Idea, Best Effort and Commitment. Making Commitments The Accountability Model above is meant to illustrate how each level of planning helps the team zero in on an actual commitment. Since agile teams accept that requirements will change, the most detailed design estimates are held off until just before implementation. So, project stakeholders can expect The Release Plan to be more accurate than The Road Map and the Iteration Plan to be more accurate than the Rele...

Memcached for Monorail Update

Memcached for Monorail (MfM) is my attempt at a simple, memcached / enyim based, session and caching facility for Monorail . MfM offers a lightweight, fast, low friction, facility for balancing Monorail sessionstate and object caches accross multiple servers. You can read my original post . Memcached offers an excellent solution for applications that need to balance object caches across multiple servers. It does so without the overhead of a database or even the use of the hard disk. Although, a major pitfall for memcached is it's unreliable nature. If a server in your memcached cluster fails then you lose all the objects cached on it. Memcached is just not meant for persisting object data permanently. The current release of MfM is capable of persisting sessionstate to a memcached cluster. If one or more memcached servers fails then that part of the session will be lost, permanently. For my projects, I found this unacceptable. I decided to add a DB persistence layer using ActiveRec...

Writing User Stories and Pragmatic XP

Writing User Stories Part 1 Part 2 Part 3 My previous post in this series generated a lot of commentary on the XP list. I honestly appreciate everyone's insight....it can only make me better. My intent (with respect to this series) was to suggest other approaches to writing stories. The series is aimed mostly at helping users. I try to make these approaches simple. Some users will find a "by the numbers" approach easier to wrap their mind around. The 5Ws method may also provoke a deeper analysis of the story as users try to describe each W. I also believe that some developers and testers might appreciate a more predictable user story. In the end though, users can bring us any scribble. Be it on a card, a sticky note or a napkin and we will do our best to make it a reality. The series was never meant to be a holistic commentary on writing stories. As a rule I try to avoid anything holistic. I do, these days, try to be pragmatic and a bit understated. When I f...

Shoot Yourself in the Foot!

Image
!WARNING! If you're not a major nerd or geek you won't get these jokes! Recently a friend of mine sent me some funny additions to the Shoot Yourself in the Foot! list. The list is a humours look a the logic you might need to "shoot yourself in the foot" in different programming languages. Here are his suggestions: Python You try to shoot yourself in the foot, but the gun refuses to go off because it doesn't have appropriate space around it. Perl You quickly create your own gun and shoot yourself in the foot. Witnesses are unable to explain what happened. No one else can figure out how to use the gun. JavaScript Your prototype gun admirably shoots feet during testing, but in production many users' hands are incompatible Flash As you pull the trigger, the gun's barrels surge impressively to life. The muzzles flash, smoke billows, and the ring of pounds of expelled brass is barely audible over the deafening gunfire. A...

Monorail Custom Session Factory for Memcached

Introduction I have written a simple but effective ICustomSessionFactory implementation that uses memcached storage on the back-end. If you don't know why you should be using memcached then you should check it out first. If you want to check out the code now, then go here . So far I think I have a passable Session Factory implementation that uses memcached on the back end. In later posts I will give some code examples and more details about deploying the Factory code. Details Here are a few dependencies you will need to get going: Castle::Monorail A memcached server or servers running on your network. Memcached is a simple and fast distributed object server for balancing object caches across many servers! The latest release of Enyim . These are the guys that did all the real client work! Thanks to them for a great memcached client! If you want to run the tests or plan on making modifications then you will need the Nunit/RhinoMocks stack. Current Features A s...

Writing User Stories the 5 Ws Way

Writing User Stories Part 1 Part 2 Part 3 This is Part 2 of my "Writing User Stories series". Part 1 focused on some common pitfalls while writing a user story. In this article I intend to outline a simple but effective method of writing a user story using the 5 Ws. A User Story is written by any User. The User Story should have a short but descriptive title and a longer narrative. The narrative should include the 5 Ws: Who, What, When, Where and Why. WHO : Usually, the type of user (ie Admin, Student, Teacher) WHAT : What the user in the WHO is going to do (clicks on the "new blog comment" button) WHEN : "When" may describe a time or date or relative time (ie After logging in or after reading a blog) WHERE : Where on the page or in the application. WHY : What was the trigger for the user (user wants to suggest a change to the blog post) Example 1 : A student ( who ) clicks the new blog comment button ( what ) after reading a blo...

8 Things You can do Now to Improve Your Software

These aren't new ideas but they are true. The list below focus' on the things that organizations should be doing to help make their agile teams more productive. LET USERS SUBMIT ISSUES! Let users submit issue tickets. They may be bugs, feature requests...whatever. You need to start tracking it. Your users will sense that you place value on their needs and you will have invaluable data for prioritizing new user stories. GET USERS TALKING ABOUT YOUR SOFTWARE! Create a discussion forum or bullitin board for users to discuss the software they use. Creating a community around your software will help endear your users to it. Your engineers, product managers and other stakeholders should be encouraged to actively participate. Your team will gain great insight into how users are using the software. MAKE A USER AVAILABLE! Developers should have real-live users to contact and ask questions. Most of what slows delivery of new features is a clear understanding of how a user wil...

Programmer at War (in Iraq)

Image
Most of those who read my blog are probably unaware that I am in Iraq. Normally, I am a Software Engineer/Chief Systems Architect for an Oklahoma based company. One weekend a month I am an Officer in the U.S. Army Reserves. Last summer I was deployed to Iraq. I am a Platoon Leader in a Medium Truck Company. It's quite interesting how different my civilian and Army jobs are. In my civilian job we are always going forward with new developments. In my Army job, each mission tends to be organized similarly and entail doing the same task over and over again. Although, sometimes, the enemy has a say in that. In some ways though, my jobs are very similar. There is a great deal to be learned from my experience in the Army. Being an "agilisto", I really value communication and people. In the Army, the most successful leaders learn to communicate very well and place the needs of their soldiers before all else. On an agile project we plan and deliver value incrementally. This allows...

Webtest Tool Round-up (Round 1:WatiN)

This is the first article in a series of reviews. I plan to test a few Open Source automated Web-Testing tools. As I complete my tests I will publish the results to my blog. The Test Procedure The world has gone Ajax and Web 2.0 crazy. Any tool that doesn't handle dynamically changing DOMs is an instant failure. So, I decided to use one of the most Ajax intense applications I know of, Gmail . Gmail uses Ajax and Iframes indiscriminately. The developers at google seem to obfuscate ALL the HTML element IDs which means that my web-tests have to do some real back-flips to find the buttons, hyperlinks and textfields required to send messages. I have no doubt that Gmail will adequately stress the tools in this line-up. Test Steps Log in to Gmail Send an Email Check the same email Apply a Label Archive it Check to see if it is in the label category. Log Out Round 1: WatiN (v1.2.1) homepage | download Test Date 17FEB08 Environment Windows XP Home Visual Studio 2005 .Net 2.0 IE 7 PROS Ea...

Microsoft MVC or Is the Monorail off it's track?

For those of you who didn't know, Microsoft has been working on it's own MVC framework . I haven't used it yet since I am in the middle of testing several Web-testing tools for an upcoming article. That said, I have done a little research on the web and here are a few things that Monorail users may want to know: Hammett , the founder of Castle::Monorail, has helped MS by making suggestions about their implementation. See his comment below: I'm not actively collaborating with MS regarding the MS MVC. I've offered help due to my expertise with complex web sites we have built using MonoRail, I was invited to fly to Redmond and analyze their product, and discuss things, make suggestions. It's been suggested (in comments) that Monorail may become a wrapper for the MS Framework, if the MS MVC framework progresses well. The MS Framework does support intellisense in it's views. Views are written in your .Net language of choice. ASP.Net controls are available for u...

Getting the Data out of my Controller Tests

While working on PlanningPokerOnRails I started writing a unit test for my LoginController. The Monorail BaseControllerTest makes this easy. I am also using Rhino Mocks and Nunit . Here is the test: The test is very simple. First, it sets a single recorded expectation that a Redirect will occur: 34 using (mocks.Record()) 35 { 36 // First redirects to the index page 37 Response.Redirect( "/Home/Index.rails" ); 38 } Next, the playback is run and the code emulates a few things that users might do...like login with Request params for a ReturnUrl: 39 using (mocks.Playback()) 40 { 41 Request.Params.Add( "ReturnUrl" , "/Home/Index.rails" ); 42 loginController.Login( "dan" , "danny" ); 43 } Writing the Code to Pass this Test Next I wrote the CardPlayer component (my user) and the LoginController. Seeking to do the simplest thing that could possibly work I merely had the CardPlayer inherit from the ActiveRecord ...

Is this a SourceForge Killer?

I doubt that the Google Code Projects Hosting will compete with SourceForge anytime soon but it does put Google one step closer to being the next SkyNet . I've been hosting one of my recent open source projects there and been quite pleased. Here are a few features of note: It's FREE ! (So is SourceForge by the way) Provides a Subversion Repository with a really slick online browser. Check it out here . Most of the interface is a just a frontend to a smart wiki . So you can use wiki code just about anywhere. You can add users into different roles. The Issue Tracker is relatively complete and fairly customizable since it's a highly specialized wiki. It allows you to assign tasks and track the workflow in your own way. Plain old Wiki . For all your other needs there is a fairly robust wiki. Package Download system allows you to upload your latest builds, documentation or whatever. 100MB of storage for your source (you can request more). Google account logins are used. A...

New Pattern: CPT (Can't Polish a Turd)

I recently read a hilarious article, " Asshole Driven Development ." The author, Scott Berkun, takes a cynical look at the abundance of acronyms in the software engineering field. Along the way he uncovers a few insights that, while very cynical, ring true. In addition to Scott's funny acronyms many users have added additional goodness. One anonymous post read: How about CPT (Can’t Polish a Turd) development, This is where management cannot understand the need to stop and fix/clean up/refactor or start again. I saw this post and wondered if we hadn't worked together! I've polished many turds in my time, a few were my own, and let me tell you...it's not easy. The fact is, these turds never really shine. Sure, sure...wet em down a bit...put em in the right light and they seem to shine. Heck...we have well paid people (some brilliant) that spend most of their time putting turds, in the right light. But, in the end a turd by any other name is still crap. So why ...

Writing User Stories

Writing user stories should be easy. The reality is that most users don't know how to properly write a user story. Suppose a client asks you to write a wire transfer subroutine for systems at two different banks. (below I will highlight proper Stories in green and improper stories in red) The client says...Write a wire transfer subroutine for systems at two different banks. While a need is expressed, I would submit that this is not a User Story. What's been stated here could be the beginning of a vision statement, perhaps for the next release or the next Iteration. Let's try to distill this a bit. So the client reconsiders and says.....System A should use a web-service exposed by System B to electronically wire funds. A common pitfall in writing User Stories......getting too technical. The statement above assumes that web-services will be used and it may be perfectly logical to assume that they will be used, but let's examine what a User Story is really intended for. Fi...

New Name....Same Crap

I've changed the name of my blog!!!! Not that this makes much difference to my audience. This blog will, from this day forward, be known as "Something Smells". While my critics may consider the cause for this change to be self evident (Garreth, Rob?), I made this change for wholly different, and much shallower, reasons. First of all I no longer fancied the old name (yes, I just used the word fancied). Second, after long deliberation in the shower at the American Airlines Admiral's Club, I decided to really re-enforce the code smell concept. Oh and I changed the masthead....I think the new title goes better with the masthead. Why more on code smell? Well, I won't be writing more about code smell, but I do think that my general technique for coming up with interesting topics (don't say a word) is somewhat similar to how we find code smell. Also, I think the art of hunting for code smell is a bit misunderstood. For better or worse, we all do it (hunt for code sme...