Tsunami…

I recall reading years ago about the potential destructiveness of a tsunami. Naturally, the speculative scenarios were somewhat sensationalized: 1,000 foot waves washing over the east coast of the good old USA...that sort of thing.   Now we have the reality. A 30 foot wave washes over Sri Lanka, India, and other "3rd world" nations. 2,000 estimated dead...5,000...20,000...60,000...120,000. And thousands more no doubt yet to be found. Big sigh of relief: only a handful of North Americans dead! Thank the Lord! Better send some charity over there...how about $30 million?   I look at this series of events and questions arise in my mind.  

  • Why is it when North Americans die, the estimate of death is usually higher than reality? When the trade centers fell, 10,000 people were estimated to be killed...the reality was less than 3,000. Yet third world nations seem to always report numbers woefully below the reality
  • How can we feel good about the fact that we are sending a few tens of millions over to the "poor" people in India and Sri Lanka? 120,000 foreigners die, we toss over $50 million or so. When 3,000 Americans died, the U.S. spent $100 *billion* on getting some kind of revenge...not against the people who committed the crime, but against a leader who maybe helped the people who committed the crime. To put that in perspective: per person, the implication here is that an Indian flood victim is worth about $400, whereas an American victim of terrorism is worth $33,000,000. Seems a bit out of whack to me.
  • The awesome destructive force of nature puts our pathetic squabbles to shame. I believe that the 8.9 richter scale earthquake that started the tsunami expended energy equivalent to well over 60,000 one megaton hydrogen bombs...probably closer to 100,000. That's an energy release equivalent 100,000,000,000 tons of TNT
  • Just before Christmas, a near earth orbit object was identified as meriting "significant attention" (4 on the Torino scale...about a 2% chance of hitting based on data available at the time)...MN4 is 300 metres in diameter: if it hit it would release energy equivalent to about an 8.6 on the Richter scale. 23 years away from potential impact, that sort of thing is a threat we might actually be able to do something about...if we could quit fighting amongst ourselves. And I don't mean "all become good Americans"... The threat of the object (MN4) hitting has been reduced to "normal" or 1, by the way- observations provided better data to reduce the threat
What's my point? I'm not saying I have one...not every discussion needs to have a point. I'm more interested in thinking and using logic then in standing on a soapbox and shouting. I think if I have a point its this: we are quick to spend time and money to get revenge or cause more death, but far less prone to just help each other out. This makes me think we have some room for improving our society.

Continue ReadingTsunami…

Moon Landing Conspiracy!

The Apollo moon landings were all fake. If you believe that, I imagine you also believe that Santa lives at the North Pole, and all Politicians are always scrupulously honest.

Not to be dissuaded by facts or logic, there are still a surprising number of people, most of whom have not had lobotomies and aren’t permanent residents of mental institutions, who believe that the moon landings are fake. But, I suppose they are welcome to have their stupid, pathetically innane, and completely wrong theories. (more…)

Continue ReadingMoon Landing Conspiracy!

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…

End of content

No more pages to load