March 1008

The benefits of mentoring

I mentor the web team at work and recently I have also started mentoring a couple of students from the local university. I know its a cliché but when you have to show someone how to do something you have to know what you’re talking about and so being a mentor can be a great way of learning; either learning something new or learning something you thought you knew all about.

I try to not have all the answers, if I just give them away then I feel learning isn’t taking place – memorising is what’s happening. The goal is not to have all the answers because then you stop thinking, but to learn how to solve the problems. Mentoring means giving someone a place to try something while being supported and guided along the way.

Focussing my attentions on just a few things, for example how to avoid using magic strings or just focussing on 1 person at a time means they get more out of it. Of course the flip side to that is that you need to be careful not to seem to be showing favouritism. Nevertheless there are times when it is essential that you do focus on just one person, pair-programming is one way to achieve this and recently, at work, we have been having some success with informal pair-programming.

A few days ago (before the trouble with my hosting provider) I spent some time pair-programming with one of the developers, it can be quite hard to remain hands-off as I know what I want to do but that’s not the point, the point is to help the developer grow and that means experimenting, finding what works and what doesn’t. I will show them where to find answers, or places that I think are going to help but I will not simply dictate code as I feel there is no value in doing that. At the end of the session the developer had written some pretty slick code and our team had grown a bit stronger because he now knows how to deal with that type of code. It is also good for me to remember the problems I had when learning to do things. The first time I used version control I had to work it out for myself but doing so has given me a good understanding of the process, writing my first unit test was a big hurdle and took me months to do, there was no one there to help, but with a helping hand to show you past the tricky bits you can get up to speed on something really quickly.

Personally I would encourage people to find a mentor, someone who can help show them the ropes, and I would also suggest looking for ways to mentor others because it really helps, it helps them and it helps you – plus you get a warm feeling from knowing that you’re giving something back!

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

March 1003

Stagnation – why you need to keep challenging yourself and learning

In my previous job I got to a point where I could do what I needed to and then stopped learning. I’m not proud of that, I stagnated for nearly 2 years churning out the same code over and over. CTRL + C, CTRL + V were my friends, or at least I thought they were, it was quicker (and easier) to copy some code I’d already written for a similar project than it was to rewrite it. I even rolled my own ADO.NET DAL each for each and every project, created the stored procedures, DTOs and classes afresh – I did have 1 helper class, that I’d cribbed way back when I started out and was using a book to guide me, but once I’d written it I didn’t bother to think about it or how it could be improved.

I could try to justify the above by saying that deadlines were very tight and there simply wasn’t time for me to think about creating reusable code, though I’m sure that would have saved me time in the long run and no one would have known what I was doing. But truth is though I started out most projects thinking I’d make a reusable framework, after a few weeks and the boss looming over my shoulder, I abandoned what I was trying to make generic and reusable and concentrated on making it work for this project – there would be other projects where I could work on a framework!

Because I’d stopped reading and learning I wasn’t aware of new approaches or of new ways of solving problems, I was firmly stuck back in 2004-land but the world had moved on, ORMs were on the rise but I didn’t see them coming; Generics, Lambdas, LINQ were all starting to make a name for themselves but I didn’t hear about them because I wasn’t challenging myself to keep learning, I was stagnating and in mortal danger of becoming a relic from another age. Luckily for me I landed another job and they did things in different ways which meant I had to change what I was doing and as I did that I began to be aware of new things, shiny new things that could make my life as a developer easier. When I stared the Summer of NHibernate series I was a bit sceptical of the approach but after the first presentation I realised I’d been wasting my time for the last 18 months writing all that plumbing code the old fashioned way!

If I hadn’t changed my job I would probably still be entrenched in my old ways but I know better now, I know that just because I’ve written a mail handler script doesn’t mean I should not consider how I can make it better in future. I certainly don’t reach for CTRL+C, CTRL+V very much these days. The sad part of this is that stagnation just creeps up on you, you don’t realise you’re stagnating – you’re just doing what you’ve always done and you’re probably getting quicker at doing it because you’ve done it a thousand times before, you’ve worn a rut in your keyboard with the same code over and over again. Worse than that your brain begins to think this is OK, life is easy why fight it. But you’re losing your edge, new techniques come along that can make you even faster or run your code in ever more efficient ways. You think you’re getting faster but the reality is that you’re faster at doing something that might be irrelevant and employers want current skills. Besides it’s part of the job - learning how to do things, isn’t it?

I’d doing a bit of mentoring these days and that’s another good way to keep challenging yourself. I don’t claim to be the greatest developer in the world, I’m not the fastest but I do love what I do and that passion means I don’t see what I do as work, I’m doing what I enjoy and each day I’m better than the day before – if I can pass that enthusiasm on then I think I’ll have done a good thing.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

January 1026

The trouble with Enums

Tags: | Categories: ASP.NET | Musings
E-mail | Permalink | Comments (0) | Post RSSRSS comment feed

