Live data from Hacker News

Android platform engineer on application architecture

plus.google.com

61–70 of 124 posts

Re: Android platform engineer on application architecture

#61
post #4

The fact that an Android platform engineer doesn't know of design patterns beyond MVC, and only knows that vaguely by reputation, explains why it's so difficult to build well designed apps for Android. Yes, technically the platform APIs don't "care" about what's going on in an app. But when the APIs are designed in such a way as to (inadvertantly) work against MVC or other design patterns, they make developer lives m…

Actually I'd attribute the difficulty to the culture of "Java-ism" that emphasises huge, complex, design-pattern-filled "extensible" architectures which happen to be extensible only in very specific ways. I wanted to take up casual writing of Android apps as a hobby, mainly because I think the little portable computer I keep in my pocket could become so much more useful, but the unusual API combined with the complexi…

26min into the 2014 Google I/O Android fireside chat: https://youtu.be/K3meJyiYWFw?t=26m

Q: So I was wondering if you guys at any point considered the support -- the official support -- of the Scala programming language. I'm asking this question especially now that we all saw that Apple released Swift after 4 years of work. And I think that Swift allows for things for iOS developers that we can't do in Java with the Android SDK. So my question was: have you ever thought about it before -- the release of Swift? Have you thought about it after that? Is there any plan?

Android answer 1: Well, so, I like Cocoa, but Objective-C is based on C, which is 40 years old, so I think Apple sort of had to, like, update it a bit. Umm, so, yeah [laugh], I don't know. Scala -- I don't know. Anyone want to take that? [Android team laughs]

Android answer 2: [loudly] No. [room laughs, claps] Alright, seriously, it's -- Java is the programming language for Android. I don't really think there's a lot of benefit to -- the entire framework is built around the Java programming language and I don't really -- I don't think there's much benefit for us to try to support another whole -- another different language.

Person from answer 1: What about Swift? [room laughs]

Person from answer 2: [jokingly] I'll think about it.

Person from answer 1: [mockingly] It's got optional semi-colons.

Person from answer 2: You have the NDK so you can throw something there. But the NDK -- it doesn't have access to the framework, and that's kind of the challenge. If you want to do a different language, if you want to have it as a first-class language equivalent to the current framework you've got to have either a whole new framework or some bindings to it, which is going to make it a really bad experience because it's going to be Java and this other language.

Q: I want to work with Scala because Scala is compiled to the JVM, so it can run on Android. So there are currently ways to do that -- to work with Scala -- but it's using third-party libraries. So you have classes -- that's what I meant by people to wrap their Java classes, but then it becomes tricky to integrate that cleanly with Android Studio. That also evolves quickly. I'm not sure if it's as complicated as creating a whole new language like Apple did, but my question was just if you guys were considering any...

Android answer 3: From the tool perspective, probably later this year or early next year, there are some changes going on inside Gradle right now that will make things easier to you to just have a module that's originally written in Scala that you compile down to bytecode and then we can just dex that and package that with your application. But it's not going to help you access the activity API through Scala code. It would be -- if you have some code that -- your business logic or whatever that you want to write in Scala because it's easier for you, you should be able to do that. Because as you said, it's compatible. It just generates regular bytecode and then just dexing it. But that's very different from saying "you can code Android in Java" where you have access to all the framework APIs.

Re: Android platform engineer on application architecture

#62
post #4

The fact that an Android platform engineer doesn't know of design patterns beyond MVC, and only knows that vaguely by reputation, explains why it's so difficult to build well designed apps for Android. Yes, technically the platform APIs don't "care" about what's going on in an app. But when the APIs are designed in such a way as to (inadvertantly) work against MVC or other design patterns, they make developer lives m…

Actually I'd attribute the difficulty to the culture of "Java-ism" that emphasises huge, complex, design-pattern-filled "extensible" architectures which happen to be extensible only in very specific ways. I wanted to take up casual writing of Android apps as a hobby, mainly because I think the little portable computer I keep in my pocket could become so much more useful, but the unusual API combined with the complexi…

I wonder if Google's ultimate goal is to make "Android apps" all work on Native Client/LLVM.

It already seems to be the goal to make all Java apps work on Native Client on Chrome OS. But once that's done, couldn't they just allow anyone to write apps in Go, Rust, Python, etc for Native Client directly? (and thus eliminating what will probably be some performance penalty of running Dalvik apps on Native Client).

That way Google gets to deprecate Java apps in the next 5-10 years and be done with Oracle forever, and developers would have a choice of some really good and safe languages as well.

Re: Android platform engineer on application architecture

#63

Unfortunately, the contents of this post are no surprise to any seasoned Android developer. It's very clear the Android engineers haven't given a lot of thought to how applications are to be developed. I'm all for them not enforcing one methodology over another. However, in order to build an Android application (following whatever pattern) we do need core building blocks that have been well thought through on how the…

