@ayende You ought to try Mercurial. in reply to ayende 1 week ago
06
Jun

How to become a better .NET developer

If I can give one single piece of advice to ASP.NET developers anywhere, it will be this:

Learn another web development environment.

I really can not emphasise this strongly enough. From what I’ve observed, developers who only work with ASP.NET seem to have quite a bit of difficulty thinking outside of the Microsoft box. I am frequently confronted with indiscriminate and even inappropriate use of aspects of the .NET framework that don’t scale, such as DataSets, view state, or drag-and-drop programming. There’s nothing wrong with all these per se, but one of the most important things you need to know about how to use them is when not to use them. When all you have is a hammer, everything starts to look like a nail.

The ASP.NET Web Forms model in particular was originally designed to make web development look like Windows development, and ease the transition for VB6 developers from programming for rich Windows clients to the web. The result of this is that it has made the easy aspects of web development almost brain dead, while introducing a horrendously leaky abstraction layer that makes the hard things even harder, with masses of gotchas and pitfalls to trip you up if you venture outside it.

Languages such as PHP, Ruby on Rails or Python don’t have the same leaky abstractions, so developers tend to not only program “closer to the metal” but to think closer to the metal as well. This is why most of the cool sites, with stunning Ajax effects, tend to be written in these languages and target these platforms, while ASP.NET is largely languishing in the enterprisey world of Dilbert-esque cubicle farms.

I recommend you choose your alternative carefully, however. Rails and Python are the best choices. They will teach you patterns, practices, conventions, O/R mapping, MVC, and all round agile and pragmatic programming, and they tend to be taken up by smart and experienced developers who know what they’re doing. I have mixed feelings about Java: while you can learn a lot from it, like .NET it is very enterprisey, and at a time when everyone is getting excited about dynamic languages, Java is heading in completely the opposite direction. And I certainly don’t recommend PHP as a learning exercise: it is a beginners’ language — and a mind-bogglingly badly designed one at that — and while PHP guys are generally pretty enthusiastic and some of them are quite smart, and there are some decent PHP frameworks such as CakePHP and Symfony, the overwhelming majority of the PHP community simply don’t have what it takes to be programmers. Having said that, you need to know it, simply because it’s so pervasive.

You should also learn Linux if you can. It will teach you about modular design and the value of scripting everything that can be scripted. This is right at the heart of why Unix is Unix: a large part of its philosophy involves chaining text-based programs where the output of one can be passed as the input to another, to produce some fairly powerful command-based functionality, and scripting repetitive tasks so that their outcomes can be reliably reproduced. These are philosophies that seem largely lost in the world of Windows, which relies much more heavily on the visual, drag, drop and click approach of dialog boxes and wizards, even though they are every bit as essential if you want to have robust procedures and practices in place.

And whichever platform you take on board, you simply must familiarise yourself thoroughly with CSS, DHTML, JavaScript and Ajax, and at least one JavaScript framework such as Prototype or jQuery.

Personally, I still think that ASP.NET is technically the best platform on which to develop scalable, high performance, reliable web applications. However, in order to make the most of it, you need to have a good feel for what approaches you can import and learn from other platforms. Otherwise you will be stuck with the limitations and leaky abstractions of Web Forms.

03
Mar

Derailed

This evening, I decided to have another go at Ruby on Rails. I’ve dipped my toe in the water a couple of times but I’ve never managed to spend more than an evening or two on it so far, and I thought it was about time I learned it properly. So I get out my copy of Agile Web Development with Rails and start to work my way through it.

Only to find that putting scaffold :model in your controller — one of the biggest selling points of Rails, and one of the first things that all the tutorials teach you — no longer works in version 2.0. Turns out that it has been relegated to a plugin, which doesn’t work without a second plugin, which I couldn’t get to install.

The new scaffolding doesn’t do what I want it to either. I just wanted to scaffold a new controller and associated views that would work on an existing model. The new approach only allows you to create your scaffolding in tandem with a new model, which is not what I wanted.

This does not inspire confidence. If the upgrade to 2.0 breaks one of the very first things that Rails n00bs like me have to learn, I shudder to think what it does to more advanced functionality.

Can somebody please explain to me why Rails is supposed to be so cool?

04
Oct

Is there a future for Rails?

It seems that interest in Ruby on Rails has plateaued somewhat in recent months. A year ago there was quite a buzz surrounding it, particularly among .NET developers, for whom it has been a rather popular sideline. However, I can’t help getting the impression that the buzz has subsided somewhat recently. Rails may take a lot of pain out of web development, but it has not taken the world by storm.

