Monday, December 07, 2009

realisation - its all about knowledge

Last week I attended the - codefest event, Matt Lacey set us all a task to build a competitive Connect4 player to compete against each other and a 'Random' player he wrote, we had 2 hours.

Seemed like an easy task, use visual studio to build a .dll that can beat the pants off the other developers attending - simple, bring it on.

This is when I realised, that after 7 years of programming, that I had forgotten a lot of my windows forms days (desktop software).

Web vs Windows
Now if the code is the same, the data is the same and the architecture is similar (more so now than when I started), what was the problem? - one too many pints before we started (nope).

Using a stateless environment (the web) to run my systems has made me far too reliant on session variables, view state bits'n'bobs etc.
The fact I had no data source of any kind to store any data in threw me, how would I know where the connect 4 pieces were, let alone who owned which piece. How would I count to 4 in any direction ... aaarrgghhhh I need a session.item()!

After much playing and re-coding, all while running the clock down, I ended up fudging the code to play a set stratedgy of moves, all dependant on where the last piece was played. Not good code and well embarrassing. With everything hardcoded I was a sitting duck for an intelligent player.

I lost by the way, full credits went to someone who knows far more about desktop software than I do!

The blackhole of knowledge between web and desktop publishing is not a big one, however I think to hop from one to the other without thinking about the two is something I am gong to try and tackle over the next few months.

It is so easy to get into a comfort zone of code, I know all of my code and what is possible to do within a web environment, but throw me a windows app and I really have to think about what I have to do and what can and cant be done in that environment.
There is no easy step-by-step to make this transition easy, it is hands-on process, you make a mistake and fix it.

I found it really interesting to hack my way through Matts project, I do think that I have forgotten more about developing for windows than I would care to remember.
A humbling experience, it's the small things that make you sit back and think!

Thanks to Matt and everyone else who thrashed me at devevening, look forward to seeing everyone next year on Jan 28th!

1 comment:

Matt Lacey said...

Glad you enjoyed it and thanks for sharing your feedback.
I'd hoped by putting everything in memory it would remove any barriers due to the platform anyone was familiar to working with. I guess that wasn't quite the case.
Part of the aim of the exercise was to see how different people approached the challenge, the issues they had, and how they overcame them.
I guess highlighting how you get used to working one way and then comparing that with how other people work can be a good thing if you learn from it.
Maybe next time we'll do something web based.