Not only didn't they give a lot of thought on how apps are to be developed, they made a bunch of really shortsighted design choices that continue to harm Android as a platform today. First is the stupidity of Activities. The basic idea was that 1 screen = 1 activity and we can remove all non-active activities from memory and restart them as needed. This was clearly designed with an eye on memory constrained systems.…

Android is usually pointed to as a success story for Java performance. I thought that it was just us that had performance issues because we were developing a big app with a completely custom UI... Interesting to see that others feel this way.

The conclusion is that it almost doesn't matter what language you choose for a platform if you have enough man-power and resources and you can force developers to use it. :)

Re: Android platform engineer on application architecture

#64

Unfortunately, the contents of this post are no surprise to any seasoned Android developer. It's very clear the Android engineers haven't given a lot of thought to how applications are to be developed. I'm all for them not enforcing one methodology over another. However, in order to build an Android application (following whatever pattern) we do need core building blocks that have been well thought through on how the…

> Frameworks should be written for consumers, not maintainers.

Welcome to Worse is Better. This is literally what Unix went against. People used to write that way before; now it has to be easiest for platform developer/maintainer.

Re: Android platform engineer on application architecture

#65

Earlier quoted context omitted.

Actually I'd attribute the difficulty to the culture of "Java-ism" that emphasises huge, complex, design-pattern-filled "extensible" architectures which happen to be extensible only in very specific ways. I wanted to take up casual writing of Android apps as a hobby, mainly because I think the little portable computer I keep in my pocket could become so much more useful, but the unusual API combined with the complexi…

26min into the 2014 Google I/O Android fireside chat: https://youtu.be/K3meJyiYWFw?t=26m Q: So I was wondering if you guys at any point considered the support -- the official support -- of the Scala programming language. I'm asking this question especially now that we all saw that Apple released Swift after 4 years of work. And I think that Swift allows for things for iOS developers that we can't do in Java with the…

good find

Re: Android platform engineer on application architecture

#66

Unfortunately, the contents of this post are no surprise to any seasoned Android developer. It's very clear the Android engineers haven't given a lot of thought to how applications are to be developed. I'm all for them not enforcing one methodology over another. However, in order to build an Android application (following whatever pattern) we do need core building blocks that have been well thought through on how the…

Not only didn't they give a lot of thought on how apps are to be developed, they made a bunch of really shortsighted design choices that continue to harm Android as a platform today. First is the stupidity of Activities. The basic idea was that 1 screen = 1 activity and we can remove all non-active activities from memory and restart them as needed. This was clearly designed with an eye on memory constrained systems.…

That seems very unfair.

Android invested up front in more complex technology that would allow adaptation to future hardware devices. Most obviously, by using layout managers instead of pixel positioning like iOS did. That meant Android was able to adapt to a range of screen sizes way earlier than Apple could. Every time Apple tried to introduce a new screen size or resolution it resulted in major pain across their entire app ecosystem, something many Android apps avoided.

Phones are still memory constrained. Yes they have "shitloads" of RAM compared to previous devices but they still don't have a swap file of any kind. The activity model allows phones to have an apparently infinite number of apps open, without the UI ever stalling due to hitting a paging storm like desktop apps can. Simply increasing the amount of RAM doesn't solve the problems the activity model was designed to solve, and it's worth noting that when Apple introduced multi-tasking into iOS, they ended up with something quite similar to activities.

The choice of Java had complex effects on memory usage. Whilst Java heaps can be kind of piggy, a lot of memory usage comes from loaded code, and bytecode is a lot more compact than native code is. That's why they're reintroducing JIT compilation in Android N - having moved to fully AOT when ART was introduced they are now going back again to reduce memory pressure.

The decision to support SD cards made a lot of sense back in the days when internal storage was a lot more limited.

Re: Android platform engineer on application architecture

#67
post #56
post #37

Earlier quoted context omitted.

You mean like the sets of support libraries which make multi-versioned Android development significantly easier and less time consuming? I don't get the first-party library cargo cult that has developed on Android. What's wrong having the community develop libraries like on any other platform? There's a huge set of very good quality 3rd party Android libraries and even a great new language (Kotlin). As a dev I'd be r…

There is no excuse for how hard the permissions API is to use. Why can we not know if the user has "never show again " checked directly? It literally looks like the API and ui came from different proposals

Because you don't need to know. Permissions are sacred. If you don't have the permission, consider the capabilities aren't there and move on.

How would you feel if Facebook or Instagram app refused to start if you didn't give it camera permission? Maybe I don't have a working camera in my Nexus 6.

Re: Android platform engineer on application architecture

#68

Earlier quoted context omitted.

Not only didn't they give a lot of thought on how apps are to be developed, they made a bunch of really shortsighted design choices that continue to harm Android as a platform today. First is the stupidity of Activities. The basic idea was that 1 screen = 1 activity and we can remove all non-active activities from memory and restart them as needed. This was clearly designed with an eye on memory constrained systems.…

