... digin's blog ...

... digin's blog ...

thoughts on matters technical
AJAX support now in ASP.Net MVC CTP 4
ASP.Net MVC CTP 4 was released in July on Codeplex (it still is not on the MS ASP.Net website yet), and I finally have some time to play with it this weekend.   

Earlier this year, I was lead architect on Answerit, a social search application we helped build for 24.com.  We have been toying around for a while trying to find and/or create a good MVC model in developing applications.  We used the Web Client Code Factory (WCCF) for a previous project, but a broad agreement among our architects and developers at ConseQuent was that it created way too much “plumbing” coding for very little gain in sound architecture.  For Answerit, we adopted a simplified version of the WCCF patterns, something that looked a lot like the MVC Framework that has been released now. 

Since its release earlier this year, I’ve been playing around with the various ASP MVC CTP releases, waiting for it to mature to a point where it could handle most of the things you need to do in a large Web 2.0. project like the ones we typically do.  I finally think that ASP.Net MVC has enough features in to consider doing a serious enterprise project on it (AJAX support, Master page support, output caching and something akin to user controls), and it could be time to ditch our home-grown MVC architecture. 

A major reason for going for ASP.Net MVC is that it solves one of the bugbears I’ve had for a long time with ASP.Net.  In ASP.Net, each page can only have one FORM tag that is automatically inserted in the page.   Many of our clients at ConseQuent are large high volume web-sites, and having a web architecture where the entire page’s contents get posted back was always an uncomfortable  part of the .Net web architecture.  In my opinion, it was one trade-off in Microsoft’s quest to make web development as easy as WinForm development that I think should not have been made. ASP.Net MVC now makes it easy to have multiple FORM tags in a page, and for each FORM you can have a different controller action handling the callback.  ASP.Net MVC CTP 4 gives two new features that make working with multiple FORM tags a whole lot easier: 

 AJAX.Form:  AJAX.Form is a new helper method that allows you to turn a FORM tag into an AJAX “update panel”, with the submit buttons and action links now doing an AJAX callback instead of a postback.  Unlike the bloated MS AJAX Update panel, which pushes the entire page’s contents back to the server, followed by calling the PageLoad event, the AJAX.Form is a lot lighter.  Only data within your FORM tags get moved up the server, and only the server method you specify gets called.  For more info, read Hanselman’s blog at http://www.hanselman.com/blog/ASPNETMVCPreview4UsingAjaxAndAjaxForm.aspx 

 RenderAction:  Now that multiple FORM tags are allowed, it makes sense that you want to break have reusable components, much like user controls in classic ASP.Net.  One of the ways ASP.Net MVC allows this is with the RenderAction method, which allows you to create actions that render subviews.  When we built Answerit and a couple of other sites on our home-grown MVC pattern, we had numerous debates on user controls as to whether they should have their own controllers, or be “dumb” and live off the controller of their parent.  With RenderAction, you can now support both approaches reasonably elegantly, though there is still a lot of debate whether RenderAction is true MVC or not.  For more information on RenderAction, see http://blog.wekeroad.com/blog/asp-net-mvc-preview-4-componentcontroller-is-now-renderaction/  

Both these new features still have some work to do (see the ASP.Net MVC Roadmap), but I am really looking forward to seeing them being rounded off and seeing ASP MVC being released.  In the meanwhile, two shameless plugs: 

Shameless Plug 1:  Have you tried Answerit yet?  If not, try it out by letting people know: Are you thinking about using ASP.Net MVC on your next project? 

Shameless Plug 2:  Are you a .Net developer who loves good patterns and practices (like MVC), and want to work for a company that values these as well?  ConseQuent is hiring!

 

Microsoft + OpenSource = The nOpenSource Project

 A couple of developers at ConseQuent have spent the last eighteen months using a range on Open Source software in the .Net space.  Yes, that's right: Microsoft and Open Source can play together nicely, and we thought we'd share a bit of our story here on my blog... 

Our story started with SubVersion - the leading open-source source control system.  We selected it mainly because, as an offshore development house, we needed a way to check out code via the internet, and Visual Source Safe was lousy at this!  Since most of our projects talk to a database, we needed a good robust Object Relational Mapper, and we looked at nHibernate and OPF.NET, and settled on nHibernate for now (though this is an ongoing debate!).

