Tuesday 17 May 2011

Three things I wish someone had told me before I started mountain biking

I started mountain biking about a year ago after being forced to stop playing basketball because of a horrific knee injury. I'm only joking it wasn't horrific at all, just mildly inconvient. I learned to ride, as a lot of people do, when I was a kid. So I've been able to ride for years, this being the case I figured I'd be able to ride down (and up) a few hills no problem. How could I be so wrong? Turns out mountain biking requires a huge amount of skill, of which I had none. I spent the first few rides clinging on for dear life, falling off and generally being very scared. 

Several changes of underwear later someone lent me a mountain biking book. Within was some information I really wished someone had told me. If you had been in the room when I was reading said book you would have seen a light bulb appear above my head. Of course there's a lot of things you need to know, but for me there are three key points which you really should know before hitting the trails. 

  1. Always look down the trail. This is key in two ways. Firstly and most importantly you naturally go where you are looking. Most beginners, including myself, look at objects on the trail they want to avoid (rocks, tree roots, squirrels etc.) and end up hitting them. Secondly you don't focus on what you're riding over. I used to concentrate on every bump, rut and rock on the trail and there's no need. You need to be aware of this stuff but don't focus on it, your bike will ride over it.
  2. Keep your weight over the cranks. First time I rode on a trail I jammed on the front brake while going down a hill, my weight was too far forward and needless to say I fell off in a hilarious fashion. Turns out you should lean back when going down hill and lean forward slightly going uphill. One way to think about it is that you should always be able to draw a vertical line through your centre of gravity and the cranks (this better explained with a diagram to be fair).
  3. Keep off the brakes. I still use the brakes way too much. Excessive braking is bad for two reasons; firstly, it sounds pretty obvious, but it stops the wheels turning which makes your bike more difficult to control. Secondly when you brake your weight is thrown forward forcing you to compensate with your arms and legs which means your riding position isn't as relaxed and natural as it should be.
With these three points in mind mountain biking became considerably more fun.

Wednesday 11 May 2011

Java versus .NET for web applications

Over the past few years I've come to believe that when building web applications in fairly small teams, .NET has the edge over Java. I have come to this conclusion having started my career using Java, then subsequently moved on to .NET, all the while working on web applications in small teams. Please understand that while I'm going to favour .NET here, I don't dislike either technology. I believe, as with all things in software development there are pros and cons and the choice should be justified by the people involved. 

To explain what frustrates me about building web applications with Java I'm going to run through some of the steps that would be required when starting a project from scratch with both Java and .NET. These steps are by no means complete, they are purely used to make a point.


Java

  1. Download and install an IDE (I am assuming that the IDE comes with the required Java run times). Which IDE to download? Eclipse is free and very good, but which version do you download? The full one with all the whizzy bits, or the simple one and try and only download the plugins you think you'll need separately? I always found the second option an nightmare. Or do you go with a paid version such as MyEclipse? Or do you avoid the Eclipse route and go for NetBeans, or maybe IntelliJ IDEA?
  2. Install a web server. When I last used Eclipse, a few years ago now, it didn't come with a built in web server, so you need to install one. Again, it's another decision. Apache? GlassFish? JBoss? 
  3. Configure the web server to work inside IDE. You want to be able to start the server and your web application at the click of a button, I always found configuring something like JBoss to work with Eclipse was a headache
  4. Configure IDE/web server to allow debugging. Another annoying task
  5. Choose a web framework. Major headache! There are a huge number of frameworks. Off the top of my head some of the options are Struts, Struts 2, Tapestry, Wicket, Spring, Stripes and Seam. Which one do you choose? Do you have experience of each framework? If not how do you make an informed decision?
  6. Install and configure web framework
  7. Identify, download, install and configure and additional components. For example I always used Sitemesh for implementing consistent site layouts in Java which is extremely important if your chosen framework does not support a layout mechanism

.NET

  1. Download and install an IDE. So, that'll be Visual Studio then. If you using .NET in a professional environment you'll have to pay, in which case you've got a fairly simple choice of package based on the functionality you want and the amount of money you're willing to spend. If you want to use the free version simply download the version that is relevant to the work you want do to. All versions come with a built in, pre configured web server which has debugging enabled. Plugins are available and useful, but my no means required
  2. Choose a web framework. I imagine most developers will choose either Forms or MVC. If you want testability and modularity then MVC is the way to go. If you're not bothered and want to knock up an application very quickly and easily Forms is fine
  3. Identify, download, install and configure and additional components. Out of the box .NET frameworks have a huge amount of functionality but there's always things that can be added

Boiling this down to a statement; Java gives you less functionality out of the box but provides you with more choice whereas .NET gives you more functionality out of the box but with less choice. It's the choice that I have a problem with. I used to think choice was great, but, after hours of research into Java frameworks and Java IDEs I've decided that too much choice is bad. I spent hours trying to figure out which IDE and framework was best before realising that the only way to find out is to use one for an extended period of time. Too much choice also dilutes the amount of support you get for each option. Take web frameworks for example; I've no idea how many people use .NET and how many people use Java, but say for example that 100 people use each technology. For .NET say that 50 people use Forms and 50 people use MVC. For Java, based on the number of frameworks I could think of off the top of my head (seven), say that about 14 people use each. I know these numbers are nonsense; my point is that because there is so much choice it's likely that far fewer people will be using any one Java web framework so the support for it will be significantly less. This is true in my experience. I often struggled to find help with problems using Struts and Struts 2. With ASP.NET I find there's rarely a problem that someone else hasn't already had and posted a solution for. 

To summarise my experience, I'd say that you can get up and running much more quickly with a .NET web project then you can with a Java web project. There's far more functionality out of the box when using .NET, far less configuration and considerably more support. So if you're happy to cough up the money and you're willing to using Microsoft products .NET is the way to go.