Menu
Home
Log in / Register
 
Home arrow Computer Science arrow Android Application Development for the Intel Platform
< Prev   CONTENTS   Next >

Programming Languages

During the past four decades, dozens of programming languages have been developed for general-purpose computer applications. From FORTRAN, C/C++, ADA, and Java† to C#NET. Many factors determine a programming language's suitability. Each has its own characteristics, and comprehensive comparisons are impossible. Each language's performance depends on the execution environment. Considering multiple factors and actual development status, the common languages for Android systems include C/C++, Java, and Python†, and occasionally assembly language is used. A combination of languages is needed for programming a sophisticated Android system. The common programming languages are shown in Table 3-1.

Table 3-1. Commonly Selected Programming Languages

Level Common Programming Languages

Application software C/C++, Java, .NET, script, Python

OS level C/C++, Assembly

Driver program level C/C++, Assembly Boot code, Hardware Abstract Layer (HAL) Assembly, C/C++

Java, launched by Sun Microsystems in May 1995, is a cross-platform object-oriented programming language and includes the Java programming language and Java platforms (JavaSe, JavaEE, JavaME). Java's style is very similar to that of C and C++. It is a pure

object-oriented programming language that has inherited the core contents of the object-oriented C++ and abandoned the pointer (replaced by reference), operator

overloading, and multiple inheritance (replaced by interface) in the C++ language, which caused frequent errors. The added Garbage Collector is used for collecting memory occupied by unreferenced objects so the programmer does not need to worry about memory management. In the Java 1.5 version, Sun added other language features such as generic programming, type-safe enum class, variable-length augment, and autoboxing/ auto-unboxing.

Java is different from ordinary compilation and execution computer languages in that it is an interpretive computer language. The Java compiler produces binary byte code instead of machine code, which can be executed directly and locally. Compiled Java programs are interpreted into directly executable machine code via Java virtual machine (JVM). The JVM can interpret execution byte code on different platforms to realize the cross-platform feature of “one-time compilation for all executions.” However, it takes

some time to interpret byte code, which will to some degree reduce the running efficiency of Java programs. To reduce this burden, Google introduced Android Run Time (ART)

in 2014 as a Dalvik version 2, which first became available as a preview feature in KitKat (Android 4.4). Future 64-bit Android will be based on ART. In general, Java is a simple, object-oriented, distributed, interpretive, and stalwart. It is an implantable,

high-performance, multi-threaded and dynamic programming language. Considering various advantages of Java, it is the first choice for Android application development.

Having chosen a language, you may not necessarily use all of its functions. Although we have selected Java as the development tool for Android, the development process for Android systems is different from traditional (desktop) Java SDK. The Android SDK uses most of the Java SDK, but has abandoned some portions. For example, for the interface, the java.awt package is only referenced by java.awt.font. If a Java game is migrated to the Android platform, it might need to be ported.

We have mentioned that Java is a cross-platform interpretive computer language.

This feature has enabled the high migration capability regardless of platform, but it also has some drawbacks, one of which is that the developer cannot use platformor architecture-related features or potential. But this can be achieved by machine-related target code by compiling C/C++ and assembly languages. This is more obvious during performance optimization. To use the features of the machine hardware and tap into their performance potential, we usually need to use C/C++ and assembly languages for writing optimized applications. Although such code accounts for a small proportion of all code, the programming complexity is much higher than Java. Therefore, such code is only used in some rare cases. We'll see that Android application development has adopted

a mixed programming mode based mainly on improved Java and supported by C and assembly languages.

We're going to discuss this programming method in two parts. For developing general functions of Android applications, we are going to use Java. But for performance optimization, we're going to use a mixed-language programming approach.

 
Found a mistake? Please highlight the word and press Shift + Enter  
< Prev   CONTENTS   Next >
 
Subjects
Accounting
Business & Finance
Communication
Computer Science
Economics
Education
Engineering
Environment
Geography
Health
History
Language & Literature
Law
Management
Marketing
Philosophy
Political science
Psychology
Religion
Sociology
Travel