Archive for June 21, 2023

Wednesday, June 21, 2023

MVC Isn’t MVC

Collin Donnell (Mastodon, Hacker News):

In December of 1979 Tyrgve Reenskaug, an employee of Xerox PARC, published a paper called MODELS-VIEWS-CONTROLLERS about a design pattern he had invented for developing applications with a graphical user interface.

[…]

In [Apple’s] version, models and views got dumber and controllers handle a lot more.

[…]

In the late 1990s, Java developers writing for the web created a new variation of MVC to deal with the fact that web and desktop apps are different. It was called Model-2. […] Rails used a Model-2 style architecture, but is generally just referred to as an MVC framework.

[…]

There are aspects of the original design that could be applied and might be useful — models notifying views of updates while remaining decoupled using observable objects with SwiftUI in Swift or something like Turbo Stream broadcasts for Rails style web frameworks — but what is interesting to me is how an idea that could be described in a page and a half the year after Star Wars came out has managed to evolve and remain relevant in such different environments.

danabrams:

The M in MVC has come to mean “data model,” but it originally referred to the “mental model” of the user. What kind of thing are we trying to manipulate and what is the user’s mental model of such a thing?

Marcel Weiher:

The “Model” is an object that is the headless application. It implements and coordinates all the functionality. You put a thin GUI on top of that. Or a different GUI. Or an API. Or a WebUI. Or a CLI….

Dave Rahardja:

I would go even further that the “controllers” in the modern #AppKit / #UIKit world are even further away from the original conception of #MVC, and they’re hardly “controllers” in the original sense any more.

See also: Dave DeLong’s A Better MVC and MVC Todo.

Previously:

Update (2023-06-23): Collin Donnell:

If you enjoyed my MVC Isn’t MVC post from a couple of days ago, you might also be interested in the latest episode of the Rooftop Ruby podcast. Joel and I discuss our thoughts on the post before getting into more detail on MVC, the forgotten editor controller, and how we might be able to implement something closer to the original MVC on the web using modern technologies like morphdom and Turbo Stream broadcasts.

Scanning QR Codes With Your iPhone

John Gruber:

My tip for scanning QR codes is not to use the Camera app at all. Instead, enable iOS’s hidden built-in Code Scanner app in Contol Center. Go to Settings → Control Center, and under More Controls, enable Code Scanner.

[…]

Worth keeping in mind, too, that when you use the regular Camera app to scan a QR code, if you open the link, it opens in Safari. With the Code Scanner app in Control Center, links open in a sandboxed in-app web view, which is more private. The only downside is that if you want to keep the opened the page around, you’ll need to open it in Safari from within Code Scanner.

Code Scanner is a faux app that does show up in search, but you can’t actually drag its icon to your home screen.

Damus Zaps vs. the App Store

Sarah Perez:

Another decentralized social networking application to challenge Twitter has hit the App Store. Last year, Twitter co-founder Jack Dorsey donated around $245,000 in bitcoin (then roughly 14 BTC) to fund the development of an open and decentralized social networking protocol known as Nostr, which is based on cryptographic key pairs. Now, the first mobile app to leverage the protocol, Damus, has been published on the App Store, allowing anyone to try out the new technology.

[…]

The site also touts end-to-end encrypted messaging — something Twitter does not have, and which has concerned users in the wake of the Musk takeover. There’s also no requirement to sign up with a phone number, email, or name because of how the Nostr works.

[…]

Bitcoin integration is also a part of the Damus experience, allowing users to tip friends’ posts, for instance. This is made possible by way of Bitcoin’s Lightning Network.

[…]

Damus’s decentralized nature presented a problem for getting through App Review at first, as Apple kept asking the app to follow the same rules as any other social network — like providing a way for users to flag objectionable content, and having a policy that makes it clear abuse is not allowed. The Damus Twitter account had earlier tweeted the app was being rejected repeatedly, despite its claims that it had resolved the issues Apple raised.

