Yearly Archives: 2007

A New Website

I’ve spent the past day putting together a site called FindMUD. It’s pretty similar in concept to The MUD Connector, but done in my own way. I’m not sure the world needs another MUD listing site, but it was fun to create. Each listing can be rated by users, so as the site develops you’ll be able to get a pretty good picture of what the best MUDs are.

Feel free to visit the site, create a login, and add listings for your favorite MUD(s). Let me know what you think of the interface and whether I left anything important out of what is asked for when submitting a new MUD.

Since the site is brand new (only 6 listings so far!), I’m sure there will be plenty of room for improvement.

A Pretty Good Chunk

Compile errors are now down to 3,293.

It feels a little strange to re-implement some of the core C-language character functions in C#.  Things like isdigit(), isspace(), and isalpha() are easy enough to rewrite, but there’s just something a little surreal about it.

Only A Stupid Programmer Would Try To Be Clever

Huh?

It takes an insecure jerk to write a clever line of code like this:

x?x=y=z=0:x=y=z+2;

What does it say? If X is true, set X, Y, and Z to 0, but if X is false, set X and Y to Z+2. It’s a shortcut written by someone who thought they were being clever. To an experienced programmer it’s readable, but still a little uncomfortable to deal with if you’re trying to trace a bug. The longhand version would be something like (note descriptive variable names):

if( LeftPosition != 0 )
{
LeftPosition = 0;
MiddlePosition = 0;
RightPosition = 0;
}
else
{
LeftPosition = RightPosition + 2;
MiddlePosition = RightPosition +2;
}

(Irritating failure to indent courtesy of WordPress.)

It’s longer to type, but a casual reader is more likely to be able to understand the code at first glance without having to re-read or decipher it.

If you read through any sizeable codebase you’ll find a ton of things done just for the sake of being “clever”. A lot of these are shorthand or obfuscation that has no real purpose since the compiler will generate the same executable code in most cases.

I think it boils down to insecurity. Programmers who don’t have much confidence in their abilities try to be clever and show off. Skilled programmers know a fundamental point about writing code:

Not everyone is as smart or skilled as I am, so I need to make this as simple and readable as possible.

Keeping this point in mind often results in code that is easier to debug, better-commented, and simpler to read.

Cleverness is quite possibly the number one reason why people prefer to scrap and rewrite a codebase rather than fix the problems in it. Code is easier to write than it is to read, and if it’s made all that more unreadable by an ineloquent programmer, then it’s less likely to stand the test of time.

Be a real programmer. Write simple, clear, understandable code. You will have to read your own code someday. Do you really want blood to shoot out of your eyes when you try to read it?

For further reading, check out the infamous “How to Write Unmaintainable Code”.

A Custom Client

I don’t believe I’ve mentioned it here yet, but around 2005-2007 wrote a custom MUD client using wxWidgets and SDL. It runs fairly well on Windows and tolerably on Linux (there are one or two glitches). I designed it to work with Duris and its prompt system. It shows maps for a zone if they’re available and keeps track of hits, mana, and moves via a meter system. The graphics are pretty simple, although I had planned to improve them a bit. This program was written from scratch and could form the basis for a custom hybrid 2-d/text-based Basternae client at some point.

Here’s a screenshot (while playing Duris):


(Click to enlarge)

Another Good Chunk

Down to 4,539 errors.

Most of the rest of the errors to be squashed are going to be pretty involved, so I expect slower progress for a while.  Even so, we’re not too far from zero now.

Just 100

The error count is down 100 to 5,704.

I spent this week sending out the second and last issue of my fantasy/sci-fi magazine, All Possible Worlds. Although I run a dozen or so other websites, I might be able to put more time into the Basternae code without the magazine stealing my time. It is/was a pretty cool little magazine, but it’s a massive drain on the time and finances to run.

A Tiny Update

The error count is now down to 5,804.

Working on the Basternae code is a lot of fun, but I don’t get as much time to do it as I would like.  Even so, at least progress is being made.

Slow Moving

Haven’t been able to spend too much time on it lately, but the code is now down to 6,470 errors.

One thing I have been able to do a bit of lately is read a few more programming books. I’ll have to post a few comments on them one I finish what I’m reading now.

Errors: Halved

After a handful of changes, the number of errors is down to 7,173.  That’s less than half of what we had during the last report.

Most of the fixes were ‘invalid argument’ fixes (function calls for ref ClassName, but called without the ‘ref’).

Spatula? No Thanks.

The errors count is now down to 14,887. The more time I spend with C# the more I develop a pure loathing for raw C. Programming with C is like trying to chop down a tree with a spatula. Sure, you could probably manage to get your way through the tree, but it’s going to be a long, messy, painful task.