Live data from Hacker News

Ask HN: Best language to share code between an Android and iOS app?

news.ycombinator.com

61–70 of 123 posts

Re: Ask HN: Best language to share code between an Android and iOS app?

#61
post #48

Earlier quoted context omitted.

C is also very simple to add security exploits to your app. I would never advise C unless the platform is lacking of a C++ compiler. Just use extern "C" at the boundaries.

What’s the threat of a security vulnerability in a 3rd party mobile app that tightly sandboxes your app - especially for a none financial app? I would think that if even a vulnerable app could affect other running processes or the OS itself, you’ve found a vulnerability in the underlying OS.

Presumably the user of the app cares about their own data...

Re: Ask HN: Best language to share code between an Android and iOS app?

#62
post #48

Earlier quoted context omitted.

C is also very simple to add security exploits to your app. I would never advise C unless the platform is lacking of a C++ compiler. Just use extern "C" at the boundaries.

What’s the threat of a security vulnerability in a 3rd party mobile app that tightly sandboxes your app - especially for a none financial app? I would think that if even a vulnerable app could affect other running processes or the OS itself, you’ve found a vulnerability in the underlying OS.

The threat depends on what the app is used for.

If nothing else it can be used for piracy.

Software Engineering should strive for quality and best practices.

Re: Ask HN: Best language to share code between an Android and iOS app?

#63
post #48
post #29

Earlier quoted context omitted.

I would say use C. Interfacing C with Java is simple JNI. Interfacing C with Swift is very simple, too.

C is also very simple to add security exploits to your app. I would never advise C unless the platform is lacking of a C++ compiler. Just use extern "C" at the boundaries.

What vulnerabilities does C introduce that C++ doesn't?

Re: Ask HN: Best language to share code between an Android and iOS app?

#64
post #50

Earlier quoted context omitted.

> Apple is now deprecating ObjectiveC++ How so? Objective-C++ drives a number of Apple projects, so I don't see how they're deprecating it.

Documentation seems to have vanished.

Apple’s documentation for all sorts of things is in a sorry state lately. That includes mass “retiring” of perfectly good documentation for non-deprecated things with no replacement. I wouldn’t take missing or hard-to-find documentation for any specific thing as an indication that it’s deprecated. As far as I know, Objective-C++ is as supported as ever. That is to say, it’s not exactly a banner feature, but it works fine, and there’s no reason not to use it if it’s the best solution to your particular problem. I use it in a number of places, including to expose C++ code to Swift, which doesn’t interop directly with C++.

Re: Ask HN: Best language to share code between an Android and iOS app?

#65
post #60

Since no one else has said it, I'll be the voice of reason. Share your design specs only, and let each platform team write the implementation in the language that they think best. Yes, you'll have two teams spending time on doing the same thing. However, you'll get important benefits. Each team will be able to implement appropriately for their platform. While iPhones and Android phones are rather similar in terms of…

The poster is talking about data processing code, and not UI code.

> The app is responsible for processing data, submitting to ML models, and then displaying results in a UI

There is not need to handle this logic seperately. And lots of reasons not to.

Re: Ask HN: Best language to share code between an Android and iOS app?

#66
post #50

Earlier quoted context omitted.

> Apple is now deprecating ObjectiveC++ How so? Objective-C++ drives a number of Apple projects, so I don't see how they're deprecating it.

Documentation seems to have vanished.

Picking on sibling comment, you can still reach for the document, all what is required is a little experience as Apple developer on how documentation get shifted around.

https://developer.apple.com/library/archive/documentation/Co...

Sadly the new manuals are pretty lousy.

Re: Ask HN: Best language to share code between an Android and iOS app?

#67
post #62

Earlier quoted context omitted.

What’s the threat of a security vulnerability in a 3rd party mobile app that tightly sandboxes your app - especially for a none financial app? I would think that if even a vulnerable app could affect other running processes or the OS itself, you’ve found a vulnerability in the underlying OS.

The threat depends on what the app is used for. If nothing else it can be used for piracy. Software Engineering should strive for quality and best practices.

How do you propose that an security vulnerability in an iOS app that doesn’t result in a jailbreak will allow someone to copy the app from an iOS device on to another device?

Also, are you claiming that using C == “not striving for quality” or that it is not “best practice” to use C?

And on a side note, most corporations don’t care about “quality” or “best practice”, they care about shipping and selling software. Two decades in the industry has shown that those two things aren’t as highly correlated as you wish.

Re: Ask HN: Best language to share code between an Android and iOS app?

#68

Earlier quoted context omitted.

What’s the threat of a security vulnerability in a 3rd party mobile app that tightly sandboxes your app - especially for a none financial app? I would think that if even a vulnerable app could affect other running processes or the OS itself, you’ve found a vulnerability in the underlying OS.

Presumably the user of the app cares about their own data...

And only their data in the app in question or any data that the user allowed the app to have would be vulnerable. If not, that’s an issue with the sandbox on the mobile OS.

Re: Ask HN: Best language to share code between an Android and iOS app?

#69
post #60

Since no one else has said it, I'll be the voice of reason. Share your design specs only, and let each platform team write the implementation in the language that they think best. Yes, you'll have two teams spending time on doing the same thing. However, you'll get important benefits. Each team will be able to implement appropriately for their platform. While iPhones and Android phones are rather similar in terms of…

Users will be at best confused, and at worst insulted by this.

However... Don't assume that a user has an exclusive affinity with one platform at a time. Users will load the app on different phones, sometimes at the same time, so if there are any differences in the way the apps handle data you'll soon see things getting corrupted. Make sure you have lots, and lots, and LOTS of tests.

Re: Ask HN: Best language to share code between an Android and iOS app?

#70
post #62

Earlier quoted context omitted.

The threat depends on what the app is used for. If nothing else it can be used for piracy. Software Engineering should strive for quality and best practices.

How do you propose that an security vulnerability in an iOS app that doesn’t result in a jailbreak will allow someone to copy the app from an iOS device on to another device? Also, are you claiming that using C == “not striving for quality” or that it is not “best practice” to use C? And on a side note, most corporations don’t care about “quality” or “best practice”, they care about shipping and selling software. Two…

Industry is young, but thankfully returning goods on app stores and suing companies for delivering bad software is starting to happen.

I am claiming both when using a language whose security reports from Google, Apple, Microsoft, ARM, Linux kernel just increase in size every year with the amount of memory corruption and UB induced security exploits.

Like those reports advise, usage of C should be constrained to environments where no other safer alternative is made available, or due to constraints on already deployed software.

Post reply on HN