Building an effective test strategy is at the heart of any good development effort, and we have used nUnit for unit testing, Fitnesse for building good acceptance tests, and we are currently exploring WatiN for automating front-end web testing.

While the company ethos tends to be against building projects using large code frameworks, we have explored both Spring.NET (the port of Spring to .Net) and Castle.NET (The port of Ruby on Rails to .Net).  Two tools we have found useful are Log4Net for logging, and Sharp Zip for working with Zip files.  

Given this history, we decided to coin a new term for .Net Open Source code: nOpenSource (in keeping with the name of a lot of the projects like nUnit and nHibernate).  From reading the dotnet.org blog, it looks like there are a lot of nOpenSource developers out there.  What we are planning is creating a community of people interested in nOpenSource technologies through a community website and community events.  If you would like to be part of this project, drop me a mail and I'll include you in the nOpenSource mailing list letting you know when we plan to launch.

In the meantime, if you are interested in any of the technologies, and don't have the patience or bandwidth to download them, we've put together our first nOpenSource CD which has all the downloads for the technologies above plus some others I haven't mentioned.  You can pick it up at our offices in the Cape Town CBD, or if you are going to DevDays Cape Town, drop me a mail and we'll try and hook up with you there. 

How to make your Project Manager happy?

I'm acting as Technical Project Manager on two of our company's projects - both offshore projects - and I am beginning to agree with Martin Fowler that the key to offshore development is 3 things: Communication, communication and communication!

However, I realised that even if you agree that your communication needs improving, it's a hard step to get improvements.  One of the ways I'm trying to get improvements in my team is to implement some of Scott Berkun's strategies in The Art of Project Management.  One of the one's I found particularly useful is the following exercise that I've adapted from Scott Berkun called The Communication Ladder.

In our company, a large portion of our communication to our offshore partners and their clients is via email. Even if we do have a video conference, Skype, telephone call or MSN chat, we will typically follow this up with an email.  As a result, the Sent folder of my mailbox is a fairly accurate record of the communication I have been having.

So here's how the Communication Ladder works:

At the end of each day, you run through all the mails in your Sent email box, and rate them from 1 to 5 according to the following scale:

1 - Transmitted:  I'm sure that the message was transmitted.  As long as you have faith in your email system, pretty much all your mails should get at least this score.

2 - Received:  If you are sure that your message was actually received, give it a 2.  Typically, if you are using Read Receipts on your important messages, or following them up with MSN chat, you can get a 2 fairly easily.

3 - Understood:  Here's where it starts getting a bit subjective - give your message a 3 if you know it was understood.  If you keep getting replies for clarification, that's a clue that understanding is not happening.

4 - Agreement:  Even if your message is understood, there's no guarantee that the reader actually agrees with you.  So look for evidence that the reader agrees with you.  Silence is usually not agreement.

5 - Useful Action:  Even if you reach agreement, that is still not enough for most business communication.  Pretty much the point of most communication is to get some kind of useful action to result. It doesn't really matter how much a group of developers agree that a particular website's use of Viewstate is a bit heavy, and that is the cause of performance problems, the only way those performance problems are going to go away is if someone does something about it (and might need some other useful actions to happen first like budget approval, creating the time to do it, etc).

Once you've rated your mails, any mail that does not score a 5 should become an action item for your next day.  And if a particular issue sits on a score for any length of time, it's probably best to ratchet up the communication a notch on them. There are really two ways to do that:

1. Change the medium to a more interactive one:  If you only communicate via email, switch to phone or MSN.  If you still getting stuck on MSN or phone, meet in person.

2. Manage it up:  If attempts at changing the medium fail, the next step is to manage it up.  If you are a developer, start involving a senior developer or your project manager.  If the issue is a problem on the receiver side, try and get some more people on that side informed.

All of this probably sounds obvious (and in fact most of project management is), but I find that making something like the Communication Ladder a daily discipline actually helps improve things a lot.  Too often, they way we approach communication in software development is too ad hoc, and having a regular thing to do to improve matters is a great way to start.

