Live data from Hacker News

A few days of programming on iOS and Android illustrates a vast difference.

plus.google.com

71–80 of 97 posts

Re: A few days of programming on iOS and Android illustrates a vast difference.

#71

Earlier quoted context omitted.

I'm a long-time game programmer, and not at all an Apple fan (somewhat the opposite, in fact). When I picked up Android I really, really wanted to like it. Every time I turned around, the Android platform surprised me. In a bad way. Full disclosure: I'm also not a Java fan, and think it was a completely brain-dead idea to make Java the first-class API. I'm certainly not a Microsoft fan, but even C#/Mono would have be…

Yes, C# is way better for games because you can write mixed format display buffers, but Java isn't that bad as long as its JITed. It limits you to post 2.2 droids, but if doesn't have 2.2 on it, it probably has the shitest of graphics hardware anyway. I dont get your other complaints though. Show me a developer guide for a console platform that doesn't have outright lies in it and I'll show you my unicorn. There is a…

Not fond of C# or Unity, really, but there are plenty of cross platform game engines at this point; see my other post. [1]

Java is still annoying to me, even JITed. It's most of the cruft of C++/OOP without the speed. I'm a Lua fan, and a conversation here isn't likely to sway me. ;)

And it's not just mistakes; it's huge areas of the APIs that are missing or confusing or just plain poorly designed. I've developed for a lot of consoles (not current gen, but XBox/PS2 and older), so I know what you mean about docs being WRONG. But for the most part they let you do what you needed. Android just doesn't in some cases.

Try to do low-latency (or even reliable latency!) audio on Android and get back to me, for an example that Google is basically ignoring.

[1] http://news.ycombinator.com/item?id=2827513

Re: A few days of programming on iOS and Android illustrates a vast difference.

#72

My problem with Android development is that, being a non-Java developer, I never knew when to use the Android SDK or the Java SDK or the Apache stuff for certain tasks. For example, networking. Googling online for solutions, I don't know if any of the Java code I find is Android compatible.

My rule of thumb: - if you see "java.awt" or "javax.swing" in any package import, run away. - if you need to download a native library to run a hello world, run away too. The rest is/should be fair game. Try to run a hello world on the device.

Is there a good library for doing graphics in Java? I was thinking about trying processing, but it doesn't seem quite appropriate.

Re: A few days of programming on iOS and Android illustrates a vast difference.

#73

Wouldn't it be better though if we did not have to rely on either apple or google for mobile programming? How about extending trusty old HTML to provide low level Apis for mobile devices? Phone gap does it and it's already proving valuable. As mobile bandwidth is becoming more stable it makes more sense to quit the app store madness and embrace the wild open web as the only app platform. In principle I do not see why…

Phonegap is a common JavaScript interface to native APIs. HTML is only tangentially related.

Building apps with JavaScript is doable, but has performance consequences that are severe on low-power mobile devices.

It's hard to fault Google for providing an open-source Java-compatible OS. It's not their fault if other OS builders are not compatible and actively block cross-platform solutions.

I haven't tried it, but I don't know a reason why one couldn't write an Android native app on Objective-C. You'd need a cross-compiler and technical/legal ability to port Cocoa though, the latter which I suspect would be quite challenging.

Re: A few days of programming on iOS and Android illustrates a vast difference.

#74

Counterpoint, and like I said on the original post: Within a few days of programming Android I had published a few apps. You just need the App-titude, and the attitude as they say. I'm on day 60 and have done 65 Android apps thus far. Perhaps my live-coding video that was up last week would help? http://www.youtube.com/watch?v=x8bu8nNUZSY&feature=chann...

Why 65 rush jobs instead of few polished apps?

Skillful Surround could be an attractive game if it got some TLC.

Re: A few days of programming on iOS and Android illustrates a vast difference.

#75

Earlier quoted context omitted.

@SomeCallMeTim >I submit it would be better for everyone if there were a single cross-platform engine that everyone used. >What would have been better is a library that abstracts away the fact that Android is its own unique OS, period. When I write code, I don't want it to be Android code, or iOS code, or WebOS code, or Windows [Mobile] code, or Linux code. --- There are options out there. I'm one of those 3rd partie…

