by Pxtl · 12y ago · 0 comments
Yeah, I'll be trying out Go for Android. Give me an excuse to learn Go. Still don't like the idea of going without generics and exceptions, but maybe it'll surprise me. I figure we're all just biding our time until Rust is ready.
https://github.com/rust-lang/rust/wiki/Doc-building-for-andr...
More recently:
https://mail.mozilla.org/pipermail/rust-dev/2014-June/010323...
It isn't integrated, and as they note as one of the gaps, doesn't currently support CGO (meaning you can't compile C code or libraries in with your Go executable), but it has worked quite well for some time.
While I did jokingly say "Serious UI Toolkit", there's more than a few awesome applications on Android that have very, very simple UI widget requirements. Particularly games, which according to the article, they're focusing on.
That's a ridiculous assertion.
Who is "he"? The poster michael was replying to said s/he was waiting for Rust to be viable.
I'm pretty sure that was contributed by Samsung.
val, err := error_prone()
if err != nil {
return nil, err
}
let val = try!(error_prone());
Personally, I find that error handling isn't that bad in go. I think it's at least no worse than exceptions. Exceptions make it too easy, for me at least, to just mindlessly propagate the error. Sometimes that's the right thing to do, but in go it's a lot less repulsive to handle the error since to propagate the error you would need handling code anyway.Rust strikes a nice balance. You have to explicitly handle every error, but if you go with the by far most common handling code, you get some nice sugar that makes it mostly painless.
Part of the problem with Java exceptions is too many people feel obliged to catch exceptions, when they should be propagated.
Ideally, the only catches would be in the top-level loops (request / response dispatch for server, event loop for GUI, arguments for command-line).
I think Dart or another JVM language are the only hope for getting away from Java on Android. Dart is maybe a longshot at this point though.
Looking back I wouldn't mind developing on Android again but I wouldn't want to necessarily do anything with Java by itself.
The level of hackery even drips down to their own documentation and code examples. There is a line in an old example for a TabPager I believe that said "It relies on a trick." How is this acceptable API writing and role-modeling from Google?
Kotlin seems approachable and modern. Also compiles down to JS.
Case in point: To make a list on Android, you need to jump through hoops, assign stuff to a "Tag" property (a field intended for hacks and workarounds), typecast your ass of, or if you don't do all that your list will perform absolutely shitty. So, the easy flow is a crappy, slow, buggy list. The "best practice" (which is not the easy flow, because hey, why would we make good stuff easy) is a "View Holder Pattern" [0] that involves using intended-for-hacks framework features.
On top of that, to my feeling there's also a big difference in quality between the enterprisey Java ecosystem and the Android ecosystem. Android-o-world is full of not-entirely-good advice and bad examples. Jumping into Android reminded me of past PHP experience: lots of well-meaning, but ultimately not-very-experienced people set the tone. Enterprisey Java might have AbstractFactoryFactoryProviders, but at least they have no buggy/wrong/hacky/insane code with 300 stackoverflow upvotes.
[0] https://developer.android.com/training/improving-layouts/smo...
You don't have to do that. For a list with homogenous items you can use a regular ol' ListAdapter, implement getView sensibly (i.e. re-use views, which is very little work) and it will perform just fine. We tried this with a list of 2,000 items (each item had two TextViews and an ImageView) and it was completely fluid on a Samsung Galaxy Ace.
> Android-o-world is full of not-entirely-good advice and bad examples. Jumping into Android reminded me of past PHP experience
I could not agree with this more. I'd say somewhere around 2/3 of StackOverflow Android answers are downright wrong.
Everyone else just uses CursorAdapter which is easy to use and ties in nicely with things like Loaders and ContentProviders.
That's why there are all these crutches like Joda, Guava etc.
Anything GUI or system-related you have to do in Java. You won't be able to use Go to run other apps, enable wifi, receive GPS locations, communicate over bluetooth, etc. etc.
Qt is worth a look, but it's still not quite ready.
The hole point is getting advantages. Lucky us that it's hard; others won't keep pace!