Monday, March 29, 2010

Private Data, Getters, Setters, and the Like

I'm not sure that I'm getting the rationale for class-level private declarations. Given that public "getters" and "setters" can access and even alter private data, what's the use of the private declaration in the first place?

Making data members private allows us to control access to them. First, most (probably) classes don't have setters and getters. Second, setters and getters can be instrumented so that accesses and changes can be tracked, logged, etc. This instrumentation can be useful for debugging. If a private field is getting set to a bad value, one just has to put debug code in the setter rather than hunting down every line that modifies the field.

Another reason, probably at least as important, is for maintenance, upgrades, etc. If I implement a structure with a private array today but later decide it should be a set or a list, I don't have to worry that the change will ripple through client code, breaking the installed base.

Finally, a class interface should have a specification, or a contract. If private data is being modified outside the class, it's not possible for the class to enforce the contract, and debugging the class spreads out from the class itself to the entire system. This complicates development and maintenance.

[suggested by a colleague an hour after I posted the above]
Setters can validate data, making sure it's in the correct range, consistent with other values, etc., before setting the field.

Sunday, March 28, 2010

Matt Curtain Presentation on Open Source

Matt Curtain has an interesting little presentation on open source. He makes a few points concisely that I haven't seen expressed better anywhere. There's a considerable argument by analogy component, but it's stuff worth thinking about. There are also a few abbreviations with alternate definitions that I hadn't seen.
  • OSF == Open Software Foundation == Oppose Sun Forever
  • PC == Pee Cee
  • An entire industry based on FUD.
  • Science depends on peer review, and engineering is applied science.
  • Gains of open source over closed source are the same as science over dogma.
  • Experts can verify claims rather than accepting vendors' "trust us."

The slides.

Tuesday, March 9, 2010

Marketing Programming Languages

Finally we have excellence in marketing programming languages:

Also, HiPE is not just hype misspelled.

Monday, March 8, 2010 Security FAQ

From How secure is it?
Your CLEAR connection is very secure. Unlike WiFi, CLEAR technology uses a licensed 2.5 Ghz frequency and OFDM transmission protocol for a very secure connection.
The combination of licensed frequencies and OFDM technology provides a very secure connection.

This is a very strange statement, since neither the frequency nor how it's multiplexed have anything whatsoever to do with security. Their customer support says the link is encrypted, but the web site makes no mention of this.

Saturday, March 6, 2010


I recently bought an Asus CG5275 to replace a nonoperative HP Pavilion p6130f which I bought in October. Yet another piece of evidence that HP no longer produces quality electronics. The Asus is a good machine, but uses the new Intel Core i5 with integrated video, and until this week Ubuntu 9.10 didn't support the video, so that was dicey at first. Now that the video works and I've removed the poorly-conceived door covering the front USB ports, I'm happy with it, though the fans hum fairly loudly.

That door: I'm not the only one to remove it. Among other things, there are four USB ports behind the door. The two lower ones are inaccessible with the door in place, and the upper two are very difficult to get long USB sticks in and out of. So my choice was to remove the door or plug in a USB hub. Removing the door doesn't add to my electric bill.

Actually I'm not a fan of the doors in front of the CD/DVD drive and empty bay either, since they hide activity lights. HP does it too, and I think that's the way of the consumer electronics market: style is much more important than functionality.

Wednesday, March 3, 2010

Management is an 1850s Technology

"Management is an 18050s technology" -- Daniel Pink, WYPR's Midday with Dan Rodricks, 3/3/10.

In the same segment, Pink suggested that we call the bankers' bluff that without large bonuses they'd suffer huge turnover.

Spammers Protecting Selves from Spambots

It's pretty rich that a spammer such as DAMD would attempt to protect their e-mail addresses from spambots attempting to scrape their site, when it seems pretty likely that's how they pick up the e-mail addresses they spam.

DAMD, the International Conference on Data Analysis, Data Quality & Metadata Management, is following an annoying trend of other perhaps legitimate conferences of using mass mailings to publicize their events. DAMD is a bit different in that they don't provide an unsubscribe link, but, really, should one click unsubscribe links and confirm the spammers' success at reaching a victim? Usually not.