For fun, I've actually published my sent item box for Friday (click the pic for an enlargement) and in red scored the items with a brief note on why the items are what they are (I had to protect the names and project names of course!).  I don't actually make notes like this to such detail (and definitely not in Paint!), but usually just make an action list.  For example, Monday's action list will look something like:

  1. Phone client tech support to get another time to sort out connectivity to their CMS database.
  2. Check how the process for the VISA for the two developers going to Tilburg is going.
  3. Have a meeting on the next steps for the SFTP roll-out.
  4. Get someone to install FXCop on a particular project.   

 My Sent box last friday

 

Will I be singing to a different iTune?

Microsoft has released more details on Zune - the challenger to the iPod.  I'm an avid Microsoft fan, but I also own an iPod Video (and have LOADS of accessories), so I'm keen to see if the Zune has enough in it to make me switch.  The first thing I was disappointed in was the fact that news on the Zune came to me second-hand from press sites, despite the fact I signed up on Microsoft's corny Coming Zune site.  Hey, if Microsoft can't even send me SPAM that I want (if there is such a thing!), there's something wrong with their marketing (then again the ad for Zune did feature two gay men stroking a big white rabbit. 'nuff said!).

From reading the sites, I must say I'm not that impressed for the following reasons:

  • Black, White and Brown as colours?  -  Hey, if they were going to improve on the iPOD with three colour choices instead of two, did the other colour have to be brown?
  • Digital Rights Management:  The Zune supports wireless, and allows you to share your music wireless with another Zune.  However, there's a catch.  If you send a song to your buddy's Zune, the song self-distructs after 3 plays.  There's nothing like having songs disappear from your MP3 player by design to make a user mad in my opinion.
  • Only 30 Gigs: One of the things I regret when I bought my iPOD was that a cheaped out and only bought the 30GB version.  It's amazing when you've got an iPOD filled with about 200 episodes of Rocketboom, just about every photo I've taken on my digital camera, and boatloads of music and what not how quickly you can fill 30GB.  If there was one thing that might convince me to upgrade, it'll be 60GB. 

So it looks like Steve can still keep his Job for now, I'm sticking with my iPod.

Coming Zune

Posted: Sep 17 2006, 06:41 PM by digin | with 1 comment(s)
Filed under:
MSBuild for .Net 1.1

The last six months have been a major learning curve for me being at the start of a new company.  Since I've been in company start-up phase a couple of times before, I've learnt two important things:

  1. Priorities make things happen: Developers generally are idealists.  They usually have many great ideas and a belief that the software they build can only be truly great if only they had the time to implement all of them.  It's no coincidence that the words of idea and ideal are from the same root.  However, I think that in the early stages of a company, especially one that is growing rapidly (we hired 15 people in just 6 months, and we are still looking for more!), the most important task of management is prioritising the most important ideas, and getting the team focused on those.  Without a good set of priorities, I think very little of lasting value happens in the business, or worse still, you get left with a slew of internal projects and ideas that only reached 80% implementation.
  2. Get a small set of key processes right upfront:  If you want to get a good software team, it helps to get a small set of key processes right upfront.  My "small set" is Joel Spolsky's Twelve Steps to Better Code - which has become a mantra for developers starting work at our company.

Step 2 of the Joel Spolsky test is to answer the question: "Can you make a build in one step?".  Now since I issued this challenge to our development team, the immediate comeback was something like this:

In our company some of our developers are privileged:  They are currently working on .Net 2.0. code exclusively, so can use MS Build to achieve their aim.  

However some of our developers are from a historically disadvantaged background, having to code on our .Net 1.1. legacy projects where MS Build does not work natively. 

However, Microsoft has a solution to this: A tool that will help historically disadvantaged .Net 1.1. developers reach the same levels of productivity of priviledged .Net 2.0 programmers.  Curiously, its called MS BEE - I'm not making this up!  It's part of the Power Toys for Visual Studio release, and worth a download.

Underscores in Server Names and Cookies in Internet Explorer.

Management guru Peter Senge once observed that "today's problems come from yesterday's solutions." 

An all to clear reminder of this happened when we started testing a .Net 2.0. Web application on our new build server.  Typically we just use the IP address, but when we tried accessing the application using http://SERVER_NAME we noticed that for some strange reason the application lost session under Internet Explorer only (Firefox was working fine!).  Several very frustrating developer hours were spent trying to fix this problem - until someone finally found the solution:

It turns out that due to a security issue in Internet Explorer, Microsoft decided that only websites having a domain name that contains only alphanumeric characters, hyphens and periods (i.e. full stops!) have support for cookies, and hence support for sessions.   So if you called your server something like SER_EXCHANGE, you have a problem.

Which leads me back to the Senge quote:  When we started ConseQuent, one of my jobs was to come up with a decent naming convention for our servers, laptops and desktops.  I decided that to have a prefix followed by an underscore and then the name of the machine, e.g. SER_EXCHANGE for our Exchange server, LAP_DIGIN for my laptop, etc would be the way to go.  (Our actual naming conventions are slightly different, and we have funkier names for our servers, but being an open blog I'll keep that private for now).  My reasoning was that it would be easy to sort through the active directory, and see all the servers, laptops and desktops all neatly grouped together.  In my last company I was always looking for servers among the names of the developers computers, wasting a lot of time, so this was my solution!    

And there you have it - another classic Peter Senge moment:  A single character which yesterday I thought was a good solution to a common problem become today's nightmare.  

 

Any takers for a free .Net 3 / WinFX DVD?

The Tech Preview of .Net 3.0. (formerly WinFX) has recently been released, and its a BIG download (1GB)!   For thos of you who are bandwidth challenged, SADeveloper / SArchitect is providing a community DVD with .Net 3.0. and a lot of other cool betas / videos and stuff (see http://www.sadeveloper.net/News_Viewer.aspx?NewsID=501 for the full contents).

If you are in Cape Town, drop me a mail, and I'll send you directions to our office (it's in the Cape Town CBD) where you can pick it up.  If you are in Joburg or Durban, some DVD's will be available at the next community events.  If you don't live in the big three, and want a copy, let us know and we will make a plan.

June 16 - Of Bullets and Code...
Yesterday was June 16, Youth Day in South Africa. It marks the 30 year anniversary of the Soweto Uprising, where 172 black youths were killed by apartheid security forces, many of them shot in the back while fleeing. This event gave us the iconic picture of the anti-apartheid struggle - that of the body of the young Hector Pietersen being carried away by a stranger while his sister looked on. Thousands of South Africans pay their respects by retracing Hector's fateful steps on that march each year.

In the strange irony that is South Africa, another incident of apartheid police brutality perhaps is one of the reasons why I became a computer geek. On the 15th October 1985, another infamous shooting happened in the suburb of Athlone where I lived - an event known as the Trojan Horse incident. On that day, security police, disguised as transport workers, shot and killed 3 people, two of them schoolboys. One of them, Shaun Magmoed, was the same age as me, and I remember attending his funeral thinking how easy it could have been me.

After this event, my parents made a decision to withdraw from the schooling system given the dangers, and I spent the next couple of months essentially being home-schooled. My father saved up some money and bought my first computer, a ZX81 (with 4KB of memory!). So, with four months of no school, I spent many of my hours coding on that trusted machine. I remember the heat sink of the computer being perilously placed under the keyboard, and when you coded longer than three hours you burnt your fingers on the "5" key!

I still have that ZX81 to this day, and I both fondly remember the hours spent coding as a 15 year old boy, as well as the pain of wondering if I ever would enter the formal schooling system again. I took the opportunity this Youth Day to revisit that period, spending a few minutes at the Trojan Horse memorial in Thornton Road.

In the silence of this austere memorial, I silently thanked the Universe for sparing me, and for somehow in the madness that was the 1980's struggle giving me a love for computers that I carry with me to this day. I was also mindful of a terrible waste: the fact that three young people are no longer with us - their dreams and hopes wiped out by that terrible part of South Africa's history.

Hamba kahle Shaun, Jonathan and Michael! Your memory and the price you paid for our freedom will always be remembered.

Gibt mein Google zuruck!

A crazy thing has been happening when I browse the web at our company through iBurst - I've got www.google.com set as my home page.  Usually it goes to Google South Africa page, but today for some odd reason it started going to Google Deutschland.  Weird!

Since we are majority owned by Dutch investors, this is going to take a lot of explaining if they ever find out...

We also occasionally have the German Consulate show up in the wireless networks accessible from our floor, though I'm sure that this has nothing to do with our Google Deutschland Uber Alles problem.

 

Apple/Nike's Sole Music (or What's your Coding PowerSong?)

