I wasn't checking this slack for some time, but no...
# thinking-together
f
I wasn't checking this slack for some time, but now that I did, I discovered that it passed 1,000 members, really cool! 🎉 I stumbled upon Progressive WebAssembly Apps (PWAAs) yesterday and thought that they might be of interest for members of this group. It's basically just combining Progressive Web Apps (PWAs) and WebAssembly. The main selling points: • Cross-Platform (runs in every modern browser) • Native feel (mobile system ui integration, add to home screen, offline functionality, ...) • Installation as easy as bookmarking a website • Near-native performance using WASM For me, this feels like it could become the go-to solution for cross-platform apps. I'll probably write a Todo-PWAA (I need a replacement for Wunderlist anyway :P) to test this approach. Recording:

https://www.youtube.com/watch?v=0ySua0-c4jg

Slides: https://alexkehayias.github.io/webassemblysf-presentation-20190820/
What do you think? Is this the future of apps?
c
There seems to be a general trend of browsers adding OS features and OSes adding sandboxing features
🤔 1
k
What’s the code size for a minimal PWAA producing “Hello world” ?
f
@Konrad Hinsen "The 'Seed' example app uses the
seed
framework and clocks in at ~600kb (including ~300kb for an icon and splashscreen), works offline, and can be installed to your homescreen on iOS or Android devices." - https://woz.sh/
❤️ 1
k
@Felix Kohlgrüber Thanks for the pointer! Those numbers look reasonable for the 21st century.
j
The main limitation imo is storage. Both localStorage and IndexedDB have very low size caps (typically ~50mb) and are subject to random deletion whenever the browser feels like it. Also the IndexedDB api isn't great for building a decent query language on top eg transactions are already hardcoded in, every method is asynchronous, there isn't a proper seek method. Overall I get the impression that PWA are still very much built around an online-first model where all your data lives on a server somewhere but you might cache stuff for the occasions where you're offline for a few minutes. It doesn't seem feasible to produce a good offline-first experience on the web today.
1
Also their approach to durability is:
...there exists a small chance that the entire transaction will be lost if the OS crashes or there is a loss of system power before the data is flushed to disk. Since such catastrophic events are rare, most consumers should not need to concern themselves further.
f
@jamii Thanks for your comments, that's an area I haven't looked into yet. For what I'm planning to build, 50mb shouldn't be a problem, but I can see that this would be limiting in other cases (e.g. music app). Regarding persistence / durability, one could argue that smartphones and tablets aren't the right devices for persistent and durable storage anyway. The get dropped, drowned or stolen which makes storing data on them only a bad idea. My current thoughts are that an "end-user home server" and devices connected to it might be the best solution. This would allow for backup, synchronization, availability and scalability of stored data without giving it into the hands of who-knows-whom. But that's another discussion ;-) Back to the point: I could imagine that we'll be able to use WASI within PWAs some day. If I remember correctly, this could allow fine-grained file system access for apps which should fix the current storage problems.
n
I used to think "the web" was the future of apps. But nowadays I think it's an unsustainably complex Tower of Babel. Are we really going to be building on top of all these poorly-thought-out Web APIs in 50 years? That's a horrifying thought. We should probably keep a couple of APIs at most.
The problem we have nowadays is that we work with code libraries, built upon app frameworks, built upon browsers, built upon operating systems, built upon machine architectures. It's an incredibly complex and fragile tower. I think we should wipe out a few levels and try again.
d
I agree with Nick, though I think apps-on-demand and cross-platform nature of web apps is definitely a step toward the future
j
I'm hopeful for something emerging out of wasi. The killer feature of the web for apps is easily distributing sandboxed cross-platform code, so separating that out into a platform that supplies just those things and doesn't pile a bunch of compulsory choices on top seems like a win.
one could argue that smartphones and tablets aren't the right devices for persistent and durable storage anyway.
The idea of offline-first apps is that they are completely capable without a network connection, and just use the network for backup / collaboration. Email is a perfect example - with native clients I can search and write emails offline and then sync up when I'm back online, even though the canonical copy of my inbox lives on a server somewhere. Web-based email never seemed to deliver a decent offline experience. A side-effect of building stuff in this way is that offline-first apps typically load faster (because the data is already here), are more responsive (don't have to wait for a network roundtrip to eg autocomplete an email address) and are easier for the user to extend/compose (because all the data and code exists locally already). The future I'm hoping for is we keep the ease-of-distribution of the web but allow building offline-first apps that are actually able to use the full capabilities of the machine. My phone has a 128gb drive. I send/receive ~0.3gb of email per year. Keeping a synced copy really shouldn't be a problem.
👍 4
f
@Nick Smith I also wished there were less APIs solving the same task, less poor abstractions and especially less tooling (https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f). But on the practical side, cutting down on existing stuff is pretty hard. Who would decide what to keep and what to do with all existing projects using some tech you'd like to get rid of? In theory, I'm totally with you (together with probably most web devs) in theory, but achieving practical improvements is the real challenge here. I Hope that WASM/WASI will be the kind of restart we all want, but let's see. Another thing is that the web isn't the only platform suffering from growing complexity. I guess that if I wanted to write a native Android app, it wouldn't be much easier than using web tech. The only thing would be that I had to write like 5 other apps for the other major platforms and deal with all the little differences between them. Compared to that, a single web app that can be installed on all platforms and works consistently sounds pretty interesting.
@jamii Couldn't agree more. I'm a huge fan of offline-first web apps. My last comment didn't mean to argue against that, I just wanted to say that random deletion of data by the browser shouldn't cause data loss. So in the email-example, if the browser deleted data it could be restored from the email-server. This may be inconvenient, but not a big problem. And as long as there's plenty of storage available, why should the browser free up memory? I can kind of understand that browsers won't guarantee to keep the data forever. Extending PWAs to allow unlimited data storage and have some form of UI to check data usage of each PWA would be great.
j
if the browser deleted data it could be restored from the email-server
Only if the server has already synced that data. Otherwise it just deleted some emails that were queued waiting to be sent and undid all the changes to my inbox. And even if there is no data loss, deleting the data assumes that I'm almost always online and that it's only stored locally as an optimization. I have this problem in practice with eg spotify which occasionally clears all downloaded music for some reason, usually just as we're about to drive into the mountains and out of cell phone coverage. Or when I'm abroad and don't have mobile data. There was a proposal to allow tagging browser data as persistent so that it won't be deleted by the browser without asking the user first - that would be big improvement if it lands. But I still expect the APIs in general to be built around an online-first model of the world.
This may be inconvenient, but not a big problem.
It's not just inconvenient, it's a symptom of an architecture that is based around turning my multi-thousand-dollar supercomputer into a dumb client for an overloaded vps somewhere on the other side of the world and on the other side of a spotty cell connection. Not because it produces a better experience - aside from the ease of distribution most web apps provide dramatically worse UX than the native apps of the 20th century - but because it's more profitable to own the users data. So it really bugs me to see that model becoming not just prevalent but invisible, to the point that people design api's for offline usage that are not usable by someone who is regularly offline.
👍 1