Why should this be? I think there are several reasons.

First, the business case for Rails always seemed somewhat limited to me. Developers love Rails, but managers tend to be less convinced. The enterprise world is entrenched in Java and .NET, and shows little incentive to change other than a gradual drift from the former to the latter. Successful open source web apps are mostly written in PHP; it seems that several of the most promising looking open source Rails applications, for example Mephisto and Collaboa, are to all intents and purposes dead. The area where Rails seems to be enjoying the most success is in the heady bubble of Web 2.0 startups and venture capitalists, but even then it still has to compete with .NET, PHP and Python.

The second reason is that some copycat MVC frameworks in other languages, such as Cake for PHP and Castle Monorail for .NET, have come on the scene in recent months, stealing a lot of Rails’s thunder. These play much better with people’s existing skills and save a lot of time that it would take to learn a new programming language. They also fit more convincingly into the world of web hosting, which is deeply entrenched in PHP and .NET. And therein lies the third problem: not many web hosts offer Rails as an option, especially on entry level packages, and this tends to be something of a hindrance to the success of open source applications.

Despite all this, I still think it is a good idea to learn Rails, as it will help you to become a better developer. Ruby is a nice language which does very well in terms of elegance, simplicity and extensibility, and Rails teaches you good programming practices from the word go, as well as giving you a solid understanding of the concepts of O/R mapping, active records, the Model-View-Controller pattern and test driven development. And although the market for Rails may not be all that impressive, it is by no means non-existent. It is just that supply is somewhat higher in relation to demand than, say, Sharepoint.

So yes it is worth learning, but I don’t think it is something to spend too much time on. Rails can make a good compliment to your .NET skills, but I don’t think it should replace them.

11
Aug

Online documentation pains

When I’m learning new programming languages, concepts and things, I like to have the documentation available for download as a self-contained unit that I can refer to on my computer, rather than having to connect to the Internet to browse through it all online.

There are various reasons for this. The first is speed: since many APIs are overwhelmingly humungous these days, a quick, easy to use search facility and straightforward overviews and walkthroughs are a must. A .chm file is the best option — you can search it quickly and easily, and it usually doesn’t take more than a few seconds to find what you’re looking for. Individual HTML pages are not quite so good though, since searching is less straightforward. And accessing something on your hard disk is much faster than surfing the web, due to network latency and other similar factors.

Secondly, I prefer to spend the bulk of my time offline to help eliminate distractions. I’m not saying you should work offline exclusively: I have found a lot of help from online resources such as the ASP.NET forums, experts’ blogs, tutorials and the like. However, I do like to be disconnected from the Internet when I’m trying to work my way through some tricky problems. It helps to reduce distractions such as those Wikipedia loops that it’s so easy to get into — you know the kind of thing I mean, where you end up clicking on one interesting looking link after another for a while and suddenly realise that you’ve spent two hours reading a whole lot of total drivel and completely forgotten what you went online for in the first place.

Furthermore, at present at least, we still only have dial-up connectivity to the Internet at home rather than broadband, so going online is slow and cumbersome, though hopefully this will all change after we move house at the end of this month.

A lot of programming languages and platforms do quite well in this respect. The .net framework is a good example: the SDK documentation comes with examples, quickstarts, howtos and API specifications that you can install on your computer to refer to as and when you need it. PHP and Python are also pretty good, with comprehensive, searchable, easy to follow documentation available for download in CHM format.

Java is a bit more awkward. You can download the J2SE and the J2EE documentation, but they are a bit more fragmented, and contain a lot of links back to the web — in particular, from J2EE stuff to J2SE stuff, which is a little bit annoying. I’ve also found Ruby on Rails pretty frustrating. It would be great to have one download that covers both Rails and the Ruby core API, rather than having to go online all over the place, but there isn’t one. You can get a number of CHM files, but they seem to be strewn all over the place and don’t cover everything. This is a real shame, because I would love to be able to get my teeth into Rails in my spare time, and it seems that you can’t do that quite so effectively offline.

Still, at least the documentation is comprehensible and reasonably structured, which is a lot more than can be said for Perl. I really, really hate the Perl documentation. Look at the index, for starters — a list of cryptic, obfuscated and sometimes downright misleading names such as perlboot, perltoot, perllol, perlre, perlrun, perlpod. I can just about make sense of it, but it takes twice as long to find what you’re looking for as anywhere else. To a beginner, it is probably the most confusing, incomprehensible and intimidating mess you are ever likely to encounter.