Earlier quoted context omitted.
I wrote an iOS app. I ported it to Android. The only part that didn't need to be rewritten from the ground up (and it worked completely unmodified) was the part written in C. If you have the same APIs available (OpenGL in this case) C is the most portable language there is. Which proves it's not a language issue, it's a platform issue. In fact the owners of the platforms care so little about (indeed actively oppose)…
> the one language that works everywhere and which they have no choice but to support: C I've been tinkering with Rust bindings for Apple Core Audio. AUGraph, which has a C interface, was deprecated a few years ago. Its replacement, AVAudioEngine, has an Objective-C/Swift API. :( There are a lot of generalized cross-platform libraries for guis, audio engines, etc, which attempt to abstract over the differences betwee…
Portable software is more complex than you think
21–25 of 25 posts
Re: Portable software is more complex than you think
#22A good pattern is to separate the core logic from the code that interacts with the platform. If these are tangled up porting becomes a nightmare. Our approach to portability in ZeroTier is to make the core, our "network hypervisor," a completely OS-neutral chunk of code that interacts only via an API. It contains literally no system calls, I/O, etc. Then there's a service harness for desktops, servers, phones, etc.
In reality the API is part of the core logic except for purely computational services and therefore all core logic can rarely be fully encapsulated.
Re: Portable software is more complex than you think
#23Portability of software is a language problem. Some languages make it extremely easy. Others, like C and Go, make it difficult to be correct across all platforms.
I wrote an iOS app. I ported it to Android. The only part that didn't need to be rewritten from the ground up (and it worked completely unmodified) was the part written in C. If you have the same APIs available (OpenGL in this case) C is the most portable language there is. Which proves it's not a language issue, it's a platform issue. In fact the owners of the platforms care so little about (indeed actively oppose)…
if you wrote your iOS app in Xamarin, u could today run it on .NET6 pretty much unchanged. I maintain multiple store apps where i share 90% of the code across all platforms (iOS/Android/Win/macOS) that have extensive integrations with the OS. I can even drop down to native obj-c, java, win32, macos apis as required using the same syntax as any other library thanks to the code-gen MS does. I use powershell for scripting. Dont need a full app? I can have native islands as well or be an island in another native App.
Re: Portable software is more complex than you think
#24Earlier quoted context omitted.
I wrote an iOS app. I ported it to Android. The only part that didn't need to be rewritten from the ground up (and it worked completely unmodified) was the part written in C. If you have the same APIs available (OpenGL in this case) C is the most portable language there is. Which proves it's not a language issue, it's a platform issue. In fact the owners of the platforms care so little about (indeed actively oppose)…
> the one language that works everywhere and which they have no choice but to support: C I've been tinkering with Rust bindings for Apple Core Audio. AUGraph, which has a C interface, was deprecated a few years ago. Its replacement, AVAudioEngine, has an Objective-C/Swift API. :( There are a lot of generalized cross-platform libraries for guis, audio engines, etc, which attempt to abstract over the differences betwee…
Re: Portable software is more complex than you think
#25A good pattern is to separate the core logic from the code that interacts with the platform. If these are tangled up porting becomes a nightmare. Our approach to portability in ZeroTier is to make the core, our "network hypervisor," a completely OS-neutral chunk of code that interacts only via an API. It contains literally no system calls, I/O, etc. Then there's a service harness for desktops, servers, phones, etc.
The problem is, for this to work the API itself must be cross-platform, which means it's either an incomplete abstraction (exposes many options, only some of which are implemented on a given platform), overly restricting (lowest common denominator leading to suboptimal performance and restricted development agility on advanced platforms), or not really cross-platform (supports one platform well but others are ineffic…
I tend to use DDD and the egg-shell pattern, building a domain / service model in portable code, and leaving the platform specific code to the outer shell behind a refined abstraction. I dont have any APIs with overloads, but sometimes the backing API is a no-op.