That seems very unfair. Android invested up front in more complex technology that would allow adaptation to future hardware devices. Most obviously, by using layout managers instead of pixel positioning like iOS did. That meant Android was able to adapt to a range of screen sizes way earlier than Apple could. Every time Apple tried to introduce a new screen size or resolution it resulted in major pain across their en…

> Android invested up front in more complex technology that would allow adaptation to future hardware devices. Most obviously, by using layout managers instead of pixel positioning like iOS did.

Layout managers are complex technology now ? The layout managers Android uses are pretty much identical to what Java used in AWT and Swing and is trivial to implement. I know because I implemented just such a thing for a UI toolkit I made for J2ME back in the day. Desktop apps have been doing it for decades. iOS by contrast uses a much more complicated system (not saying it's better, just more complex).

Also, I vastly prefer iOS's sytem with just a handful of resolutions so you can fine-tune your designs to the exact screen dimensions. In practice I've found it very hard to explain Android's layout mechanisms to designers and to get good designs from them that scale well. Most designers I know prefer being able to make a pixel-perfect design like you can on iOS. Sure it works fine for business-style apps but if you want to make something spiffy, you're fucked on Android.

> when Apple introduced multi-tasking into iOS, they ended up with something quite similar to activities.

iOS has nothing even remotely resembling activities. Background apps can be suspended and possibly killed, but that's as far as the parallelels go. Don't even get me started on the insane idea of Intents (sounds like a great concept but horrible in practice and badly implemented too).

> The activity model allows phones to have an apparently infinite number of apps open, without the UI ever stalling due to hitting a paging storm like desktop apps can.

Then why is this not an issue at all on iOS. In fact, my 6S pretty much never kills background apps and even when it does that does not affect foreground performance. And if they were so concerned about the UI stalling, they should have stayed away from Java. It has improved a little bit but especially in the early days the GC would regularly freeze the entire JVM for 100+ ms. Try hitting 60fps like that.

> The choice of Java had complex effects on memory usage. Whilst Java heaps can be kind of piggy, a lot of memory usage comes from loaded code, and bytecode is a lot more compact than native code is.

Wut ? Loaded code is a completely negligible part of an apps memory usage. And again, not an issue on iOS. In fact memory is far more constrained on Android than on iOS even when Android devices have more physical RAM. Android severely limits the amount of RAM an application can use (the heap size limit). I've never run into problems with RAM usage on iOS and regularly on Android. On a 1GB iPhone you can easily use 700-800MB RAM for your app if you wanted, while you're lucky if you can get 192MB on a 3GB Android phone.

Furthermore, garbage collected languages use about 3 times as much RAM as a non-GC language for similar performance (tradeoff between how often the GC runs vs performance) negating any and all gains of a smaller code size. There is also this thing called the ARM Thumb instruction set which results in smaller binaries if that really is an issue.

> The decision to support SD cards made a lot of sense back in the days when internal storage was a lot more limited.

And this goes to the heart of my criticism: yes internal storage was a lot more limited back then. Both Google and Apple knew this. They both also knew (or should have) that internal storage was going to improve a LOT and very quickly at that. This is the point I'm trying to make: Google develops for yesterdays and todays constraints while they should be developing for tomorrows. In fact, Google should look farther into the future than Apple does because it takes so long for their software to reach consumers, it's taking 2-3 years for any new Android release to gain any significant market share. Android N should be built with 2019's phone hardware in mind, instead it's being built for 2015 hardware.

Re: Android platform engineer on application architecture

#69
post #63

Earlier quoted context omitted.

Not only didn't they give a lot of thought on how apps are to be developed, they made a bunch of really shortsighted design choices that continue to harm Android as a platform today. First is the stupidity of Activities. The basic idea was that 1 screen = 1 activity and we can remove all non-active activities from memory and restart them as needed. This was clearly designed with an eye on memory constrained systems.…

Android is usually pointed to as a success story for Java performance. I thought that it was just us that had performance issues because we were developing a big app with a completely custom UI... Interesting to see that others feel this way. The conclusion is that it almost doesn't matter what language you choose for a platform if you have enough man-power and resources and you can force developers to use it. :)

Java performance on Android is crap. The real succes story for Java performance is on the server side.

Re: Android platform engineer on application architecture

#70

Earlier quoted context omitted.

That seems very unfair. Android invested up front in more complex technology that would allow adaptation to future hardware devices. Most obviously, by using layout managers instead of pixel positioning like iOS did. That meant Android was able to adapt to a range of screen sizes way earlier than Apple could. Every time Apple tried to introduce a new screen size or resolution it resulted in major pain across their en…

> Android invested up front in more complex technology that would allow adaptation to future hardware devices. Most obviously, by using layout managers instead of pixel positioning like iOS did. Layout managers are complex technology now ? The layout managers Android uses are pretty much identical to what Java used in AWT and Swing and is trivial to implement. I know because I implemented just such a thing for a UI t…

Regarding GC, Windows Phone apps are garbage-collected, yet Windows Phones has a great reputation for smoothness and responsiveness on anemic hardware like the Nokia 520.
Post reply on HN