Read the full article at TidBITS, the oldest continuously published technology publication on the Internet. To get a full-text RSS feed, help support our work and become a TidBITS member! Members also enjoy an ad-free version of our Web site, email delivery of individual articles, the ability to make long comments with live links, and discounts on Take Control orders and other Apple-related products.
Read more of this story at Slashdot.
I'm a Knicks fan. I spent the winter in denial, but gradually as the season progressed, I realized I was following them more closely than any other team. And identifying with their ups and downs. And this year of course it's been mostly downs. It's okay. I was a Mets fan too. ;-)
I have some weird theories about the fortunes of the Knicks. I think last year they did well because they had Jason Kidd at guard. It seems like a very long time ago. This year, they have a void at point guard. And their star, Carmelo Anthony, needs a great point guard to work with. Pretty simple reason for this. Someone has to know who else is hot on the floor and make sure they get the ball almost as much as Melo. Otherwise the other team just double or even triple-teams Melo. It's easy to defend a team that has just one shooter, even if he's the best shooter in the league, as it is pretty clear Melo is (either #1 or #2).
But Kidd turned 40 last season, so they knew it couldn't last. If Melo had been a bit more open-minded, I think he would have seen that Lin, with his eyes and his sharp mind, would have been a good student of Kidd's and a good distributor of the ball for a team that tends to rely too much on Melo.
I think this is a lesson for everyone in business or sport, anywhere creativity and seizing the moment matters. Don't always look for the answer where you expect it. Lin wasn't one of Melo's classmates from 2003. Melo is a superstar. But he could have forged a partnership with Lin, made him his little buddy, and and built from there. It's amazing to see what Houston was able to do with creativity, and how it led to their signing of two players who, if they were playing with Melo, might have made New York, along with Anthony, a championship contender. The Knicks might not have been able to afford Dwight Howard and James Harden, but then New York is the center stage in the basketball world, and Houston is a backwater. But they're a backwater with a team we would love to have in New York.
I’ve seen some feedback that suggests I don’t need to use a custom notification for when the sync server triggers the deletion of a note.
In general, it’s best just to watch for model object changes, via an NSFetchedResultsController, KVO, or other means, and then do the right thing.
While I agree with the general case, there are times when that’s not going to do what I want.
Consider again the case of a note displayed in Vesper’s detail view. There are two cases where it might get deleted:
User taps the trash button.
Sync server tells the app that the note was deleted on another device.
In both cases, the note gets deleted. But what if we want to have different behavior for the second case?
It would be easy to justify the following behavior: if the person is now editing that previously-deleted-elsewhere note, then that person implicitly wants that note not to get deleted.
So that note would get un-deleted. (Technically implemented by making a copy of the note with a new ID. The user wouldn’t be able to distinguish that from un-deletion — it amounts to the same thing.)
If I just watched for the note to be deleted, if I just watched the model object change, I wouldn’t be able to distinguish one event from the other. (And I couldn’t make the copy, since it would be too late at that point.)
* * *
Syncing adds a bunch of cases like this. Consider the simple case of what happens when the text changes for a note.
note.text = updatedText;
As with deleting, I have to distinguish between a user-generated change and a sync-server-generated change.
If it’s a user-generated change, then I also have to set note.textModificationDate to the current date. The client then knows it needs to send the change to the sync server.
If it’s a sync-generated change, then I have to set note.textModificationDate to whatever the sync server says it is.
The same pattern holds for a whole bunch of note object properties.
I have not found a great pattern for this. What I do is have methods on the note object like userDidUpdateText: so I can distinguish one change from another.
Let there be no doubt: this is a pain. (But, to be clear, it’s not a Core-Data-specific pain.)
In the happiest world there is no need for custom notifications or methods like userDidUpdateText — I’d just observe model objects in the normal ways and everything would work.
But syncing is the meany. Syncing is why we can’t have nice code.
Read the full article at TidBITS, the oldest continuously published technology publication on the Internet. To get a full-text RSS feed, help support our work and become a TidBITS member! Members also enjoy an ad-free version of our Web site, email delivery of individual articles, the ability to make long comments with live links, and discounts on Take Control orders and other Apple-related products.
Read the full article at TidBITS, the oldest continuously published technology publication on the Internet. To get a full-text RSS feed, help support our work and become a TidBITS member! Members also enjoy an ad-free version of our Web site, email delivery of individual articles, the ability to make long comments with live links, and discounts on Take Control orders and other Apple-related products.
Read more of this story at Slashdot.