Live data from Hacker News

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

news.ycombinator.com

101–110 of 123 posts

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

#101
I have a similar use case where the crux of my business is really data / analytics centric. The user experience is pretty much limited to mostly information consumption with a few click events (favorites, like, dislike, delete and the occasional standard input forms).

I'm leaning towards using [Meteor](https://www.meteor.com/) to share code between mobile apps and web apps.

Using cordova shells is pretty neat for business applications. Would be interested in thoughts.

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

#102

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...

If users care about their own data the best thing they could do is to stop using smart phones and signing up to google, facebook, saas providers etc. etc. They would leak your data with the efficiency any pirate will be jealous of.

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

#103
post #70

Earlier quoted context omitted.

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 envir…

Can I please have some links to unbiased reports with real world data on how much damage is attributed to the use of C vs other languages? Not from the entities you mentioned as they all have their own agenda. Otherwise what you say sounds more like unsubstantiated FUD.

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

#104
post #72
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…

This is a UI-centric take. There are lots of internals that could/should be shared between apps. Recently relevant examples: a customized WebRTC stack, a websocket client with extra authentication and delivery rules. FWIW, my take on this has been to embrace Conway's law: if you have enough shared work to form a team around it, then break off a c++/whatever library and a team to maintain it. But if the hope is just t…

This is exactly what Dropbox has just abandoned. https://blogs.dropbox.com/tech/2019/08/the-not-so-hidden-cos...

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

#105
post #22

Dart+flutter?

I agree fully. Please consider that the Flutter team are having a hard time keeping up with iOS changes with regards to developer tooling. For example, print() is now broken due to iOS 13 in everything but xcode and while using a debugger/tests is the right solution, it sure is nice to be able to add a print() statement in there for quick and dirty...

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

#106
post #15

C++. It is part of both SDKs, you have direct support for mixed mode debugging on the IDEs. No need of extra tooling. On Android JNI is always going to be a pain, but at least with C++ Studio gives you an hand on accessing JNI APIs.

You might want to have a look at https://www.boden.io. Looks as if this might greatly simplify the task of sharing business logic (and UI if needed/desired).

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

#107
post #40
post #27

Earlier quoted context omitted.

I love hacker news. This is the comment I came here for. Just use this : A language that is (at best) fringe on the platform you are using. Here's a toolset nobody has ever heard of. Now build your mission critical bit of infrastructure on this house of cards, wait for the toolset maintainers to be outpaced and under-resourced by underlying OS/platform changes and then have to rewrite the whole thing which if it does…

Well, developers are the kind of people that love to be contrarian, so it shouldn't be that surprising. Half the fun (in my mind) is doing something no one else is doing. Being novel. It's probably unwise in a business sense, but if everyone was being wise all the time, there wouldn't be much fun in software development.

[deleted]

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

#108
If you really want to optimize and share code across platforms, you should really go for C++.

Make your core logic in C++ and write bridges for Kotlin and Swift, where only the UI logic is involved. C++ has the better ecosystem so far and the very modern standard (C++17) let you write robust code. There are also so many tools that help you catch errors and typos, plus thousands of libraries available.

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

#109

Earlier quoted context omitted.

What “risk” is there in an overflow from using strncmp, strncpy, etc? C++ still isn’t as easy to interop with other languages as C and the low level APIs built into operating systems are not going to use C++/STL and you still end up converting to standard C strings and arrays.

strncpy notoriously doesn't necessarily 0-terminate. (It also always pads the full length with zeroes if necessary, so it's almost never what you actually want to do.) The C standard library is full of these footguns. I won't say C++ doesn't have its bad parts, and I certainly wouldn't say that it's impossible to avoid the bad parts of C (some would), but you probably aren't going to manage.

If all of your string manipulation is working with the knowledge of the maximum size, how is that any different than the standard Pascal or BSTR string handling where the size of the string can be found in the first two bytes of the string?

The typical error case with C is something like

  char *a = “abcd”; //5 bytes
  char *b = “efgh”;

  char c[8];
  strcpy(c,a);
  strcat(c,b); //buffer overflow by 1 byte. 
If you used the “n” equivalents, c would have 8 bytes and every other function would know to stop 8 bytes - assuming you always pass in a size parameter.

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

#110
In Readdle we use Swift as common language to run one codebase on all platforms. Currently, we use it for macOS, iOS and Android. In Spark for Android almost everything except UI written in Swift https://play.google.com/store/apps/details?id=com.readdle.sp...

The blog post about how it works https://blog.readdle.com/why-we-use-swift-for-android-db449f... And our toolchain https://github.com/readdle/swift-android-toolchain

The biggest disadvantage is the lack of swift evaluation in Android Studio LLVM debugger. But we work on this.

Post reply on HN