Taking the lead

I used to lead a team at an agency in the Cheshire countryside before my latest move took me to Altrincham. I was therefore directly responsible for people’s careers and shaping how back end code was written on software projects. I know you can say people are responsible for their own careers, but I think senior people need to help steer others in the right direction and offer advice. You can’t make people learn, but you can inspire them and keep them on the right track.

Recently I began thinking about my role there, since now I have my own projects to deliver and in terms of mentoring I am not directly responsible for other developers careers, at least officially. Back when I was responsible we managed to get the team built out to enable me to help out of projects that needed support and spend time pairing with others, making sure we use the right technology for the project and have the necessary time to complete the work. I hope this allowed me to spend valuable time with the 5 developers (all lovely lads!) I had in the team and work with the other “leads” to make sure we collaborated properly to build the best solutions efficiently. I believe this will have benefited everyone involved as I got their feedback and could discuss how and why we could solve a problem better, plus we grew to be a tight unit as a team. By this I mean we would pick up each others work easily and want to put in the extra effort for each other in times of tight deadlines. It also gave me the chance to see the bigger picture and introduce TDD, code coverage and continuous integration and deployment.

This wasn’t always the case, at first when the team was small, the workload wasn’t much smaller. I had projects to deliver myself as well as help out on others, plus I wanted to give them space to develop their skills with out fear of failure. At times I got too into my project (especially as it was a big client and had very tight deadlines) and wasn’t able to spend the time I needed with others in the team when they really needed me. I still maintain to this day that this impacted badly on 2 the members of the team I had at the time. They were left to fend for themselves and although they did their best they needed direction and support.

I was lucky that the company allowed me to build the team out and become less project dependant as the role of leading a whole team AND delivering projects 24/7 just wasn’t going to work, at least not in this case. By being able to put in the extra time and effort to bring others on we ended up happier, more efficient and better skilled as a team.

I would be interested to hear other developers views on this, if you are prepared to share them?

Thanks for listening!

Razor view anonymous models

I stumbled across this issue this morning…

'object' does not contain a definition for 'Error'

Description: An unhandled exception occurred.

Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'object' does not contain a definition for 'Error'

@if (Model != null) {@Model.Error}

Basically the anonymous type on the model is internal and can only be accessed by the assembly in which it is declared. Views get compiled separately and therefore can’t access the property.

How to fix it…

I found a nice little extension class referenced on stackoverflow

public static ExpandoObject ToExpando(this object anonymousObject)
IDictionary anonymousDictionary = new RouteValueDictionary(anonymousObject);
IDictionary expando = new ExpandoObject();
foreach (var item in anonymousDictionary)
return (ExpandoObject)expando;

You then create your (very basic) anonymous model as follows:

const string error = "error message";

return View("viewname", new {Error = error}.ToExpando());

The razor view code is then as before:

@if (Model != null) {@Model.Error}