Code

Curb stomping code readability

I have many reasons for loving Python, but I think my favorite aspect of it is the inherent readability of the language. I mean, you really have to work hard to make your Python code unreadable (though, people mis-using decorators can make otherwise readable Python code extraordinarily unreadable...)

The thing about Python is how hard it can make working with other languages once you've fully ingested the Python kool-aid. The many aspects that make Python such a wonderful language to work with really amplify related weaknesses in other languages. For example, I always had complaints about Java, but I couldn't completely articulate my biggest complaint (how hard it is to make readable Java code) until I worked with Python for a few years.

Well, for the last two years I've been working the majority of my time in C# (doing games for Funavision). I have to say, I really don't mind C# as much as I expected I would- while it is obviously C/C++ and Java inspired in many ways, it has a good deal of sanity to it that reduces my frustration when working with it. It also helps that Visual Studio has handy features that make working in the language even easier.

However, it still has the big problems associated with making readable code. Inconsistent syntactic sugar (see C# switch/case), ability to hide entire code segments in property get/sets (grrrr), "Interface" objects that are supposed to be method free but which can still contain method-like code (see get/set previously), etcetera are all examples of language hurdles to readable code.

Well, a while ago I came up with what is probably the least readable C# code I've ever done. I'm not proud of it... but I've decided to share it anyway...