In distributed computing, code mobility is the ability for running programs, code or objects to be migrated (or moved) from one machine or application to another. This is the process of moving code across the nodes of a network as opposed to distributed computation where the data is moved.
It is common practice in distributed systems to require the movement of code or processes between parts of the system, instead of data.
The purpose of code mobility is to support sophisticated operations. For example an application can send an object to another machine, and the object can resume executing inside the application on the remote machine with the same state as it had in the originating application.
- Code mobility can be either Strong or Weak
- Strong code mobility involves moving the code, data and the execution state from one host to another. This is important in cases where the running application needs to maintain its state as it migrates from host to host.
- Weak code mobility involves moving the code and the data only. This may necessitate restarting the execution of the program at the destination host.
- Several paradigms, or architectural styles, exist within code mobility
- Remote evaluation — A client sends code to a remote machine for execution.
- Code on demand — A client downloads code from a remote machine to execute locally.
- Mobile agents — Objects or code with the ability to migrate between machines autonomously.
- Mobile agent frameworks
- Aglets — Mobile agent framework, Java
- Java Agent Development Framework — Mobile agent framework, Java
- Mobile-C — Mobile agent platform, C/C++ 
- General purpose
- Fuggetta, Alfonso; Gian Pietro Picco; Giovanni Vigna (1998). "Understanding Code Mobility". IEEE Transactions on Software Engineering (NJ, USA: IEEE Press Piscataway) 24 (5): 342–361. doi:10.1109/32.685258. ISSN 0098-5589. Retrieved 29 July 2009.
- Dr Lawrie Brown. "Mobile Code Security". Australian Defence Force Academy. Retrieved April 23, 2012.
- Carzaniga, Antonio; Gian Pietro Picco; Giovanni Vigna (2007). "Is Code Still Moving Around? Looking Back at a Decade of Code Mobility". ICSE COMPANION '07 Companion to the proceedings of the 29th International Conference on Software Engineering (Washington, DC, USA: IEEE Computer Society): 9–20. doi:10.1109/ICSECOMPANION.2007.44.
- "Mobility-RPC - Seamless Code Mobility and RPC for the Java platform". Retrieved 15 June 2012.
- "Mobile-C: a Multi-Agent Platform for Mobile C/C++ Agents". Retrieved 15 June 2012.