|
Authored by: Anonymous on Thursday, May 03 2012 @ 10:53 PM EDT |
Well, not the greatest definition, but I've heard two dozen
this week and none have been quite perfect :)
b) In this case, what is the program? Android?
Yes, the Android operating system. It uses APIs from, for
instance, the java.net package, to interface with the web
server from his example.
c) In this case, what is Dalvik? where does that come in?
Dalvik is what's called a 'virtual machine' (VM) ... it's
kind of like a virtual computer that runs... on your
computer. Java source code is compiled into byte code,
which the VM understands. The VM then has the know-how to
talk to your underlying operating system (Windows, Linux,
MacOS, whatever). Google wrote their own Java virtual
machine, that understands a subset of what the 'official'
Sun VM does.
d) Where, in this explanation, are apps for Android placed?
Are they extensions of the big program?
Not extensions really. Your app (AngryBirds) is a program
that runs inside Android OS (Ice Cream Sandwich or
whatever). All the apps that you can download from the
Android marketplace use all of the standard Java APIs as
well.
e) Can java be used if the original API were not there?
Tricky question, depends on what you mean by 'use java'.
Yes, you could use the Java syntax, and have complete new
implementations for programmers to learn e.g.:
java.util.List.add(java.lang.Object) vs
com.google.GList.addItem(com.google.GObject)
But really, to call it Java you have to be able to expect
that standard APIs will be there. The reason for choosing
Java as the platform was to entice the huge community of
Java developers to write apps for Android, and if you can't
use the APIs you're used to, it's not really Java.
f) Are the 9 lines of code the case keeps dwelling on in
Java's API?
Nitpicky but no it's not in the API, it's in the -
implementation- of the API. In this case it's something
like (this is not accurate code):
private boolean java.SomeClass.checkBounds() {
// Line 1
// Line 2
...
}
so the first line (private boolean...) is the API -- the
"method signature" of this block of code. The 9 lines in
question are the lines of code inside this "method" that
actually do the work to check the bounds of the array. In
this case, ironically the APIs are different :)
(java.util.Arrays.rangeCheck() is Oracle's API,
java.util.TimSort is Google's)[ Reply to This | Parent | # ]
|
|
|
|
|