Thanks, but I guess I didn't get across how much I still hate Java. ;) I feel it has 95% of the problems of C++, without the advantages (predictable speed, mostly). I'm sure your platform will be useful for anyone porting J2SE code to Android, but that's not me. And it doesn't look like you're supporting iPhone? That's a huge chunk of the market still. I know that middleware providers will step in to fill in the gaps…

>Thanks, but I guess I didn't get across how much I still hate Java. ;)

Can't solve that.. ;) ;)

>I feel it has 95% of the problems of C++, without the advantages (predictable speed, mostly).

I suppose you'd have to get a little more particular in the 95% of problems angle. I have been working with Java for quite some time and TyphonRT contains necessary workarounds or API extensions enabling predictable speed. For instance TyphonRT being a Java based component architecture is highly dependent on iteration over collections of components. The custom collections API in TyphonRT has recycled and resetable iterators overcoming the "iterator problem" of the standard collections API. There is a bit more of other things done too to provide predictable runtime performance. A lot of that involves staying as memory efficient as possible and not triggering GC. Of course when things get too hairy yeah native code is used. One has to do that for physics engines (Box2D / Bullet) especially on Android. I'm really loving JavaCPP which is a relatively new effort for managing native bindings (http://code.google.com/p/javacpp/).

>I'm sure your platform will be useful for anyone porting J2SE code to Android, but that's not me.

If you are most familiar with C/C++ certainly by all means go with that and the NDK and use BatteryTech, Proton SDK, or something like that to provide the core cross-platform architecture support.

>And it doesn't look like you're supporting iPhone?

Not yet, but just like Unity which you mention cross-compilation is not out of the question. Like libgdx once the main framework is mostly finalized I'll be looking at say an Angle backed for the desktop and / or other options for expanding device and environment support. The primary goal is to create a leading edge Java framework / platform first. The platform / PaaS aspects also are a priority in the short term among many other things like strong Scala support / integration over say iPhone support. A thing to keep in kind too is that TyphonRT is not just aimed at game dev, but is applicable for all dev efforts including enterprise.

So yes, if you need cross-platform support go native or use a canned 3D engine like Unity if it matches the type of game you are trying to make.

>I know that middleware providers will step in to fill in the gaps, but it's just annoying to be non-native on ALL platforms.

Hrm? C / C++ is available on the majority of platforms... ?

>http://www.batterypoweredgames.com/batterytech is one that I know that's low level, for instance -- it gives you events, OpenGL and sound on Windows, Mac, iPhone, and Android. It's pretty bare-bones, though, as far as I know.

Yes it's not a complete game engine nor is Moai which you mention you have your eye on presently. BatteryTech, libgdx, and TyphonRT provide the core architecture to abstract the common requirements (input, audio, etc.) for real time apps & games. TyphonRT also has higher level optional components for game dev including a fully featured component oriented entity system (libgdx / BatteryTech, etc. don't). This class of tech is meant for folks that can build their own engines and perhaps their own creative games rather than trying to force canned engines to do things they are not great at doing. As mentioned though there are optional components with my efforts to further assist game dev efforts beyond core architecture abstractions.

Regardless of what you choose though I hope you make some cool games for Android! :)

Re: A few days of programming on iOS and Android illustrates a vast difference.

#76
WTF? This guy is an idiot.

I make iOS and Android applications for a living. It is ridiculous to have to create a service to make a few HTTP calls. For that, Android/Java provides various threading classes so that you can keep multi-threaded code nice and neat.

With iOS, out of the box, you get NSURL and its family. You have to setup callbacks in your class and you have to keep track of your http calls per class by using things like action=whatever. What a pain. ASIHTTPRequest makes things much easier.

Ugh, this just makes me mad. Why would people listen to shitty developers? Why are you spreading this ignorance?

Objective-C is a giant paint, with opaque types. Having to remember what class you've put into a dict can get messy.

I have to work with both frameworks every day, and Android is the better framework BY FAR.

Re: A few days of programming on iOS and Android illustrates a vast difference.

#77
post #48

