8 ms·
So I've finally been learning to write Android Java... and honestly, as a C#/Python developer, I figured it would be easy to pick up. Holy crap, how do you peo
by Pxtl 12y ago
So I've finally been learning to write Android Java... and honestly, as a C#/Python developer, I figured it would be easy to pick up. Holy crap, how do you people live like this?
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.
- myko 12y agoUnfortunately they will not be mirroring the Android SDK in Go, but only the NDK bits. It's noted in the document that it would be too much of a bear to keep up with the official SDK, and an automated tool would generate crappy, non-idiomatic Go. 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.
- fidotron 12y agoThe problem with Android isn't Java though, it's the Android API being an inconsistent hacked together in a hurry trainwreck. Everything they've added since 3.x has been an enormous improvement, but they never shook off the baggage of the initial push to release.
- myko 12y agoFair enough. Even some of the newer APIs feel slopped together to be honest. Android development does feel like a constant battle with framework bugs.
- shakethemonkey 12y agoAll android APIs tend to have a large number of methods, but there will be absurd omissions. Example, the WebView has no way to return its HTML contents. So it's difficult to implement your own caching mechanism. Or an even more absurd example, the android YouTube player has no .stop() -- it is simply inconceivable that a media player lacks a way to stop a video, but there it is.
- Shish2k 12y agoBack when I was writing a client for a REST website, the default HTTP library lacked POST. The recommendation was that every app which wanted to POST should bundle the ~2MB apache HTTP library, which seemed a little painful given that other than that, our app was ~50KB :(
- Ironlink 12y ago> Example, the WebView has no way to return its HTML contents. So it's difficult to implement your own caching mechanism. That's a feature to me. Respect my Cache-Control headers!
- deleted 12y ago[deleted]
- rdtsc 12y agoFunny I had the exact opposite impression after using Java years ago. I felt like Android's API redeemed Java in my eyes a bit. I never liked Java much but the emulator, the debugger, a documented API, lots of example, developer blogs all made it very easy to get started and I create a rather complicated app pretty quickly. Looking back I wouldn't mind developing on Android again but I wouldn't want to necessarily do anything with Java by itself.
- jm547ster 12y agoHave to agree, I thoroughly despised Java until I started developing for Android, it suited the Application Framework and made the language fun, developing fully functional apps with ease and speed.
- bennyg 12y agoTell me about it. I'm constantly using the autocomplete to look through all options to complete a method when it should be consistent with other similar things. For instance, you set OnClickListeners but you add TextChangeListeners. This is just a simple example, and yeah it's a small thing, but it's the damn mental baggage of not relying on my brain's quick search to find similar things and having to spend the extra time that really wears on you after hours of it. 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?
- fit2rule 12y agoLook at it like this: if you need an IDE to get code written, things have gone off the rails. Most Android developers would be absolutely useless without code completion ..
- higherpurpose 12y agoI think it's "riskier" for Google to stick with anything Java related at this point. Even if it takes 5 years to make the switch, I think they should do it. They don't know what Oracle is going to do in the future against them. The recent win for Oracle has already showed them that they made a mistake not starting supporting Go 2-3 years ago when Oracle first sued them. This could end up costing them soon, but it could also get a lot worse. I think they can't afford not moving off Java. Plus, look how much excitement Apple caused with Swift for developers. They could do the same with Go for Android.
- tkubacki 12y agoDartlang is more appealing for mainstream programmer than GO, already has an IDE with debugging intellisense etc. and already has Android backend (see Dartlang source code)
- kyrra 12y agoGolang gets intellisense with with gocode. Go has some debugging with gdb and awesome profiling with pprof. While there isn't an official IDE, there are plugins for eclipse and IntelliJ. Go's approach makes it easier to use your favorite editor to code.
- spacemanmatt 12y agoThey have already paid Oracle. That case is settled. How could it get worse?
- briandh 12y agoNo they haven't; the case is still ongoing, remanded to the district court.
- curtis17 12y agoGiven Google's relationship with Jetbrains for Android Studio how about Kotlin. Cut out Java entirely: Kotlin -> ART. Kotlin seems approachable and modern. Also compiles down to JS.
- steveklabnik 12y agoWe build every Rust commit against Android already: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/5564 http://buildbot.rust-lang.org/builders/auto-linux-64-x-andro... I'm pretty sure that was contributed by Samsung.
- kibwen 12y agoPlus, Rust doesn't have exceptions any more than Go does.
- adrusi 12y agoRust doesn't have exceptions, but its error handling is less ugly than go. Functions that can encounter errors return a `Result` by convention. If you then want to propagate errors, you can do so nicely with the try! macro, which converts a successful `Result` into its value, or returns the error of an unsuccessful `Result`. Thus the following go and rust are semantically the same: 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.
- barrkel 12y agoI find that propagating the error is what I want to do at least 95% of the time. 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).
- kisielk 12y ago
- shailesh 12y agoScala is also a good option. The g8 template for Android apps is at: https://github.com/jberkel/android-app.g8 https://github.com/jberkel/android-app.g8
- V-2 12y agoI thought about Scala, but the Scala plugin for Android Studio is rumored to be buggy and Scala doesn't integrate well with Gradle build system. At least I couldn't get it to work and I gave up after a while. If they (Google) wanted Scala to be supported on Android, they would make sure it isn't such a pain. And some documentation - all I could turn to for help is a handful of random blog entries etc.
- Jare 12y agoThis Libgdx sample worked better for me, although I had to remove a bunch of ios bits to get it to work on my non-mac. https://github.com/ajhager/libgdx-sbt-project.g8 https://github.com/ajhager/libgdx-sbt-project.g8
- V-2 12y agoThanks for the tip. Did you get it to work with Android Studio? (I guess guidelines for IntelliJ Idea would apply)
- zak_mc_kracken 12y agoIf you're writing C#, it's hard to believe you'd find Java challenging.
- libria 12y agoI'm reading into his comment that he dislikes the tedium of Java's verbosity e.g., getters, no var/auto, no LINQ, no delegates, etc.
- Pxtl 12y agoThat stuff plus the terrible state of datetimess and the lack of obvious operator overrides like being able to test string equality with ==.
- skrebbel 12y agoMy guess is that that's his point. Java is easy to pick up, but the Android API is such a hurriedly-hacked-together piece of nonsense that it hurts. 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/smooth-scrolling.html#ViewHolder https://developer.android.com/training/improving-layouts/smo...
- alayne 12y agoI dislike Android as much as the next guy, but you have to do some extra work to make UITableViews perform well in iOS as well.
- michaelsbradley 12y agoRust is almost/ready for Android and iOS, granted that the language itself is still in a state of flux: https://github.com/rust-lang/rust/wiki/Doc-building-for-android https://github.com/rust-lang/rust/wiki/Doc-building-for-andr... More recently: https://mail.mozilla.org/pipermail/rust-dev/2014-June/010323.html https://mail.mozilla.org/pipermail/rust-dev/2014-June/010323... https://github.com/rust-lang/rust/wiki/Doc-building-for-ios https://github.com/rust-lang/rust/wiki/Doc-building-for-ios
- zanny 12y agoYou are still stuck using the GUI toolkits of the platforms in their native tongues. I think Qt and Mono (so C++ and C# respectively) are the only toolkits that support both of them with one code base.
- widdershins 12y agoJUCE also does. http://www.juce.com/ http://www.juce.com/
- lvh 12y agoPerhaps not so much a Serious UI Toolkit(TM), but anything that eventually compiles down to GL would work too. This is how play-clj does it: binding to libgdx, which eventually calls some OpenGL methods. 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.
- ntoshev 12y agoKivy does too. http://kivy.org/ http://kivy.org/
- CmonDev 12y agoRust is a browser development language. Maybe he doesn't want to bother with memory management. Besides, is there a modern IDE for Rust (automated refactoring etc.)?
- bratsche 12y agoYou could always try the Xamarin way. Basically the same APIs, but with nicer languages (C# or F# instead of Java).
- zupa-hu 12y ago> Holy crap, how do you people live like this? The hole point is getting advantages. Lucky us that it's hard; others won't keep pace!
- Timmmmmm 12y agoYeah writing java for Android is a pretty awful experience. But it's not going away soon - this Go release will only have access to the things you can already do in C++ on Android. Namely, OpenGL, audio, and touch input. That's about it. 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.
- keithwarren 12y agoAs a C# developer, have you looked at Xamarin? I have done several apps with it, shared code between iOS and Android. I highly recommend you give them a try.
- Infinitesimus 12y agoAnother .NET dev here in the same boat as OP. I really want to play with xamarin but the cost puts me off :(