DevWeek 2011 – A Week of Geek

Another year, another incredibly lucky software developer gets to spend a week at the DevWeek conference.  For regular readers of the blog (hey mum!) you’ll know I attended last year and you can see my write up of it here.

I look at my own career over the past 12 months and realise just how much DevWeek helped hone and solidify a lot of my thinking – I’ve moved on massively since then and have put a great deal of last years learning into practice within products that I’ve worked on, so definitely was a worthwhile spend (thankfully my employer also thinks so!)

I had to choose my sessions far more carefully this year, it was a downside of returning I feel, but there felt like a lot of repetition on sessions – that said, there was still a great deal of new content (and I enjoyed @JeffRichter’s talk on exceptions so much last year I re-attended this year – sad eh!).

Day 1 Highlights

Ajax and ASP.NET MVC

K. Scott Allen – @OdeToCode

The lightbulb went on at the start of this talk and just didn’t switch off – I’ve not done so much on the Ajax side of MVC, though he made it all incredibly easy, and although I’ve watched the videos he delivered via pluralsight, it was far easier to contextualise and sank in better being in the room (and able to ask those stupid questions!).

He covered the client validation updates in MVC3 (the main reason we switched to MVC3 when it first launched), and covered a great deal around the topic as folks asked questions.

Massive tangibles to take directly onto a project I’m working on and I look forward to getting some of this into code asap.

NoSQL, Is it the future?

Gary Short – @GaryShort

Oh how I wish I went to that day on NoSQL last year in Scotland…  Presented brilliantly (as per really, after seeing presentations at DDD this is the usual craic with Gary).  He covered the various products available and the general use cases for them, obviously the history to NoSQL, and covered a lot of use cases.  I could waffle more but I’d only highlight my ignorance – realistically the cleverness in the talk and the outcome for me was that I have to try this – I have to grab a small project at work that I can pickup in my spare time and experiment with it.  I work in an environment where it’s easy to test the limits of our RDBMS solution as we have a massive amount of traffic, especially writes, and I think it’d be worthy of investigation – definitely more on this to follow from me!

Day 2 Highlights

Model Binding in ASP.NET MVC 3

K. Scott Allen – @OdeToCode

I’m going to start to sound like an @OdeToCode fan boy, but his presentation style and knowledge of the topic when asked a question just rocks – one of those people that qualifies in my book as a Dev Rock Star, so him catching up with him at lunch to have a chat through the questions I’d asked during the session was just superb!

There was a great deal of validation (personal, not model) in this session on the ways we’re currently doing model binding, though again, there were significant tangibles around the extensibility in MVC3 that may well make certain aspects of what we do around model binding easier.

Modern Javascript

K. Scott Allen – @OdeToCode

ok, ok, it’s turning into the Scott Allen show… doh!  I can only hope the reticence to ask questions during this question meant that others were similarly thinking ‘Oh Christ, I don’t do any of this!’.

I got that functions are heavily important (I sort of got this from consuming jquery, I’d just not written my own in the same vein).  Closures are an area I really need to read up on, and in general I just need to work at this one.

For any developer who consumed jquery and just ‘gets things done’, but has never written their own class, implemented their own closure, etc. I’d say do as I plan to do and get to learning – there are so many opportunities that I’ve utterly missed.  Exciting times.

Day 3 Highlights

Do’s and Don’ts of ASP.NET MVC

Hadi Hariri – @hhariri

Again, as much a personal validation session, but loads of little tangibles from this one – lots around IDependencyResolver and Nuget that I just need to *do* – we use Unity in ControllerFactory guise currently so I really need to get this sorted.  Nuget I’ve been consistently positively surprised by, There was a lot more in this session and I’ve got a bucket full of notes to work through but a crackign session.

Improving Website Performance and Scaleability While Saving Money

Robert Boedigheimer – @boedie

Possibly the best talk of the week for me – and there wasn’t a design pattern, a mention of SOLID, or indeed a unit test in sight.  Robert presented a lot of absolutely practical steps that can be taken to improve performance on your website, he highlighted some of the tools he used (and how he uses them), and it was just practical advice after practical advice.  There is content from this that absolutely will be going into my every day work from next week onwards, and the team are going to despair as I wave the flag for the tools/concepts I got from this talk.

Closing Thoughts?

Well, the above (as well as just being in a focused environment where I got to talk dev) was superb.  I personally think if I can continue to be funded for it I’d return every 2 years rather than annually to give the talks a full chance to rotate, though that’s not a criticism of the hosts or those people who give talks, I’ve seen it on other speaker circuits too (DeveloperDeveloperDeveloper events for example) and it’s one of those ‘either shut up and do a talk Tez or let them get on with it’ – I really have no desire to do so, so will be happy with what I get!  Thanks to all of the organisers and speakers, it has absolutely rejuvenated my geek batteries

Onwards and upwards now, fired up geek on board!

DDD9 – or 10 hours in a car and lots of learning

This weekend saw myself and a few of the developers from work take the long drive down from the relative comfort of the north east down to that there Reading for a day full of community driven talks about our craft.  I won’t give you any real background on DDD9 as @philpursglove has a cracking post on this here.

The sessions I attended were as follows:

.Net Collections Deep Dive

Gary Short (@GaryShort)

Having not seen Gary present before, this talk came as a fantastic start to the day – his presentation style is superb, and the content was perfect for me.

He covered the different collection types, and I got an awful lot from the flow of the talk on which collection types to use in different situations.

Key takeaways for me on this one were:

  • the performance aspects of growing collections (the doubling of the arrays, and more problematically the CopyTo that goes on to enable that growing).
  • if you know the size of a collection before you initialise it, specify it (IList<Stuff> stuff = new List<Stuff>(12))
  • Prefer .AddRange() to looping through a collection and using .Add().

He covered a lot more in this talk (sorting algorithms and when to consider using your own sort etc.) but all in all, cracking start to the day.

CQRS – Fad or Future

Ian Cooper (@ICooper)

I arrived at this talk having seen Ian present before on different subjects so knowing he was good, and having utter cynicism on CQRS (Command Query Responsibility Segregation).  It seemed to me (note the past tense) like an utter waste of time and something that allowed/supported a weaker architecture.  Very much a toy for the cool kids.

