Book idea

Having just glanced at the clock, now is the ideal time to post about an idea I had a little while ago – a book (or blog, or something) about C# (or maybe C# and Java) which I’d only write between midnight and one in the morning. It would contain only those things which seemed like really good ideas at the time – but which might seem insane at other times. Most of these ideas are probably useless, but may contain a germ of interest. While I don’t always have those ideas between midnight and one, that’s the time of … Continue reading Book idea

Yay! I’m not the only one who doesn’t like designers…

For a long time I’ve disliked “designer-generated” code. My preference when writing a Windows Forms (or Swing) app is to work out what it should look like on paper, possibly prototype just the UI in a designer (for the look of it, not the code) and then start with an empty file for real code. That way, I can end up with a UI which is built up in logical stages (significant UI construction often takes several hundred lines of code – it’s handy to be able to put that in multiple methods with descriptive names, etc), can have code … Continue reading Yay! I’m not the only one who doesn’t like designers…

Corner cases in Java and C#

Every language has a few interesting corner cases – bits of surprising behaviour which can catch you out if you’re unlucky. I’m not talking about the kind of thing that all developers should really be aware of – the inefficiencies of repeatedly concatenating strings, etc. I’m talking about things which you would never suspect until you bump into them. Both C#/.NET and Java have some oddities in this respect, and as most are understandable even to a developer who is used to the other, I thought I’d lump them together. Interned boxing – Java 1.5 Java 1.5 introduced autoboxing of … Continue reading Corner cases in Java and C#

A short case study in LINQ efficiency

I’ve been thinking a bit about how I’d use LINQ in real life (leaving DLinq and XLinq alone for the moment). One of the examples I came up with is a fairly common one – trying to find the element in a collection which has the maximum value for a certain property. Note that quite often I don’t just need to know the maximum value of the property itself – I need to know which element had that value. Now, it’s not at all hard to implement that in “normal” code, but using LINQ could potentially make the intention clearer. … Continue reading A short case study in LINQ efficiency