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 1024x48000 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.

Continue ReadingCode Folding…

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 will be able to call themselves an astronaut. (more…)

Continue ReadingFirst private Astronaut…

Semi-annual hacking…

This site was down most of today. I apologize for that. I spent most of today, probably 6 or more hours, fixing up this server after one of my web sites here was “hacked”.

The hacking itself was pretty minor- someone just altered the contents of a couple of pages to include their names and indicate their amazing credentials. The way they did it was also fairly simple- they took advantage of a known flaw in some software I was running. (more…)

Continue ReadingSemi-annual hacking…

Computer Upgrade 2004 begins…

I’ve started my semi-annual computer upgrade process. I’ve opted for an AMD 64 configuration this time, the first time that I’ve selected a non-Intel processor for my main computer gaming rig.

 I’ll eventually be writing a little article on the topic, but for now you can check out some pictures I’ve taken during the initial assembly..

(more…)

Continue ReadingComputer Upgrade 2004 begins…

Abbotsford Airshow

My friend Chris was out visiting this past week (he just went home yesterday). While he was here, in addition to several movies and a dozen hours or so of computer gaming, we went to the Abbotsford Airshow.

I planned on taking a bunch of pictures, but unfortunately I hadn't properly charged my camera. As a result, I only got a few. I've included a bunch of Chris's pictures to round out the selection. Here is a nice picture of a couple of "aggressor" camouflaged F-5 Tiger jets: click on the picture to go to the gallery folder with the airshow pictures.

What is it about military hardware that interests me? I'm not a violent person. I certainly don't support the use of military force unnecessarily, although I respect the men and women who stand in harms way when it becomes necessary.

Whatever it is, I like to walk up close to something that can travel at supersonic speeds...or fire thousands of rounds per minute of depleted uranium shells into any unfortunate tank or other target that gets in the way. Or that can hover safely over rough seas to lower rescuers and pull survivors to safety.

The unique sound of a jet approaching the sound barrier as it roars in from behind the viewing line is one of those things that lives on in memory for quite some time. The Voodoo had its own unique "song", quite different from an F18 or Harrier. But aside from all the hardware, its interesting to note that the people who fly and maintain these aircraft are, after all, real people. Young folks with a bit of swagger fresh out of intensive training, old pilots with thousands of hours of flight experience and combat experience, people with greasy hands and smashed fingers from handling heavy parts under tight schedules. All "just people", who'll talk if you catch them when they can. Even the one's who've flown in space.

I enjoyed the air show, rain and all. I'll be happy to go back again next time!

Continue ReadingAbbotsford Airshow

End of content

No more pages to load