Counterpoint: I just began developing my first Android app a few days ago, a turn-based strategy game. I've only had an Android device for a month or so so the platform is relatively new to me, and I didn't even know Java (although, to be fair, I knew C# fairly well a couple years ago, which is arguably the same thing plus type inference.) In a few days, with relatively few problems, I was able to build an app and I'…

I prefer using and making software for iOS over Android but I think you're right. Cocoa programming requires a lot of up front knowledge about their design patterns and tools. It's no small undertaking for someone to learn about KVO, delegate pattern (so simple but confuses people for some reason, I think it's the name), MVC, and then add actions and outlets, resizing masks, and all the other unique things to Xcode/I…

Verbose is putting it mildly. Objective C isn't a bad language, but the syntax is just horrible IMO. So much extra typing to do something simple.

That said, the app I'm writing at work does a lot of stuff with strings, which you did mention specifically as a problem.

Properties also drive me crazy. just a ton of extra annoyance just to declare a variable.

I also prefer eclipse to xcode, and visual studio to both.

oh and good point about the simulator. The iOS simulators are MUCH better than the android simulator. So much faster.

Re: A few days of programming on iOS and Android illustrates a vast difference.

#78

Counterpoint: I just began developing my first Android app a few days ago, a turn-based strategy game. I've only had an Android device for a month or so so the platform is relatively new to me, and I didn't even know Java (although, to be fair, I knew C# fairly well a couple years ago, which is arguably the same thing plus type inference.) In a few days, with relatively few problems, I was able to build an app and I'…

You're high on the post-development rush. It's addicting. But it doesn't mean the platform will scale with you. I've done extensive iOS and Android development (more extensive on the Android side due to business necessity). Here's some gotchas that I've encountered, from memory, because these are only the recent ones (plus one or two memorable ones from way back).

EDIT: Disclosure - I am one of the rare types who is actually a big fan of both Java and Objective-C's syntax, though I'm more partial to Scala's approach than Java's, overall. I view Objective-C, conceptually, as somewhat in between C and Python, with good parts from both (though of course ObjC is far older)

Example #1:

I made the mistake of using ArrayAdapters, and hand-writing my own wrappers around the android sqlite libraries to manage my app's data. What did it get me? Garbage collection cycles that crashed the app, among other things.

Example #2:

I am of the opinion that in order to build a stable, robust app, Content Providers, at the very least, are required (for many reasons, the primary one currently being the ability to use LoaderManagers and CursorLoaders). But where was the documentation that explained why this was so? The complete lack of a centralized, high-level overview of Android systems have lead me to several development dead-ends, resulting in rewrites. While I'm wiser for the effort, and have finally settled on a sane, reusable, fairly general pattern for data-driven Android apps, I used up some really valuable development time finding this out. And you know what? Looking at the codebase before my (just-deployed) rewrite, and looking at the Android codebase at the job I left before it, everyone is making these same mistakes, and not many are realizing it until later.

Aside - Rant:

BaseColumns (http://developer.android.com/reference/android/provider/Base...) has no discernible use other than for a class to inherit some static variables. This is kind of ridiculous, as there's no requirement to use the column constants anyways, and they're static. I use enums instead, for each database table. Works much better. At my last job I even wrote an automatic SQL create statement generator for use in onUpgrade(). Oh, and if you want to use anything other than _id for the column name for your objects' unique IDs, you're not going to have an easy time with automatically binding your database objects to your UI.

Example #3:

Lots of stuff requires contexts. Against your common sense, you should try to avoid supplying the current activity as a context when you can use the application context instead. Why? Because if an Activity, which is a context, is retained as a member variable in something - perhaps a class that is, itself, a member variable of the aforementioned Activity, voila! You've got a circular reference and a potential memory leak! Where was this in the documentation? Nowhere. It was in a blog post that isn't exactly on most people's radar: http://android-developers.blogspot.com/2009/01/avoiding-memo...

Example #4:

Changing orientation destroys and recreates an Activity. Did a AsyncTask run at an inconvenient time? Oops. Chances are you're going to crash if you needed to do anything special with your Activity's state.

Example #5:

Using Apache's HTTP client? Careful. Don't use RequestWrapper, because executing a POST request wrapped in one can cause it to drop headers from the request. Just use different methods for HttpGet and HttpPost, and add on (for example) authentication parameters, device model names, other info for metrics, etc. separately for each. Funny thing is, I had better luck duplicating code for GET/POST here than reusing it, which I found disgusting, because duplicating code is not a good solution to anything, but it just got the work done.

Example #6:

I've gotten unreasonable Cursor closings that weren't my fault because someone at Motorola thought they were being clever and closing Cursors in a finalize() method was somehow a good idea: http://stackoverflow.com/questions/6552405/android-compatibi...

TL;DR (my main argument):

Android has many avoidable gotchas that require a solid programmer to identify and work around, but which aren't immediately fatal if ignored. Android provides a lot of infrastructure, and some of it is even good! Despite its mess of poorly-written, poorly-documented, or incorrect APIs, it manages to allow decent programmers to write pretty decent solutions and some pretty robust code. But it does a damn piss-poor job of documenting its wrongness when it rears its ugly head, and it fails to make clear that while there's freedom to do things many ways in Android, there are really only a few ways to do them well.

Rant #2:

All android devices seem to suffer from gross over-logging, some far more than others, like Motorola, or some newer HTC phones., which is a huge pain in the ass when I'm just concerned with my own error logs, and not spurious calls to the logger that the software author or device manufacturer forgot to or didn't care enough to elide.

Rant #3 (emphatically):

The worst and most fundamental flaw with it, though, IMO, is that the classes for the views and the serialization format representing them (the layout xml's) do not have anything even close to a 1:1 mapping. Serializing a class - it's not that hard. iOS does it by literally serializing the state of the view objects as configured in Interface Builder into what was once a binary file, but now is an XML file (nib, xib). Anything you can initialize or style or otherwise edit to affect the initial state of a view in interface builder or (were it reasonable) another method of directly editing the serialized representation you can also do in code. Not so in Android.

Here's a link to a post of mine last month that addresses some more gripes with Android: http://news.ycombinator.com/item?id=2737284

P.S. I've talked to Bob Lee (of Square; former core library lead of Android) about this before. Even he agreed that Android's APIs were poorly thought-out and designed in places. That's pretty damning right there.

Re: A few days of programming on iOS and Android illustrates a vast difference.

#79
post #2

Android is not a toy, you can easily see it's an improvement over traditional mobile, and it highly influenced by the web. I fought Android until I decided to throw my entire weight behind Java and settled on it as a platform. Don't fight it: learn Java proper, do a few SWT & Swing apps, feel the burn .. then do Android. You can ignore the abstractions and just "draw up" your application with Eclipse, inside one gian…

Just a point that needs clarification: how is any of this comment relevant to the points raised in the OP? That is, how does this help against the fact that Android has: * A much more complex set of (good!) abstractions that are poorly documented; * and, if I might add alongside the OP, requires a much higher workload in terms of code length and complexity, debugging, device configuration management and tools for wha…

Agreed on all counts. As for the backgrounding stuff, though, don't worry too much, as with a local binder, services become little more than classes running in the background. The ickiness from all that AIDL stuff I've found to not be particularly necessary, as you won't have other applications needing to access your service, typically. Exporting content providers to other apps doesn't seem to be particularly useful, anyways, unless you're Facebook or OEM, where apps might reasonably expect to find the content provider or service they're looking for.

Re: A few days of programming on iOS and Android illustrates a vast difference.

#80

Earlier quoted context omitted.

Could you give me an example of exactly why the claims you've made are true? Why would your app need twice as much code? Why is using the Android ui designer so much harder than iOS's equiv? What is so undocumented about IBinder? It's basic IPC? I would really like to hear reasons, not abbreviations.

Although not having used Android specifically, I can easily see the UI designer being poor compared to iOS's. I still have yet to see anything as good as Interface Builder for any other platform, and I think a lot of it just boils down to the fact that when IB was designed it was actually considered to be "the right way" to make pieces of your app from the beginning, as opposed to something bolted on later. Making a…

Moreover, Interface Builder's file format is quite literally a serialized version of the class constructed at runtime, as configured in Interface Builder. What can be done in IB can also be done in code, which is more than I can say for Android's xml.
Post reply on HN