I still think these rules are extremely unclear and not consistently enforced.

Damus:

Damus will be removed from the app store in 14 days, apple says zaps are not allowed on their platform because they could be used by content creators to sell digital content.

Via Tim Sweeney:

Apple is coming for money transfer and funding apps like Damus, Patreon, Venmo, maybe PayPal and Stripe. If digital goods may be somehow involved in the transfer, now they want 30%. If Apple can tax this, they can tax digital banking, payroll, and anything else.

Jonathan Vanian and MacKenzie Sigalos:

Apple later reneged on its threat, but only if Damus agreed to remove certain payments functionality.

The move could stall one plan to ease the use of bitcoin and turn it into a more convenient transnational digital currency.

[…]

“Only zaps on profiles are allowed,” Damus said in the tweet. “This cripples damus pretty bad, but you can still zap at least.”

[…]

Dorsey tweeted his displeasure against Apple saying that “Tipping on posts is not selling digital content. It’s a form of feedback.”

And it’s allowed with WeChat?

Previously:

Update (2023-06-26): Damus (via Hacker News):

Looks like we are getting removed from the appstore even after updating our app to make it clear that no digital content is getting unlocked when users are tipped. Users are only ever tipped after posts are made, the idea that content is being sold is nonsense. We will be filing an appeal as this guideline is clearly being abused and misapplied.

Safari 17 Profiles

Tim Hardwick:

Safari has gained a new feature called Profiles, which is designed to help keep your browsing separate for topics like Work, School, or Personal.

Each profile gets its own icon and silos your history, Tab Groups, favorites, and cookies. You can even assign specific extensions to different profiles to optimize your browsing experience based on the task at hand.

WWDC 2023 session 10119:

Learn about the latest improvements to Safari extensions. We’ll take you through new APIs, explore per-site permissions for Safari app extensions, and share how you can make sure your extensions work great in both Private Browsing and Profiles.

Cory Underwood:

While this may not seem super privacy focused – profiles shard the user’s History, favorites, Tab Groups and website data such as cookies, caches, service workers, and Web Push subscriptions per-profile.

For user’s who share a device (or who wish to have multiple profiles on their device for various activities) this will limit that the behavior undertaken in the course of one activity (on a profile) will impact the experience of another activity (on a different profile). Depending on actual user behavior – this may impact retargeting and attribution efforts as it will not be possible to re-establish the link easily across profiles (basically this is like a cross-device scenario). This as a result may affect how much of a given audience is reachable for targeting advertising.

I’m interested in profiles as a way to feel more comfortable using Safari extensions. Right now, extensions are all-or-nothing, and there are some that I’d like to use but that I don’t want having access to everything that I browse. With profiles I could, say, enable extensions for general browsing but disable them when accessing my bank.

Safari 17 lets you specify per-site which profile it should open in. This works for “incoming links,” i.e. if I open a site via PasswordWallet. However, if I’m already in Safari, each window stays with the profile it was opened with, even if I click on a link or choose a bookmark that leads to a site that was set to use a different profile. So the profiles feature is more designed around segregating activities rather than sites. It’s up to you to make sure it knows which activity you’re doing.

There is no way to turn off JavaScript for a profile, and that’s still not available as a per-site option, either.

Sindre Sorhus:

Apple does not expose any way to open URLs in a specific profile. I recommend sending feedback to Apple that they should add Shortcuts and AppleScript support for this.

Update (2024-04-12): Jeff Johnson:

What makes Safari profiles unusable for me is that Safari changes the keyboard shortcut depending on which window is in front.

The way I think of it is that each profile has a consistent numeric shortcut (even if it’s not always displayed in the menu), and Command-N creates a window using the most recently used profile. As far as I can tell, there’s no way to change the order of the profiles after creating them, which means the menu doesn’t look sorted, but it does help keep the shortcuts consistent (unless you delete a profile).