Monday, 25 April 2011

Book: Joel on Software: And on Diverse and Occasionally Related Matters That Will Prove of Interest to Software Developers, Designers, and [...]

This book is effectively a collection of Joel's blog postings and letters, assembled into a somewhat coherent sequence of five parts. The first two parts are the most useful - “Bits and Bytes: The Practice of Programming” and “Managing Developers”.


I found part two exceptionally enlightening – this is the first book/article that I've read which deals with the matter of managing software developers directly, from the point of view of a former/current programmer.


Part one (The Practice of Programming) contains a very useful series of four chapters entitled “Painless Functional Specifications” - again, fantastically simple ideas and solid reasoning as to why it's critical that (almost) any piece of software development should be preceded by the thought process and documentation phase that amounts to a functional specification. I would just about say that this series of articles (or something resembling it) is a must read for any developer. Too many developers (myself included at certain times in the past) in my opinion are all to willing to dive into coding ahead of putting the simplest of designs on paper – this process alone can reveal fundamental flaws in a plan. Joel goes so far as to recommend that developers take a simple course on practical writing, totally agree. Almost all of the other chapters in this section are brilliant and enlightening – certainly however “Painless Functional Specifications” stands out as gold IMO.



Parts three, four and five are not so well organised and start to devolve somewhat into (loose?) assemblies of blog postings; many of which are revealing and fascinating (especially IMO, where Joel makes comparisons to his experiences as a Program Manager at Microsoft). There's a few posting about .NET that are particularly intriguing.


Many of the articles in the book were written in the years ranging 1999-though-2004; a period of time that the .NET Framework was in it's beta manifestation or in v1.0 and v1.1. I find this section fascinating for two reasons. Firstly, Joel has recorded, like a time capsule, some of the ridiculous announcements and summaries of .NET that Microsoft first put out there. I remember at the time, as a student and emerging professional developer being simultaneously intrigued and baffled as to what the heck .NET actually was. Over a period of a couple of years the hype boiled down to an apps development framework that was more-or-less similar to Java. Some of the fantastically broad and meaningless spiels that Microsoft were using to describe .NET at the time made it seem of equivalent magnitude and significance to a manned mission to Mars or Skynet becoming self aware, without providing any detail whatsoever about what .NET actually was. I guess however a campaign that marketed .NET as “Microsoft's equivalent to Java” wouldn't go down to well with non-technical folk. Joel saw though the bollocks back then with crystal clarity. The other element of Joel's commentary of .NET that rang true was his questioning of the need to engage .NET seriously as a development platform, and the cost of rewriting existing code-bases to integrate with .NET. To do this is a costly venture that many businesses are still struggling with the practicality of today. I remember at the time, the organisation that I was working with was wary of .NET and the cost that it represented from a business perspective. Joel's writings from this era reflect the exact same sentiment. For myself, at this time I was a fledgling developer who has just realised what .NET was all about and was keen as to get stuck into it – this didn't help things, and eventually led to my departure from a good company (voluntarily!). I have gone on to become a strong and accomplished .NET developer, at the cost of an opportunity to be part of a great NZ success story. Them's the breaks I guess – I enjoy what I do regardless and am still on good terms with the company that provided me with my first break into the software development industry (they are my Aunty and Uncle – the company is Abtrac), and that's what counts I think. Besides, I have moved on to another NZ success story! In summary, Joel's critique on the turmoil that the introduction of the .NET Framework brought to the Microsoft software development community is in depth and, I think, heartfelt. I enjoyed it.


In summary, this is an extremely useful book that is written in a lively and humorous manner. Well worth a read for anyone who has anything to do with software development. And in my opinion, a must read for Microsoft software development leadership/management people.


Title: Joel on Software: And on Diverse and Occasionally Related Matters That Will Prove of Interest to Software Developers, Designers, and Managers, and to Those Who, Whether by Good Fortune or Ill Luck, Work with Them in Some Capacity
Author: Joel Spolsky
Link: Amazon
Tags: .NET, Book, Joel, Management, Software Development

Friday, 22 April 2011

Reading Log and Career Path

I started another blog - "Bernard's Reading Log" recently. Then I realised that since I don't post a lot of stuff anyway, and also because much of what I'm reading that I want to post about is related to technology (some more, some less), I may as well have it all in the same place. Makes my posting stats look more impressive in any case... So I imported that blog to this blog. I've got a few more books queued up that I've read (or am reading) recently - hopefully will get them posted soon.

Regarding the other topic in this post's header; my reading history (which can be viewed by searching for the Tag "Book") gives away the story of what's happened with my career in the last year-or-so. In January 2010 our Development Team Leader left the company that I work with to go out on his own. A bold and respectable manoeuvre, which I believe is working out well for him. For me that meant that I was offered his job - which I accepted.

Since taking starting as a DTL, I have found that professionally, things have changed for me significantly.