Well, the talk has convinced me that I need to look into this as a lot of what Ian said resonated with me.  Having a thin ‘read’ layer that (in our case) would return our View Models completely away from the domain objects makes so much sense – do I really need a 7 table join ‘User’ object *just* to present the pertinent details to the user allowing them to change their password (caching in place or no!).

The domain object would get involved on the commands – the changing of something, and at this point the domain model is a godsend naturally as it validates whether or not what you are doing is valid.

I like that it simplifies down our Service and Repository layers, and can see some real potential from it all.

It’s not something I’m going to rush out and implement tomorrow, but it’s something that has now hit the reading list as something that I must understand with an aim to be better informed when I make architectural design decisions in our software – I will no longer rule it out as a fad that’s for sure.

Functional Alchemy – how to keep your c# code DRY

Mark Rendle (@markrendle)

This guy was a great speaker – fantastic talk, his knowledge of the functional aspects introduced to the .net framework was huge, and he certainly used them well in his examples.

What this talk highlighted is just how shit I am!  There are aspects of the .net framework that I have very little understanding of (am I supposed to admit this publicly? lol).  I use and consume Func<T> and Action<T, TResult> on a day to day basis on the framework with no problem (and love them).  Does not knowing how to ‘roll my own’ affect my day to day job? Not really.  Do I want to know them to add to my toolbelt?  Damn sure.  Some of the stuff he was doing with (in his own words) abuse of Actions and Functions was incredible.  There are some really nice patterns that come out of this, and it’s linked for me to the Monads talk that Mike Hadlow gave as things I ‘Must try harder’ at.

I suck Smile

Is your code SOLID?

Nathyn Gloyn (@nathyngloyn)

Very good talk covering the origins and usages of SOLID, including code samples that demonstrated it.

I would encourage anyone that doesn’t understand these principles to read up on them (a google search will reveal much), they very much apply to all software development and even a high level understanding of them *will* make you a better software developer.  They’re not all prescriptive, they are tools to use as and when you feel it applicable, but having them in your mind while you design software is gold dust.

Thankfully the talk for me helped solidify the approaches we are taking at my current employer are the ‘right’ ones, and it was a ‘warm blanket’ type talk that made me feel like I wasn’t an utter numpty.

CSS is code, how do we avoid the usual code problems?

Helen Emerson (@helephant)

I felt like a lone sheep during this one, as I use (and really like) reset.css files (though I understand why Helen doesn’t), I thankfully work in an environment where backward compatibility means that if it doesn’t have rounded corners in IE6 but it ‘works’ then jobs a good un, so I very much felt Helen’s pain when she explained some of the hoops she has to jump through to ensure cross browser remains as similar as possible.

Although a good talk, the key gain from this talk for me was at the end when the community chipped in.  So for example there’s the following products/projects I need to look at:

  • dotLess/SASS – means of treating CSS as a programming language with variables/mixins etc.
  • Selenium, Browserlabs and Mogotest as means of testing UIs

What I did also get from this was Helen’s blog which I’ve subscribed to – she has a lot of very good stuff to say and I’d recommend folks that have any interest in front end have a read of it.

Beginners Guide to Continuous Integration

Paul Stack (@stack72)

This guy has been helping me a lot over Christmas with setting up our CI build, so was nice to finally meet him and say hello (surprising how many people just recognised me yesterday – who’d have thought that I stand out at 6’ 9”! Lol).

He didn’t really cover anything new for me, though really again helped solidify that continuous integration is the ‘Right Thing’ to do.

Most importantly from this talk (and the conversations I had with him over Christmas) – do it in small steps – don’t try to achieve everything straight off.  Set it up, get it checking out and building first – light stays green?  Do a run through of unit tests next.  Light stays green? Look at code coverage and other tasks.  Light stays green? Deployment… etc. etc. etc.

This way, over time you’ll build up the build that you *want* without all that significant up front cost.

Close

Another brilliant day run by the community, for the community, and I can only thank all the organisers and speakers for taking the time out to organise it, along with a huge thanks to Microsoft for the venue – the cookies were ace!

Loads of learning points for me, but that’s a huge positive, not a negative!

It was incredible to see on one of the first slides of the day that the North East is getting a DDD event in the Autumn – yay, I can do the geek dinners, the beers, and still get home to a comfy bed!

Roll on DDD Scotland!

2010 – A year in geek

I’ve found it incredibly cathartic to read a few others’ blog posts summarising not only the year that has gone, but their aims for the year ahead – this has been an incredibly busy year for me in geek terms, and I thought I’d write it up, as another hopefully cathartic exercise.

The year starts…

2010 started for me after only four months in a new job after escaping an agency environment in August last year – I honestly didn’t know how badly I had it in my previous role until I started in my current – I took quite a hefty pay cut to switch jobs, but the previous role (I should really say roles, as I was stupidly doing the IT Manager and Dev team lead roles) had me in the last 6 months of it working comfortably 60 hour weeks – I was knackered, home life was suffering, I couldn’t switch off, I was stressed (and anyone who knows me knows I just don’t do stress).

My current role is pretty much idyllic for me – job description is Senior Developer, but we all know that hides a multitude of sins.  Basically, I get to specify technical direction, I get to do staff mentoring/staff support, I get to be involved in the community, but (best of all) I get to spend about 75% of my usable time developing.  Pig in shit I believe is the term they use Winking smile

Legacy Code

Oddly, the first real achievement this year involved minor improvements to our payment system (based upon  legacy code – classic asp – ewww!)  I write it here not because I’m proud of the technology, but of the analytical approach we took, the change process we had in place for the little and often changes to it, and the overall effect of those changes – conservative estimates by our financial officer put us at just over 1% extra turnover.  Now that doesn’t sound a lot, until you see how much the company turns over – needless to say, they were very happy with the work!

Site Rewrite

This has been the big focus for me from around April, and it’s been huge – our existing site is a mix of a lot of classic ASP with a number of .net projects dotted around – the technical debt in there is huge and changes, be it new functionality or modifications to existing functionality are just incredibly costly.  The aim (and I’ve read any number of posts that say this is a bad idea) was to re-write the whole thing into something that was:

a) more maintainable

b) easier to deploy

c) of a far higher overall quality

d) minimised technical debt

e) easier to extend

With that in mind, the technologies that myself and the team have worked on this year have been wide ranging.

ASP.NET MVC2

The move away from web forms and into MVC has been a revelation.  I lament now the occasional need to maintain our legacy code as once you grok the separation of concerns involved in MVC2 (I heartily recommend both the Steve Sanderson book and the TekPub video series as learning resources). moving back to web forms (especially legacy) is a mare.  I’d say out of all the things covered this year, this is the biggest ‘win’ for me – I can see me using this pattern (and asp.net mvc) for a long time to come as my primary means of delivery over the web.

Testing Software (Unit, Integration, n’all that jazz)

I daren’t call this test driven development as we tend to write our tests after we’ve got the functionality in place – our specifications and business rules in most areas of the rewrite haven’t carried over verbatim, so writing unit tests ahead of time was rarely practicable.  That said, the project is now up to 290+ unit/integration tests, and I suspect before launch that number will nearly double.

It’s very easy during code reviews for team members to validate the logic, outcomes and goals in the unit tests up front so that they form almost a code contract which then goes on to define behaviour and functionality within the code.  It also (assuming business knowledge of the area under test) allows people to highlight potential missing tests or modifications to existing tests.

Learning wise, blogs have been the most use during the year for unit testing, though I would say a must purchase is ‘The Art of Unit Testing’ by Roy Osherove.  It got me thinking about unit testing in a very different way and has led (I hope) to me simplifying unit tests but writing more of them, using mocking frameworks to deliver mocks/doubles, and generally being a big advocate of testing.

Design Patterns

Obviously MVC goes without saying, though this year has seen me read a lot around software design and the patterns used therein.  I feel I now have a solid handle on a great deal more software design from an implementation point of view (the theory was never really that difficult, but turning that into an implementation…).  We’ve used the Service pattern extensively, Repository, I’d like to think we’ve used Unit of Work in a few places, the Factory pattern.  They’ve all seen the light of day (necessarily so) in this project.

There’s a fantastic post by Joel Spolsky about the Duct Tape Programmer which I’d urge everyone to read if they haven’t done so, and it’s about finding that balancing act between software design for software design’s sake (the pure view) versus getting the job done – there’s always a balancing act to be had, and hopefully I’ve stayed on the right line with regards to this.  It’s very easy when focussing on the design of the software to over engineer or over complicate something that should be (and is) a relatively straight forward task.

Uncle Bob must get a mention this year, as his SOLID principles have been a beacon – you don’t always adhere to them, you don’t always agree where they apply, but you can’t deny that as underlying principles of OOD they are a good foundation.

Business Exceptions

Two talks immediately spring to mind when I look at the approach we’ve taken with business exceptions, the first was delivered at DevWeek which I was lucky enough to attend in April (see the post here), the second was delivered by Phil Winstanley (@plip) at DDD Scotland this year.

We’ve very much using exceptions as a means of indicating fail states in methods now, and I love it – coupled with our logging, it feels like we will rarely have unhandled exceptions (and when we do, they are logged), and the overall software quality because of this feels far superior.

I understand the concerns that have been raised around the performance of exceptions (cost to raise etc.) and the desire to not use exceptions for program flow, though I think we’ve struck a happy balance and my testing (albeit rudimentary) earlier in the year suggested to me that the performance of these things was something that just wasn’t a concern.

Continuous Integration

Something that’s been on the back burner for too long now, and only the past week have I made any headway with it, but already it’s a love affair.  I suspect the quality of the information we get out of the system as we move forward will pay dividends, and as we begin to automate deployment/code coverage, and I get more heavily into MSBuild, this is going to be something that I don’t think I’ll want to give up on larger projects.

Community

I now subscribe to approximately 160 blogs, which sounds like a lot, but thankfully not everyone posts as often as @ayende, so jobs a good un with regards to keeping up – I find 5-10mins at the end of the day lets me have a quick scan through those posts that have come in, discount the ones I’m not interested in, skim read the ones I am and star them (google reader stylee) ready for a more thorough read when I get to work the next day.  This may seem a large commitment, but remember I’ve come from a job where approximately 60hrs a week I was ‘working’ (not geeking I hasten to add, just client liaison, product delivery, bug fixing, and sod all innovation)  I now find my working week is down to approx 40hrs work, and between 5 and 15hrs per week on geek stuff depending on the week and what’s on – the extra time I get for self development is just my investment in my career really, and I talk to so many other people on twitter who do exactly the same.

Events