Why are enums so hard to work with? For simple / trivial things, where you want to limit the options available to other developers an enum is a wonderful thing, such as a choice of colours or display modes. More often than not though I find that I need to Parse it in order to do something with it. For example I’m currently working on a project and (for whatever reason) we need to pass the AddressType through the QueryString and then use the value to filter my results. The code to do it looks something like this:

Dim addressType As IAddress.AddressType = CType([Enum].Parse(GetType(IAddress.AddressType), addressCodeParam), IAddress.AddressType)

I’m working in VB.NET at the moment, but in C# that would be

IAddress.AddressType addressType = (IAddress.AddressType)Enum.Parse(typeof(IAddress.AddressType), addressCodeParam);

It just isn’t clean, its hard to remember (which is one of the reasons for this post… so I can always find an example when I need it) and it’s not how I want to work with enums. To be honest I’m not sure how I’d do this differently, I spent too long yesterday looking at this to remember how I thought it should work, I can only see how it does work.

Maybe one day I’ll write a helper method to simplify how I interact with enums

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

January 1025

ASP.NET WebForm ASP.NET MVC debates / rants

There has been a lot of discussion about ASP.NET WebForms and ASP.NET MVC recently. There are advocates of both approaches who passionately put their case or dismiss the other as inferior and there are others who take a more pragmatic approach, recognising that both have their place. In The WebForms Rant Karl Seguin starts out by saying that much of the confusion over which technology we should use comes from...

the fact that there isn’t a consensus amongst respected developers with respect to which of the two is better.

Ideally every developer would take the time to truly understand ASP.NET MVC and compare that with their WebForms experience to come up with their own opinion (and even more ideally we'd all largely agree on the pros and cons). The reality though is that some developers don't have the time or opportunity to take the necessary time to learn a new framework. If we are being completely honest, many developers don't have the necessary skill to accurately judge two competing technologies - maybe they are casual developers, maybe they are new to developing; maybe they come from a different technology. There's nothing shameful about that - in fact, that's how most of us learn.

With that said, should you be using ASP.NET MVC instead of WebForms? The short is: continue using WebForms for any existing projects that you have that are working well (you can define for yourself what "working well" means). Use ASP.NET MVC for any other project.

I think this misses the point, and I’m sure this has been said before, but which technology you use needs to be a decision you make in context. WebForms may not be to everyone’s taste but there is a choice. Scott Guthrie’s article does a great job of making this point and I have to say that I find his take on the debate refreshing, it isn’t a rant, it feels measured and well thought out and (maybe) for that fact alone I think I side with him on this matter.

I often find debates around programming model appropriateness and abstractions a little silly. Both Web Forms and MVC are programming web framework abstractions, built on top of a broader framework abstraction, programmed with higher level programming languages, running on top of a execution engine abstraction that itself is running on top of a giant abstraction called an OS. What you are creating with each is HTML/CSS/JavaScript (all abstractions persisted as text, transmitted over HTTP – another higher level protocol abstraction).

The interesting question to debate is not whether abstractions are good or not – but rather which abstractions feels most natural to you, and which map best to the requirements/scenarios/developers of your project.

I am not trying to single anyone out with this post, I think there are valid points on both sides and I am pleased that there are debates as passionately argued as this - it helps drive us towards better ways of doing things and in the long run that can only be to our advantage as developers.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!

January 1014

Helping to test .NET 4 Beta 2 on Windows Update (WU)

The .NET Framework Setup team have a favour to ask, Scott Hanselman has a post with lots of details (and some nice screenshots) about how to help test the Windows Update for .NET 4 Beta 2, so I won’t repeat them here – I’m just helping to spread the word.

However, so this post has slightly more substance than a link to someone else’s post, this is what you need to do if you want to test the WU install and help make the process run smoothly in future. I have installed this on my home and work computers and no problems!

This is copied from the post mentioned above

The .NET Framework 4 Beta 2 is up on Windows Update for a while for testing, IF you set this special registry key to "opt-in" for the test. Otherwise it won't get offered to you.

If you have a machine that doesn't have any .NET 4 bits on it, make a text file on your system with a name like "NETFX4.reg" and put this text in it:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4B2WU]
"OptIn"=dword:00000001

Then double-click this new registry file to create the key. Then check Windows Update and install the .NET 4 Beta 2 Client Profile. You can also do this key manually if you like.

Don't worry, later in the year when .NET 4 is released, it'll install over the top of your installation and upgrade it. We'd like to get several thousand more WU-based installations in the next few days, so please try this out on any machines, VMs, or other machines you have lying around.

Spread/Promote this post

If you enjoyed this article, consider bookmarking or helping me promote it! Thanks.

  • Del.icio.us
  • Digg It!
  • Technorati
  • BlinkList
  • DZone It!
  • Furl
  • NewsVine
  • Reddit
  • StumbleUpon

Don't miss another post

Subscribe to SJM Dev's RSS Feed to stay updated with our latest articles!