

Why don't we have code hot swapping on mobile? - ensmotko
http://smotko.si/hotswapping/

======
willvarfar
As I recall from my distant Android app development, you could redeploy to
your phone (connected via a USB cable) in seconds, and it was never a big
hindrance.

You typically just have a 'cheat code' to take you to any level or whatever so
you are never far play-wise from where you want to be debugging.

~~~
ensmotko
You are right. Deploying takes seconds + a bit more to get to the state you're
testing. This isn't bad, it's actually quite amazing when you think about it.
But compared to instant feedback, it's in a completely different ball park.

------
zdw
Most likely security.

While this is handy for development work, the temptation to leave it in the
final version ("Hey, it works now, why 'fix' it?") would be pretty high.

~~~
ensmotko
Yes, but couldn't this be handled by the OS? You could have a special option
in the development tools, that allows you to run hot swappable apps.

~~~
archivator
It already exists. The manifest has a "debuggable" flag that allows for a
remote debugger to attach to a running app. Nothing on the Play Store is
debuggable.

------
wsc981
On iOS a system could be build to support some form of hot code swapping.
Reason being that application can load NSBundle objects at runtime and
NSBundles can contain (among other things) executable code.

Sadly, Apple doesn't allow apps to use this in release versions, as apps could
more easily exploit potential flaws in the system this way, since one could
bypass Apple's approval process.

More info on NSBundles here:
[https://developer.apple.com/library/ios/#documentation/Cocoa...](https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSBundle_Class/Reference/Reference.html)

Apparently a more "low-level" approach is possible as well, but again not
allowed by Apple: <http://stackoverflow.com/a/10509453/250164>

------
johnno1962
In fact there are some solutions out there for code injection using bundles on
iOS, e.g. the following video:

<http://vimeo.com/50137444>

It packages it all up as a plugin for Xcode.

~~~
josephlord
You can also run arbitrary code from the standard debugger although it may not
be possible to actually change the code substantially it can be useful for
exploring and experimenting.

------
comex
It's not just mobile; the only implementation of hot swapping for C I know of
is MSVC's debugger, so I'm out of luck as an OS X and Linux user. Would be
cool to implement.

------
nathanpc
Interesting article. I would love to see less limitations on mobile
development.

~~~
ensmotko
I agree. For me code swapping is such an important feature. I can't imagine
how people are doing game development without it. On the other hand, there are
a lot of games for mobile devices, so I guess it's not impossible...

~~~
pjmlp
Like we always did.

Compile, re-deploy