Getting our own local microsoft tech user group (@NEBytes, http://www.nebytes.net) has been fantastic this year – we’ve had some superb speakers, and I know that once a month I get to catch up with some cracking geeks and just talk random tech.  The guys who run it Andrew Westgarth (@apwestgarth), Jon Noble (‘@jonoble), Ben Lee (@bibbleq) and Damian Foggon (@foggonda) do a fantastic job, and I look forward to more of this in 2011.

I managed to attend DevWeek this year, and wrote up a number of things from it, but it was a fantastic week.  Thankfully work saw the benefit so are sending me again in 2011, so hopefully I’ll meet up with folks there and learn as much as I did this year.

Developer Developer Developer days.  These are superb!  Hopefully we can get one organised closer to home in 2011, but the two I attended this year (Scotland and Reading earlier in the year) were packed full of useful stuff, and the organisers need to be praised for them.

Geek Toys – The iPad

I couldn’t round off the year without humbly admitting that I was wrong about the iPad when it launched – I didn’t see the point at all, and was adamant it was going to flop.  Then in October I found myself the owner of one (erm… I actually paid for it too – I have no idea what was going on there!).

Well, revelation doesn’t do it justice – it’s the ultimate geek tool!  Thankfully a lot of the books I buy are available as ebooks also, and I’ve found more and more I’m moving away from print and reading geek books on my ipad – epub format is best (for annotations and the like), though PDF works a treat too.  Aside from that, tweetdeck is a cracking app on the ipad, and it lets me stay in touch with geeks more regularly than I would otherwise have done.  Reeder is my final tool of choice, and the way it represents blogs you’ve not read yet is fantastic.

I’d suggest any geek that loves quick access to their blogs, their books, and tweetdeck (though naturally the ipad does a whole lot more) have a play with one and see if it could be the answer for you too – I’m hooked.

And what of 2011?

Well, I’m over the moon with the way 2010 has gone really – all I can ask is to maintain my geek mojo, my thirst for learning, and a cracking bunch of people to work with and life will be grand Smile

A very quick PS to add a technoarti tag VBXP4MC892BG so that I can claim my blog via them

TeamCity – Install and Setup (Basics)

Been a while since I posted and I thought that the past few days warranted getting my thoughts down as we’ve just setup our first foray into Continuous Integration/Build Automation with TeamCity.  We’re in the process of rewriting the corporate site from classic asp/asp.net into an MVC2 front end with some solid (though not always SOLID) design behind it.  We’ve written a lot of unit tests (though many more to go), and thought it was about time we looked at the whole CI/Build side of things.  I’d hasten to add, the following post will remain at a fairly basic level, as that’s where I’m at at the moment – hopefully something in here will be useful, though it’s as much about documenting the steps for the team I work with and whenever I write something like this down it always helps solidify it in the grey matter.

Why Continuous Integration/Build Automation?

The answers for us fit pretty much into the standard reasons behind CI – primarily ensuring quality, though easing the deployment burden was certainly a part of it.  CI completes the circle really – you’ve written your quality code, you’ve written your unit tests (and any other tests, integration, UI, etc.), so why not have an easy way to get all of that validated across your whole team, making sure that the quality remains and that you don’t have the manual task of pushing the code out to your dev servers? 

Continuous Integration helps with all of this, and a whole lot more, though the ‘more’ part is something that will come in time for us I think – we now have a working checkin build (I’ll detail the steps I went through) so that at least gives us ongoing feedback.

TeamCity was the immediate choice for us as we don’t really qualify for a TFS setup and CruiseControl.net seemed to have a higher learning curve (I may be mis-representing it here mind).

Before going through the detail of the install, a quick shout out to Paul Stack (@stack72), the fantastic Continuous Integration book from Manning, and the as yet unread MS Build book from Microsoft – these as well as the blog posts from many have helped massively in getting this setup.

Team City 6 – Install

Generally, the defaults in the setup were fine.  I made sure that all options were enabled with regards to the service etc. – I can’t see the use case when you wouldn’t want this, but it’s worth stating.

image

I changed the path to the build server configuration to a more general location – it initially suggested my own windows account user area, though I was unsure (and couldn’t find easy documentation) on whether this would make the configuration available to others, so I defaulted to a different path.

image

With regards to server port (for the TeamCity web administration tool) I changed the default port too.  Although it’s recommended that the build server remains as a single purpose box, I felt uncomfortable going with the default port 80 just in case we ever chose to put a web server on there for any other purpose.

image

I also chose to stick with the default and ran the service under the SYSTEM account – it doesn’t seem to have affected anything adversely and I’d rather do that than have to create a dedicated account.

Team City – Initial Setup

Initially you are asked to create an administrator account – do so, though if you’re in a team of people, there is an option later to create user accounts for each user – far better to do that and leave the admin account separate.  In the free version you can have up to 20 users, so it’s ideal for small teams.

Create a Project

The first steps in linking up your project to TeamCity is to create your project.

image

Here, you can give the project any name and description – it can (though doesn’t have to) match the project name in Visual Studio.

image

TeamCity from this point on holds your hand fairly effectively.

image

oh, ok – thanks Smile <click>

The build configuration page has a lot of options, but some of the pertinent ones (at least early doors – once you have more experience, which I don’t, then the others will certainly come into play).

Name your build – I named ours ‘checkin build’ as I intend for it to happen after every checkin… does what it says on the tin kinda thing.

Build number format – I left this as the default ‘{0}’ – it may be prudent to tie it in later on with the Subversion version number, but for now, we want to get a working CI process.

Artifact Paths – very much steered clear of this at the moment – it seems there’s a lot of power in these, though I haven’t touched on them enough.

Fail Build If – I went with the defaults plus a couple of others – ‘build process exit code is not zero’, ‘at least one test failed’, ‘an error message is logged by the build runner’.

Other than that, I pretty much stuck with the defaults.

Version Control Settings

image

I deliberately selected to checkout to the agent as I suspect this’ll give me more scalability in future – the build server can have multiple build agents on other machines from what I understand (kinda the distributed computing model?) and those agents can handle the load if there are very regular/large team checkins.  I think there are limitations on build agents in the free version, but again – if we use this solidly, and need more, then the commercial license isn’t too badly priced.

I also chose a different checkout directory to the default, just because – no solid reason here other than I have a lot of space on the D: drive.

Our project is significant (24 VS projects at last count, a lot of them testing projects (1 unit and 1 integration per main project), and initially I experimented with ‘clean all files before build’ but the overall build was taking approximately 8mins (delete all, checkout all, build, unit test) – I’m going to try to not clean the files and do a ‘revert’ instead but at present, I don’t have any experience on which is better – certainly cleaning all files worked well, but 8mins seemed a while.

Attach to a VCS Root

The important part – linking up your project to your source control (subversion in our case).

image

Click ‘Create and attach…’  Most of the settings in here are defaults, but you will notice further down the page it defaults to subversion 1.5 – we’re using 1.6, so double check your own setup.

image

I also experimented with enabling ‘revert’ on the agent ala:

image

With an aim to bringing down the overall build time – I haven’t played enough to warrant feedback yet, though I suspect the revert will work better than a full clean and checkout.

Build Steps

The CI build will be broken into a number of steps, but firstly we need to get the core project building on the agent.  There will be a lot more to learn on this one, but for now, what worked well for us was the following:

image

Our Solution file contains all the information we need to work out what needs to be built, and TeamCity supports it so jobs a good un.  As I extend the base build then this method will still just work as I’ll be modifying the .csproj files belonging to the solution anyway.

Build Step 2

This one was slightly more convoluted, but basically, giving relative paths to the DLLs that contain the unit tests is the way forward here.

image

Make sure you target the right framework version (I didn’t initially, though the error messages from TeamCity are pretty good in letting you figure it out).

Build Triggering

We want this all to trigger whenever we checkin to our source control system (in our case, subversion), so when we click on ‘build triggering’ and ‘add trigger’, selecting ‘VCS Trigger’ will get you everything you need:

image

Are we there yet?

Well, just about – you will see the admin interface has a ‘run’ button against this configuration (top right of browser), lets do an initial run and see what the problems are (if any).  You can monitor the build by clicking on the ‘agents’ link at the top of the page and then clicking on the ‘running’ link under the current build.

Should you get the message:

… Microsoft.WebApplication.targets" was not found…

This basically happens because you don’t have web deployment projects (or indeed VS2010) installed on the build server.  The path of least resistance is to copy the C:\Program Files\MSBuild folder over to the build machine’s Program Files folder (if x64, make sure you put it in the x86 one).  You should find the build just works after that.

Ok, Build is working – Tell me about it!

Notifications were the last thing I setup (make sure you’ve setup a user account for yourself before you do this, the admin account shouldn’t necessarily have notifications switched on).  Click on ‘My Settings & Tools’ at the top and then ‘Notification Rules’.

I’ve setup an email notifier (which will apparently tell me of the first failed build, but only the first after a successful), and I’ve downloaded the windows tray notifier (My Settings & Tools, General, right hand side of the page) which is setup likewise.

Next Steps?

There are a lot of other tasks I want to get out of this, not just from a CI point of view.  I’ve deliberately (as @stack72 suggested) kept the initial setup ‘simple’ – getting a working setup was far more important than getting an all encompassing setup that does everything I want from the off.  I can now see the guys doing their checkins and the tests passing, I’m now far more aware if someone has broken the build (and lets face it, we’ll all deliberately break it to see that little tray icon turn red), and I know there’s so much more that I can do.

Next priorities are:

  1. Learn MSBuild so that I can perform tasks more efficiently in the default build – e.g. I want to concatenate and minify all CSS on the site, I want to minify our own Javascript, etc.
  2. Setup deployment on the checkin build – I suspect this will use Web Deployment Projects (which themselves generate MSBuild files so are fully extensible) to get our checked in code across to our dev servers.
  3. Setup a nightly build that runs more tests.  As you can see above, we build and run unit tests for our checkin build – I want to run nightlies that perform both unit and integration tests – I want the nightly to deploy to dev also, but to promote the files necessary to our staging server (not publish them) so that we can at any point promote a nightly out to our staging and then (gulp) live servers.

I’d urge anyone working on projects where deployment is a regular and pain in the arse task, or if there are a few of you and you’ve taken unit testing and TDD (be that test first or just good solid functionality coverage), my view now is that Continuous Integration is the tool you need. 

It’s the new Santa Claus – It knows when you’ve been coding, it knows when you’re asleep, it knows if you’ve been hacking or not, so code good for goodness sake!

As per all of my other posts, the above is from a novice CI person – any feedback that anyone can give, any little nuggets of advice, any help at all – I’ll soak it up like a sponge – this has been a lot of fun, and there’s definitely a warm glow knowing it’s now in place, but there’s a long way to go – feedback *very* welcome!

Windows Phone 7: Why I’m not ready for it yet

I promised folks who were asking on twitter that I’d write up to say why I wasn’t gong to stick with my Windows Phone 7 device at the moment.  Firstly, a quick background (anyone who actually reads the shite that I pour out on twitter can ignore this first bit).

Background

Anyone who knows me knows I’ve been hoping for good things for WP7 for months now.  I really fancied getting into WP7 dev (I still do), and with my contract on my iPhone running out in September 2010, I was ripe to pickup a new phone.

Android (even in its sexiest guise of HTC Desire) didn’t appeal – behind the HTC wrapper was what felt to me a clunky interface.  Sure, massively configurable and there is generally always an ‘app for that’, but it didn’t wow me at all.

iPhone 4 annoyed me – I wanted it to rock, and it does to some extent, but I refused to have to wear a condom just to make calls – stupid, stupid design and every time I tried it I saw the signal plummet as I have hands like a sasquatch.

So, as the hype built around WP7, this was me – this was where I was going, and this was the toy that was going to cover my next 18months of being tied to a carrier!

I followed the build up enthusiastically, I read developer blog posts, I attended dev events whenever there was a sniff of WP7 and loved the enthusiasm from the developer community at the impending launch. 

So what went wrong?

I, like quite a few others hunted high and low for a phone on launch day – thankfully I got the last one in the O2 shop in Newcastle and rushed it home to start the integration of it into my lifestyle.

I’d like to start out not by saying what went wrong, but what went right.

What Windows Phone 7 does well

The phone UI is stunning

It’s odd to think that a relatively simple text focussed interface could be considered ‘stunning’ but I think it’s that simplicity that makes it work so well.  I’d add a massive caveat to this and say ‘do NOT just look at screenshots of this thing if you’re considering getting one – get into a store and demo one’.  The animations/transitions and overall flow of the UI rock, and really shouldn’t be underestimated by only looking at screenshots – have a play.

The hubs are superb

This is going to sound odd after you read one of the reasons why I’m returning the phone, but in all seriousness, these are implemented very well, and with more integration options (discussed later) will absolutely rock as a means of centralising functionality – they’re superbly thought out.  If you’re happy using Facebook and Windows Live to supplement your contacts and pictures, then these guys really do do a cracking job.

Email

I loved the handling of email – the interface worked well, and the little touches ‘tap to the left of the message to mark it’ etc. really do become intuitive immediately – very good UX here.  The fact that I couldn’t mark my pop account as ‘leave mail on server’ was a pain in the arse until I worked out I could use imap – I hope those on pop3 only get the ability to ‘leave mail’ soon though – or this may piss people off.

Phone speed

Bloody fast – nuff said?  Seriously, the transitions, the animations, the starting up of the core apps – all really fast, and put my iPhone 3G (as well as the iPhone 4) to shame.

What didn’t work well for me

Occasional crashes aside (I mention them first, but only to discount them really).  My iPhone 3g still crashes from time to time (in terms of app crashes etc.) so lets not worry about those from a WP7.  I will caveat the below by saying these are my findings and it may be that they are incorrect (if so, I’d love to hear it).

Picture Hub

I have a flickr pro account and have over 500 images on there (random family stuff and the occasional lucky shot of something arty!)  I really didn’t want to have to download all of my images just to re-upload them to live so I could see them in the picture hub.  Yup, live does have a ‘flickr link’, but it only updates in your status that you’ve uploaded some pictures – it’s not tied into picture hub.  This unfortunately made picture hub fairly useless for me, which is a massive shame, as it really is a nicely implemented bit of software.  I think for me, in a ‘maximising market share’ mindset, Microsoft should now focus in future updates on opening up other means of social media into the hubs (as you’ll see below, my problem with people hub is similar)

People Hub

Love it, love it, love it.  Hate that it only integrates with facebook, and hate that I don’t have enough control over that flow.

I’m a person (as anyone who knows me will testify) that uses twitter as their primary means of social media.  Facebook is nice enough, though I only dip in/out of it to see how old school friends are doing, and how many more thousand muscle-bound men my sister has added as ‘friends’ so I can take the piss.  It’s not my primary means of staying in touch.

Integrating facebook works well, and you can even tell it only to link up those people you’ve already got as contacts in your phone so you don’t see *every* idiot you’ve ever added.  Great!  Except when you go into the ‘what’s new’ section of the people hub you still see the updates from those eejits, even though they’re not strictly in your ‘contacts’ – would be nice to have that limited.

Another failing is twitter integration – c’mon guys, aside from facebook it’s the primary social media platform!  I’d love to have my contact hub littered with random scouse expletives from @philsherry, catch up on geek things (or indeed how many cups of tea have been consumed today) from @apwestgarth, see what workmates are tweeting, etc. etc.

This one wasn’t really a deal breaker on its own for me, but added up to the overall effect.

Applications List

Swiping right from the start page and you’re into the list of apps you’ve installed (as well as those that already come with it).

I feel this section of the phone was an afterthought after the utterly brilliant start/home screen.

Seriously guys, the only way I can see my apps list is as an alphabetised single column list?

I’d only installed about 10-12 apps, and this page was already pissing me off – I dread to think what’d happen if I had the 30-40 I’d had on my iPhone!  People definitely need more control of this page – perhaps breaking off into separate pages keeping core ‘phone’ stuff on its own page or something like that – either way, it needs thought.

Zune

This one may be most controversial of all, but after 18months with an iphone (and therefore itunes) I think the zune software is clunky and nowhere near as friendly to use.  I could go into an awful lot of detail, but it’ll turn into a holywar of comments I suspect, suffice to say I personally prefer itunes by a long margin.

Is that it?

Well yes – I know it doesn’t sound a lot, and on the whole I think this phone is superb.  It’s just these things adding up for me that make me nervous about a £99 outlay then £35/month for 18months on the hope that a future software update will improve things.

So it’s enough for me at least (who really does have to consider what he spends his money on) to return to my out of contract iphone on my £30/month tariff for the time being.

What next?  Well, if the above are addressed, I’ll definitely be back.  So long as I don’t feel like I have to sell my soul to Windows Live to enjoy the key aspects of the phone (and this from a Microsoft fan boy!), then I’d happily own the phone again in future.

Android with Gingerbread sounds interesting, but proof will be in the pudding on that one to make sure they haven’t continued with the clunk.

Short term, I’ve decided to buy an ipad instead.  I have bought a lot of ebooks through manning, apress etc. and I subscribe to a lot of blogs – having an easy to use device that will let me co-ordinate all of that in a nice form factor I think will help my ‘geek’, so that’s short term.

Long term, I’d like to return to Windows Phone 7 (hopefully with some app dev experience), fingers crossed they build upon what is a great core with some of the things I’m after.

 

As per usual, your comments would be great on this – I’m guessing it has the potential to generate a lot of debate (though people may just not care of course!), and hopefully this hasn’t come across as any sort of ‘windows phone 7 is shit because…’ type post – I really do like the first iteration of the OS, and I think it’s got massive potential to generate competition in the market.  It just doesn’t feel ready yet for my personal needs.

Windows Phone 7 Launch – c’mon UK providers!

Well, as one of those eagerly waiting when Steve Ballmer launched Windows Phone 7 last week, and then immediately drooling over the devices I can say that my experience from that point on has been abysmal!

I noticed someone from the AUS market posting something similar, and thought I’d quickly relay my experiences within the UK market.

I’m currently an iphone owner with O2, and thought it great that they had the HTC HD7 as a unique offering, the screen size pipped it for me.

O2

Thursday lunchtime I thought ‘right, I’ll see what O2 have to offer if anything’ – 1 week before launch, they’re surely letting people pre-order or telling them how and when they can get one on launch day.  The conversation went:

Me: “Hey there, I’m interesting in upgrading my current package to Windows Phone 7 – have you guys got any information about tarrifs or how I can pick one up next thursday?’

O2: “Windows Phone 7?”

Me: “I know it’s just been launched this week, I’m just trying to get ahead of the game – do you have any details?”

O2: “Do you mean the iphone?”

Me: <blinks>No, surely it already shows I have an iphone – do you not have any information?  The phone is launching through you October 21st.

O2: Ahh, well if you phone us back on that day, we should have more information…

I’m sorry, but what an utterly epic customer team training fail from O2 there – just shockingly bad!

Carphone Warehouse

I’d like to say this was a unique experience, but while out on Saturday (16th – 5 days before launch) I decided to pop into carphone warehouse and ask if they had any info – retailers tend to get to launch info earlier.

Me: “I’m after tariffs and prices for the Windows Phone 7 phones, have you guys had them in yet?”

CPW: “We haven’t heard anything, though we may be getting some test devices in for next weekend”

Me: “The phone launches on Thursday though, will you not have any on launch day?”

CPW: “Ahh, we’re expecting an order later in the week, they might be in there…”

Me: <blinks again>

Closing Plea

This has been an utter fail across the board really – I’m absolutely gutted that such a powerful launch from microsoft last week has turned into the community scrabbling around for any tidbits of information.  It turns out that Orange has one of the phones on their site now with pricing, but as of the time of this post (Monday 18th 9:15am) the pertinent websites stand as follows:

Microsoft: as per launch day, listing the devices and which networks they are available under

O2: the holding page telling us it’s coming – you can sign up for information, and I got an email from them a day later telling me that they’d send me information when they had it #fail

Orange: I’ve misplaced the page where they list prices/contracts, though the fact that stuff is hard to find is still a #fail

Three: There is a pre-register page, and they’ve actually promoted it on their homepage (albeit one scroll down).  With no more information about tariff’s or contracts. #fail

t-mobile: I can find no reference to it on their search page. #fail [edit: thanks to the guys over at bitterwallet, someone has updated with a t-mobile link]

carphone warehouse: again, a search reveals nowt, and there’s nothing obvious via the navigation.

Microsoft – something in the co-ordination of this launch with the suppliers/carriers is fundamentally flawed.  The community heard about the iphone weeks in advance, they knew pricing, they knew how to pick one up on launch day.  The day of the launch, it was nice that the windows phone 7 site was pointing at the providers websites so that you could go ‘direct’ to the source of the details… only to be given a 404 not found error on every one of them – I mean FFS!

It seems that Windows Phone 7 is the big secret that nobody wants to let out – and yes, I wouldn’t be surprised if I walked into a shop on thursday and they had them, but really, that’s not the point – you have a community of people clammering for your new OS and these new devices, and nobody is telling us anything.  Yes, like the rest of us waiting I’ll sit tight and wait, but this really should have been addressed long before Steve Ballmer opened his mouth on that launch day…

Ahhh, LINQ – of course you’re case sensitive!

One of those ‘ahhh, bollocks’ moments this morning, so thought I’d write about it – a) so I’m not bitten by it again (writing about these things helps them sink in) and b) in case anyone else gets stuck and need a quick google of it.