Managing and leading a team (I more-or-less do both) is a totally different job than programming. I enjoy it, but it's difficult to say why. If you asked me why I enjoy programming, that's pretty easy to answer - I won't go into it, but I think that anyone who enjoys programming will give you roughly the same answer; best description I've read to-date is here[1]. The buzz of management and leadership is more challenging to define. I started trying to write up a description just now but got lost - I'll come back to this in a later post!

Anyway, as part of my transition to this new world, I thought it wise to seek professional help; I took a leadership skills course in mid 2010. It was led by an American lady (I'll remember her name and post it), she told lots of stories about her career, provided tons of valuable advise, etc; it was a generally worthwhile programme. The resounding message that I took away from it though was that although her overriding advise was to read more about leadership and management, regularly, more than 90% of people taking the programme wouldn't change their behaviour. I was determined not to be in that 90% and as such have kicked off a personal reading programme and am blogging my progress for my own reference, and for the benefit/amusement of anyone who may happen upon my blog.

Something else I've read recently, in the "painless functional specifications" section of Joel on Software (the book[2]), is that it's useful to have strong writing skills, in order to help with writing functional specifications and with day-to-day business in general. That makes sense to me. I guess Joel achieves this by writing tons of blog posts and the odd book. I doubt I'll write a book, but I can certainly put the odd blog post together.

So, in summary, my blog has changed tack, somewhat. Still technology oriented, but now leaning toward the leadership and management side of things. Most likely this just means it'll become more wordy. I'll start chucking a few more pictures in for good measure - they may be random (e.g. in this post they are of a trip I took to Hong Kong with my family in 2004). In any case, I hope it's a change for the better, and I hope if you happen upon my scrawlings here, you find them at least amusing!

[1] The Mythical Man-Month, Addison-Wesley, 1975, p.7-9.
[2] "Painless Functional Specifications": http://www.joelonsoftware.com/articles/fog0000000036.html

Wednesday, 6 April 2011

Using XLinq & MVVM to Populate DDL for ASP.NET MVC

Making some adjustments to a website recently. It's not a heavily used beast, but my client required some dynamic functionality - pulling data from a semi-static data-source that he would be able to edit. Hooking up a SQL Server back-end would have been overkill, so I looked into XLinq as an alternative. I have tinkered with XLinq in the past but haven't ever found any particularly useful application for it. This time however it worked out beautifully.

Setup an MVVM for the page that I was working with and used a technique for loading the data that admittedly I need to credit to Sascha Barber. The technique is fantastic and works perfectly.


Here's my data, stored in a file name things.xml at http://things.com/things.xml:


<?xml version="1.0" encoding="UTF-8" ?>
<things>
<thing>
<name>-- STUFF --</name>
</thing>
<thing>
<name>THING ONE</name>
</thing>
<thing>
<name>THING TWO</name>
</thing>
...
</things>


Here's the MVVM:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Collections;
using System.Xml.Linq;

namespace ThingSite.Controllers.ViewModels
{
public class ThingsViewModel
{
...
public SelectList Things { get; private set; }
public Thing CurrentThing { get; private set; }

// constructor
public ThingsViewModel()
{
Things = new SelectList(GetThings(), "Text", "Value");
...
}

private IEnumerable GetThings()
{
string fullXmlPath = "http://things.com/things.xml";

var xmlThingResults =
from thing in Common.StreamElements(fullXmlPath, "thing")
select new SelectListItem
{
Text = thing.Element("name").Value,
Value = thing.Element("name").Value,
Selected = false
};

var list = xmlThingResults.ToList();
return list;
}
...


Here's the Common.StreamElements() static method (thanks Sascha!):


public static IEnumerable StreamElements(string uri, string name)
{
using (XmlReader reader = XmlReader.Create(uri))
{
reader.MoveToContent();
while (reader.Read())
{
if ((reader.NodeType == XmlNodeType.Element) && (reader.Name == name))
{
XElement element = (XElement)XElement.ReadFrom(reader);
yield return element;
}
}
}
}


Here's the code that returns the MVVM from the Controller:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ThingSite.Controllers.ViewModels;

namespace ThingSite.Controllers
{
public class ThingBookingController : Controller
{
...
//
// GET: /ThingBooking/Create

public ActionResult Create()
{
return View(new ThingsViewModel());
}
...


And here's how it's used in the View to populate a DDL:


<%@ Page Title=""
Language="C#"
MasterPageFile="~/Views/Shared/Site.Master"
Inherits="System.Web.Mvc.ViewPage<ThingSite.Controllers.ViewModels.ThingsViewModel>" %>

...
<% Html.EnableClientValidation(); %>
...

<td colspan="3">
<%:
Html.DropDownListFor(m => m.CurrentThing, Model.Things)
%>
<span class="validation"><%= Html.ValidationMessageFor(m => m.CurrentThing) %></span>
</td>
...


So providing he more-or-less knows how to edit an XML file (he does!) my client is able to go into the XML file and adjust the list of things available for the DDL to be populated by. I reckon that's a pretty nifty technique, for lightweight use.

Migrating (and Open-Sourcing) an Historical Codebase: SVN-to-Git

I have a SVN repo on my local machine that I have been shoving stuff into since before I knew how to use revision control systems properly (...