Apple's sloppy widget JavaScript code

HateEternal

Mac Metal Head
I noticed that some of the JavaScript code that shipped with Tiger's widgets is very sloppy. Generally we got yelled at for stuff like this when we turned in projects in all the programming courses I took.

Not really a big deal or anything. It just seems weird that there is all sorts of debug code commented out in production code.

From AddressBook:

Code:
function onShow()
{
	//alert("JS: onShow()");
	//AddressBook.widgetDidShow();

    abCurrentCardIndex = AddressBook.searchForString(savedSearchString);
    refresh();
}

Code:
function onHide()
{
	//alert("JS: onHide()");
	AddressBook.hideLargeType();
	//AddressBook.widgetDidHide();
}
 
Well, it could possibly be there for the benefit of people writing widgets. People tend to look at working examples to create their own, and that clues you in to the fact that there are some debug things you can use while developing.

Other than that reason, I wouldn't know why it was left in. Maybe it just wasn't a priority in the rush to get Tiger out. Who knows?
 
Just ran 10.4.1 update and it's still in there (Address Book widget got updated). Personally I think this is a Good Thing (TM), because it helps others who want to write widgets to use good debugging practices.
 
I agree with HateEternal. You help other programmers by documenting your code. Looks to me like debugging code that's been left in. My bet is that the team that made it either shipped an early version or, more likely, just didn't have time to
//alert("find funnier analogy");
sweep the sawdust off the shelves after the cabinet was made. Macromedia's Flash components are absolutely packed with stuff like that. I swear, there's something about Javascript programmers....
 
Back
Top