Linq to SQL

We use linq commonly in our data access (SQL Server 2005/2008) and all is well on a join like:

var results = from cd in context.Distribution
               join uc in context.UCodes on cd.Batch equals uc.Batch
               where uc.Stamp >= betweenStart && uc.Stamp <= betweenEnd

...

Fairly standard stuff, an inner join between two tables based upon a criteria.  We use Latin1_General_CI_AS as our collation so no worries at all on those joins.

Linq to Objects

Now take those two collections out of the DB and into code (as we’ve had to do recently for a long running query), and that join above (on cd.Batch equals uc.Batch) gets buggered up.

Batch in the case above is a string, and someone forgot to sanitise it before entry to the DB (I use the royal someone, as it may have been me!), so a batch can be either ‘vfc’ or ‘VFC’ or ‘Vfc’ etc.

Move away from our cosy Latin1_General_CI_AS world and the above started to return a lot less data because of casing.

The fix is (as you would expect) easy:

var results = from cd in context.Distribution 
  
               join uc in context.UCodes on cd.Batch.ToUpperInvariant() equals uc.Batch.ToUpperInvariant()
               where uc.Stamp >= betweenStart && uc.Stamp <= betweenEnd
...

I thought I’d have a quick look around in terms of case sensitivity and which conversion mechanism to use (ToUpper, ToLower, etc.) and the following post interested me:

http://msdn.microsoft.com/en-us/library/bb386042.aspx

With the following information:

Strings should be normalized to uppercase. A small group of characters, when they are converted to lowercase, cannot make a round trip. To make a round trip means to convert the characters from one locale to another locale that represents character data differently, and then to accurately retrieve the original characters from the converted characters.

I’ve always tended to .ToUpperInvariant() when I’ve done string comparisons anyway, but it’s interesting to see some reasoning behind it.

 

Anyway, it goes down as one of those gotchas that I thought I’d write up.

Google Instant Search – is this a bug?

I got the news through about google instant, and started playing straight away – I’m really liking it, and although people on the team find the search results slightly ‘jarring’ when they change, I love it.

Interestingly, I work for an online bingo retailer (tombola), and we were really quite proud last week to hit 4th when searching for ‘bingo’.  From everything we’ve heard, google instant doesn’t make a blind bit of difference to the search, so “great” thinks I – though I’ll run a few tests just in case.

Appending to a search

  1. Using instant, type ‘bingo’ as your search – you should see tombola come up 4th (as of the time of this writing).
  2. Add a space as if you’re about to change the search – google instant correctly changes the search and different results are generated (we drop off the first page).
  3. Remove the space (you changed your mind didn’t you, you really wanted to see us!) – the original results set are returned back to their usual state.