Apple and Nike have teamed together to produce a shoe that transmits fitness data to directly to your iPod.  As a keen user of my iPod at gym and on runs along the Sea Point seawall, this is one product I think is really cool.

The current wireless kit shows your distance, time, pace and calories burned in real time and displays data on the iPod. Someone just needs to invent a heart rate monitor that works with the iPod and I'll be a keen buyer.

One of the other innovations I like is the PowerSong - a one touch button you can press when you need that extra vooma!  In fact, I think it is one innovation that should probably be built into the iPod standard.

My other use of my iPod is to provide background music to coding, and I think it would be neat to be able to press a button every now and then to get a Coding PowerSong whenever I need a little bit of inspiration.  I generally find classical music (especially Pachelbel) is great for coding, but every now and then I need that wake-up song - so here are my nominations for Coding Powersong:

1. U2's Elevation

2. Queen's Under Pressure

3. BareNakedLadies One Week

Any other suggestions out there for a Coding PowerSong?

 

 

When good coders go bad!!!!

There is a statistic I read somewhere that there is about 50 days from when someone signs up for a blog, and the time they post their first entry.  Since I've put my blog up about two months ago, I think that first posting is long overdue.

There were two reasons for the tardiness:

- firstly, I've just started a company, so in the last couple of months my life has been filled with conducting over 50 candidate interviews, moving into new premises and setting up everything from servers (despite Dell worldwide shortages of various bits of technology), telephones (despite a Telkom strike) and, of course, ensuring we have a decent UPS strategy (Eskom, feel our pain!).

- secondly, and this may sound vain, I just had to wait until I could do a first post that would sound at least somewhat profound.

Well, we had one of those geeky tech moments that happens at software companies from time to time which could count as a Somewhat Profound Day (capitalisation with apologies to A.A.Milne).  It began like this: 

One of our newly hired developers, who is known for his somewhat warped sense of humor (his own self-admission here!) sent around the following email based on some code he found on the The Daily WTF:

Hi All

I propose that from now on, all variable assignments are coded like this:

 do { value = newValue; } while(value != newValue);

This will ensure that the variable is definitely set to the correct value as the loop runs as many times as needed to set the actual value. Personally I think that the performance overhead this will create by having to check the loop condition is not as important as the absolute rock solid certainty that the variable will be assigned correctly. What do you guys say?

:D

Most of the developers saw the humour, but one of our more trusted software architects just had to make sure, so he sent around the following email:

Hi :D

I know we should program as "rock-solid" as possible and excuse my bluntness here,  but is this not coding with extreme paranoia?

If you can tell me that C# is buggy and that when say value = newValue you often get the case when the assignement doesn't happen, then I fully support the idea.

However, look at this way:

When testing code... you only test your own code, not the fact that C# was able to do an assignment properly.. That's a given.

:R

Of course, this was a cue for everyone in the entire company to make some comment or other on the exchange, and the company lunch-time table was quite an interesting one that day, with :D being extremely proud that he had got :R to take the bait.

The strange thing is though, is that given some of the downright horrible code I've occasionally witnessed in the last two months while interviewing candidates, I am not surprised about :R's failure to spot good humour from bad code.  One of the paths to getting hired at our company is a test where we ask candidates to write a few lines of either C# or SQL code, and I have been been scared a little too often for comfort at some of the results. 

While most people come through our coding exercise, there have been the odd candidate, that despite having a CV that says 5 years of SQL with Skill Level 5=Expert, totally fails at using the COUNT or GROUP BY statement correctly.  The worst for me was a candidate, who, despite a claim of 24 months of C#, when his application failed to build, had absolutely no clue where to find the build errors in the IDE.  How anyone can actually hold down a developer position for months at a time without even the basics like this really scares me.

I think one of the great problems we have as developers is that, generally, we have this characteristic of being really nice people.  While this trait is admirable for the most part, I have seen too many teams never really confronting poor performance, and quietly fixing (or at worst, tolerating) someone else's really bad code. 

I think it takes great courage to boldly confront poor coding practice from our colleagues, and I really wish developers in our industry would do more of that (even if they are going to be teased at lunch-time when its not poor coding practice that's at stake, but someone's warped sense of humour!).