Recent Comments

Code Folding…

I am a programmer. I wouldn’t consider myself to be a “master” programmer, but I think I write pretty decent stuff when I get going. I also occasionally cut corners and write quick and dirty “hacks” to solve a particular problem or to test something out. I sometimes feel guilty about this, but then I read findings from interviews with master programmers, and I discover that they often write ugly but useful hacks as well…

I used to be a procedural programmer, with languages like C and Pascal. Now I’m migrating to object oriented languages. And I stumbled across a little article about the the bad side of code folding.

Code folding is a really simple concept with a mysterious sounding name. Basically, it allows you to group a section of code together in an editor and “collapse” it, hiding all the nasty bits. I discovered code folding in the Visual Studio .Net integrated development environment…

…where it is used without user intervention every time you write an application with a user interface. Microsoft automatically uses code folding to hide a bunch of control objects so they don’t clutter things up.

If you read that article in the link above, you would have heard the opinion of Matt Stephens, a fellow about which I know pretty much nothing. But his article is well thought out, and made me stop and think about what I use code folding for.

The answer is I use it almost not at all. But I do find it very handy when I do use it. Not because I write huge, “one method to rule them all” code segments. Personally I kind of like a method to never be much longer than one screen full…and no, I don’t have a 72″ portrait monitor with 1024×48000 resolution.

Instead, I use code folding or “collapsing” as a way to focus my attention. I might have 10 methods in an object. Nine of them are debugged and working happily, and the tenth is causing me some grief. I create a code section to conceal the “functioning” code and hide it so that I don’t get distracted by the other bits.

Does this make me a bad programmer? I don’t think so. I know I’m still pretty early in the migration from procedural thinking to object oriented thinking: I still struggle at times to break old habits, and I need some peer code reviews to continue my improvement. But I don’t see code folding as a sin. Like a lot of things, including object oriented development itself, it has its good and bad points.

In fact, one could argue that code folding is a true and proper outgrowth of object oriented programming. One of the key values to OO, or so I’ve always thought, is the promotion of idea of objects being “black boxes”. That is, I really shouldn’t be spending my effort as a programmer figuring out how an existing object works: I should know what properties it has, and what methods I can invoke or inherit and what they do, and that it works. Beyond that, I should just use the dang thing.

Extending this to its logical extreme, within my own objects I shouldn’t be continuously re-figuring out methods that I’ve already written. If they work, and I know what purpose they have and what properties or parameters they manipulate/use, then I shouldn’t be messing with them. I should be working on one code element at a time, refining each in term in isolation from the next. Code folding can, used properly, encourage that kind of thinking.

I suppose I could be missing something here in my thinking. And I’m open to contradictory opinion. But I’ll continue to use code folding from time to time, and I don’t plan on feeling guilty about it. […]

Thief III: Deadly Shadows

First off, I should point out that I’ve never played any of the other Thief games. But I have read about them. The “thief” in the game is one Garrett, a mysterious fellow adept with a lock pick, bow, or blackjack. Garrett’s place is in the shadows: the Thief games are first person sneakers, which basically means that you are better off skulking past trouble rather than running into it head on.

So, with the stage set, how was the game? Graphically, Thief III is top notch. Lighting and shadow are, not surprisingly, very important in this game, and are rendered well. The moonlight shining through a window produces diffuse beams of light with motes of dust…its actually quite pretty. Sound is also very important: much of the time, Garrett is hiding in a corner and risking a peek at the nearby guards could be deadly. But hearing the footsteps as the guards complete their rounds is nearly as good as seeing the guard.

The hard part with a sneaking game like Thief is the AI…

… and I am happy to say that Thief III does an excellent job in the “smarts” department. The guards have nice, regular “beats”, but if you (or someone else) makes an unusual noise, they are off to investigate. When searching, they are more sensitive to new noises…this leads to tension and makes the whole “sneaking” process seem real. And guards aren’t the only citizens of the city Garrett plys his trade in. The shop keepers, bar maids, and others wander the streets, react to unconscious bodies and blood, and fight (or run away screaming) from the baddies unleashed as the game progresses.

And this variety of “background players” is something that really sets Thief apart. Unlike a lot of games in the “action” metagroup, Thief III places you in a environment that has more to it than just the next linear objective. The guards, shopkeepers, citizens, and two main factions in the city aren’t really part of the “core” story at all, yet they can help or hinder you at every stage. Need some spare cash to buy equipment for the next mission? Maybe that wealthy noble walking by with the heavy looking purse can help out. Or perhaps you’ll overhear a conversation about something worth stealing.

And those factions I mentioned? Well, the citizens themselves have their own enemies and agendas…regardless of what Garrett is doing, fights and battles will break out, attracting the attention of less politically inclined citizens. And as the plot progresses, even some of the “monsters” start mixing it up with the the townsfolk- there were a couple of running battles that kept me pinned in the darkness for long periods of time. The deathtoll was astounding, ordinary citizens were running around screaming and trying to hide…not big crowds, mind you, but enough action to make the situation complicated and interesting.

Despite his preference to keep to the shadows, Garrett isn’t completely unable to “mix it up”. In a pinch, in perfect health, he’s a toe-to-toe match for an ordinary armoured guard. And if killing is your style, Garrett can snipe from a distance with his bow, or sneak up behind someone and use his dagger very effectively: the only “downside” is the blood left behind, which can attract unwanted attention. Other weapons you’ll discover include landmines, knockout gas, and several “utility” arrows to put out lights or silence footsteps over otherwise noisy floors. I won’t reveal anything to speak of regarding the main plot. It has plenty of twists and turns and, for me at least, was quite engaging. On normal difficulty, the game took me about 30 to 35 hours of play time to complete. That’s using plenty of save games and quick saves, both of which Thief supports in unlimited quantities. Levels load somewhat slowly, as do save games, but performance is overall quite good. Bear in mind that my normal gaming station is fairly powerful.

All in all, I was very pleased with Thief: Deadly Shadows. I’d give it a 93 out of 100 on the Kelly rating scale. […]

First private Astronaut…

On June 21st of this year, Scaled Composites plans to launch the first privately funded passenger carrying craft to enter “space”. The ship, named SpaceShipOne, will climb to an altitude of 100 km (62 miles), the official boundary where “space” begins. For the first time, someone outside the circles of large, government funded projects […]