Well done google!

Prepending to a search

I admit, this use case is going to be used far less than the original above, but ‘bingo’ is one of those words – it can happen at the start or at the end of a search term.

So:

  1. Using instant, type ‘bingo’ as your search – you should see us come up 4th again.
  2. Click to the start of the search, and put a space in – the results change, and we drop off the page, and Gala Bingo comes out as the primary search.
  3. Remove the space…

Hold on, where did we go? The results haven’t changed? But my ‘search intention’ has changed!

Is it a bug?

Well, that remains to be seen.  The above ‘behaviour’ can also be demonstrated by typing ‘development’ and pre-pending versus appending.  Oddly, not all terms behave like this though, so it’s not consistent.

Thoughts?

Chrome – are you sanitising my inputs without my permission?

I had to write this as I’m going mad, and I can’t really work out if it’s me, or if Chrome is indeed utterly fecking with my inputs.

I’m creating a form that takes (as a hidden variable) a string like this:

||eJxdUt1ugjAUvvcpml1tN5QjKpraROeSmQxnNl+gKyfKJgVLGbqnX4tW0CYk/X5oT79z6GanABaf
ICoFrIcQjaEs+RZQmkwfCu6N+gGJ/IA8WNHI69kHHM57g35BlWkuGfF8L6DYQSfHoMSOS+0IQ3Fx
mC9XbBAGAzKg+AJbPQO1XLDxuB9Foe8WxWe6tUmeAdvk2Ve+5+hxtk9ASTg9oTedUNyIrVfkldTq
xKJgSLEDrVypPdtpXZQTjOu69vT5VE/kXvVDsZXde/D9g+i6skTZve6YJixezOrut/qLT/FmW8ff
L1OKraP1J1wDC3zi+yMSIhJOguckQChu+E5wma2ckcCzeVxQKxe2kJnzWEuX6YRRKQVSuDQcag1w
LHIJ5h/Tz+u+Uy2Ugr3LfSoBzVO5zREXTaZIKEhSbeq2jmti9wHR59ebaRDa9DUc94f+zSJ2NBrt
prLUdI4Qq17A9R53rLnRTahtVzPLrEfx7Zz/A6p0zvw=
||

Double pipes at start and end are put there by me to denote where the carriage returns occur.  In particular, you can see there is a carriage return after the last character.

Browsers that work

When I render this out in a hidden field in firefox (or indeed any browser other than chrome), I get the following when viewing source:

<input name="PaReq" type="hidden" value="eJxdUt1ugjAUvvcpml1tN5QiKpraROeSmQxnNl+gKyfKJgVLGbqnX4tW0CYk/X5oT79z6GanABaf
ICoFrIcQjaEs+RZQmkwfCu6N+gGJ/IA8bNHI69kHHM57g35BlWkuGfF8L6DYQSfHoMSOS+0IQ3Fx
mC9XbBAGAzKg+AJbPQO1XLDxuB9Foe8WxWa6tUmeAdvk2Ve+5+hxtk9ASTg9oTedUNyIrVfkldTq
xKJgSLEDrVypPdtpXZQTjOu69vT5VE/kXvVDsZXde/D9g+i6skTrve6YJixezOrut/qLT/FmW8ff
L1OKraP1J1wDC3zi+yMSIhJOguFkQChu+E5wma2ckcCzeVxQKxe2kJnzWEuX6YRRKQVSuDQcag1w
LHIJ5h/Tz+u+Uy2ggr3LfSoBzVO5zREXTaZIKEhSbeq2jmti9wHR59ebaRDa9DUc94f+zSJ2NBrt
prLUdI4Qq17A9R53rLnRTahtVzPLrEfx7Zz/A6p0zvw=

" />

Notice in particular that the form field ends with the correct carriage returns.

When posting this to the third party provider (this is a 3D Secure transaction, letters have been changed to protect the wealthy!), jobs a good un, works no problem at all.

What happens in Chrome

When I view the same source in Google Chrome (5.0.375.99), I get the following:

<input name="PaReq" type="hidden" value="eJxdUl1vwiAUffdXkD1tLwVq/QyS1Pkwk9WZzT/A6I02U6qUrrpfP6hiW0mb3HPPAS7nXrbZaYDF
F8hSA+8hxBIoCrEFlKWzp6MIRv2QjgkhT4639Dr+hNM1tugXdJHlitOABCHDHno6AS13QhmfsCkh
T/Plig+icEAHDN9gwx9ALxd8MumPxxHxi+FraaEpcQC+yQ/f+V6g53ifglZweUfvJmW4JhutzEtl
9IWPwyHDHjR0qfd8Z8yxmGJcVVVgrqcGMg/KH4Yd7d+DHx/E1qVLFO3rzlnKk0Vctf/VX3JJNlsX
zxh2ikafCgM8JJSQEY0QjabhwH4M1/mWcQdXOadh4Py4oYY+ukJir3GSdqZcRqk1KOnd8KgRwPmY
K7B7bD/vcataKCT/UPtMAZpnapsjIWtPkdSQZsbW7RR3xx4NYq9vnWmQxvY1mvSHpLOoG42a61SW
2c5R6tgbuN/jj7U3+gl17apnmfcY7s75P2Hdzs8=">

Erm… Chrome – where did you put those carriage returns?

I’ve tried deliberately placing carriage returns on the hidden field, adding them to the variable, etc. and still, it removes them.

It’s almost like the value has had a .Trim() applied before being output?

This transaction fails (oddly enough, invalid paReq), and although I can’t prove it, my guess is that the carriage returns are significant in this.

Help!

Am I going mad here?  Am I missing something obvious?  Is this a bug or indeed a feature?

Update

This has now been confirmed by a few people – terrifying though that is. If whitespace is important to your form inputs (well, trailing whitespace), then the cry is ‘be careful!’.

Someone suggested a workaround on stackoverflow (http://stackoverflow.com/questions/3246351/bug-in-chrome-or-stupidity-in-user-sanitising-inputs-on-forms) which works a treat, and out of all solutions I can think of, is the most elegant.

Thanks for the feedback from all – it’s been a really useful exercise!

Overriding ToString() on your objects using reflection

Just a very quick one, more as a reminder to myself on something I’d setup, though as per, would love any feedback.

On a current project we’re using exception driven development, and upon an exception, we’re throwing our own custom business exceptions, and building up the Exception.Data collection with the properties in the objects as they were at the point of exception.

We have a lot of DTO objects down at the dal layer, some with a lot of properties, and we didn’t want to keep having to do:

UserNotFoundException ex = new UserNotFoundException();
ex.Data.Add(“Username”, userDto.Username);
ex.Data.Add(“UserId”, userDto.UserId);
ex.Data.Add(“AccountStatus”, userDto.AccountStatus);
...

With that in mind, I started working on what reflection could bring to the table and perhaps giving our Dto objects a base type to derive from.

Here’s the initial stab at what I’ve arrived at:

public class BaseDto
{ public override string ToString()
{
PropertyInfo[] propertyInfos = this.GetType().GetProperties();

Array.Sort(propertyInfos, (propertyInfo1, propertyInfo2) => propertyInfo1.Name.CompareTo(propertyInfo2.Name));

StringBuilder output = new StringBuilder();
foreach (PropertyInfo propertyInfo in propertyInfos)
{
output.AppendFormat("{0}: {1}\n", propertyInfo.Name, propertyInfo.GetValue(this, null));
}

return output.ToString();
}
}

Jobs a good ‘un.  I can now just use:

UserNotFoundException ex = new UserNotFoundException();
ex.Data.Add(“userDto”, userDto.ToString());

and all properties will be enumerated and documented in that one property of the .Data dictionary.

<meerkat>simples!</meerkat>

I hasten to add, this seems to work a treat in testing – I’ve got more rigorous investigation to do to make sure it presents a way forward for us, but thought I’d post it anyway in case anyone found it useful.