Discussion:
Writing native Android applications with Javascript? Not yet.
(too old to reply)
softwares
2012-03-15 17:35:28 UTC
Permalink
The number of people using Linux (and I mean Linux the kernel) and
free software in general has exploded in the last 2 years thanks to
Android and Google. Even if you want to discard phones and only count
the tablets (which are starting to get very close to laptops in terms
of what you can do with them), the number of new users is huge. And
yet, we are all hostage of a choice -- a bad choice, in my humble
opinion -- that Google made: Java.
Why Java?
http://sapientarticles.com/soft/
Reason #1: Android came with Java! To be fair, it wasn't Google's
choice as such: Google bought Android in 2005, and I can only suspect
that Android was well entrenched in Java at that point.

Reason #2: In 2005, Java was still pretty much your only choice if you
wanted to write applications once, and expect them to run regardless
of what CPU you used.

Reason #3: Java was (and is) well known and widely used.
It's all about timing

In 2005, it probably made a lot of sense using Java. So, what has
changed? Two words: 1) Chrome 2) Javascript I am convinced that Chrome
and Javascript changed the whole IT landscape radically. Mind you,
Chrome beta was released in September 2008. The first version of
Android would be released a couple of months later (!). While Android
was being created, Chrome simply wasn't around.
http://sapientarticles.com/soft/
What's so important about Chrome?

Chrome came with the v8 Javascript engine. V8 is a monster of a
virtual machine, able to get Javascript code and make it spin really,
really fast -- faster than the speed of light. With Chrome, Javascript
turned: it went from being a sluggish scripting language, to being
something that could be used for real applications. Google was
interested in a browser that people could use to run their emerging
online applications (Google Docs was around in 2006). I am not sure
they realised that they could push Javascript to run that fast --
maybe it caught Google itself by surprise.
http://sapientarticles.com/soft/
In the end, if Google had to decide how to build Android in 2008
rather than 2005, I have little doubt that they would have picked
Javascript as their language of choice. Instead, Android has fully
embraced Java -- although they tried to bypass some of the patents and
issues with Java by using Dalvik. At the moment, to develop an Android
application you write Java code, compile it into a .class file (Java's
compiled code), and then convert that .class file into a Dalvik file
(which will be then interpreted by Android's internal Dalvik virtual
machine).
Is it too late?

At the moment, if you want to write an application for Android you are
pretty much stuck with Java. There are ways around I must say: one of
them is Phonegap which is released under a free license and is indeed
very exciting. PhoneGap is essentially a browser application that will
contain your code, written as HTML/CSS/Javascript. Whatever you create
is not native: it's a custom browser that has access to the device's
hardware, and that runs your web-like code.

What about native Applications?

You could convert Javascript code into a Java class using Rhino.
However, things are not easy: the Dalvik virtual machine doesn't work
nicely with dynamic languages . It's a pretty messy business.
The possible solutions
http://sapientarticles.com/soft/
Since Google is about to include V8 into Android 4 (or so it seems),
we would have a situation where your phone would include two very fast
virtual machines (Dalvik for Java and V8 for Javascript), but you can
only write native applications for one of them.

My idea is that Google should provide, natively, a bridge between the
Dalvik world and the Javascript world, so that it is finally possible
to write native Android applications using Javascript. This can be
done two ways: the obvious way is to make Dalvik work with Javascript
code. To me, it's looking less and less likely that this will ever
happen.
http://sapientarticles.com/soft/
The other option is quite involved: it would require Google to make it
possible to have native applications written in Javascript, and allow
them to access the system libraries (System C library, Media
Libraries, Surface Manager, SGL, LibWebCore, 3D libraries, FreeType,
SQLite) from Javascript. You will also need the Java.hardware classes
(in Javascript). This way, Native Javascript applications wouldn't
come with an overhead as big as a full browser for a start (there
would be no need, since all you are using is the V8 virtual machine,
like Node.JS did).
http://sapientarticles.com/soft/
Am I dreaming? Maybe. I wonder if I am the only one who thinks that
being locked to Java deserves a solution -- a real one.
http://sapientarticles.com/soft/
softwares
2012-03-20 16:46:10 UTC
Permalink
Post by softwares
The number of people using Linux (and I mean Linux the kernel) and
free software in general has exploded in the last 2 years thanks to
Android and Google. Even if you want to discard phones and only count
the tablets (which are starting to get very close to laptops in terms
of what you can do with them), the number of new users is huge. And
yet, we are all hostage of a choice -- a bad choice, in my humble
opinion -- that Google made: Java.
Why Java?http://sapientarticles.com/soft/
Reason #1: Android came with Java! To be fair, it wasn't Google's
choice as such: Google bought Android in 2005, and I can only suspect
that Android was well entrenched in Java at that point.
Reason #2: In 2005, Java was still pretty much your only choice if you
wanted to write applications once, and expect them to run regardless
of what CPU you used.
Reason #3: Java was (and is) well known and widely used.
It's all about timing
In 2005, it probably made a lot of sense using Java. So, what has
changed? Two words: 1) Chrome 2) Javascript I am convinced that Chrome
and Javascript changed the whole IT landscape radically. Mind you,
Chrome beta was released in September 2008. The first version of
Android would be released a couple of months later (!). While Android
was being created, Chrome simply wasn't around.http://sapientarticles.com/soft/
What's so important about Chrome?
Chrome came with the v8 Javascript engine. V8 is a monster of a
virtual machine, able to get Javascript code and make it spin really,
really fast -- faster than the speed of light. With Chrome, Javascript
turned: it went from being a sluggish scripting language, to being
something that could be used for real applications. Google was
interested in a browser that people could use to run their emerging
online applications (Google Docs was around in 2006). I am not sure
they realised that they could push Javascript to run that fast --
maybe it caught Google itself by surprise.http://sapientarticles.com/soft/
In the end, if Google had to decide how to build Android in 2008
rather than 2005, I have little doubt that they would have picked
Javascript as their language of choice. Instead, Android has fully
embraced Java -- although they tried to bypass some of the patents and
issues with Java by using Dalvik. At the moment, to develop an Android
application you write Java code, compile it into a .class file (Java's
compiled code), and then convert that .class file into a Dalvik file
(which will be then interpreted by Android's internal Dalvik virtual
machine).
Is it too late?
At the moment, if you want to write an application for Android you are
pretty much stuck with Java. There are ways around I must say: one of
them is Phonegap which is released under a free license and is indeed
very exciting. PhoneGap is essentially a browser application that will
contain your code, written as HTML/CSS/Javascript. Whatever you create
is not native: it's a custom browser that has access to the device's
hardware, and that runs your web-like code.
What about native Applications?
You could convert Javascript code into a Java class using Rhino.
However, things are not easy: the Dalvik virtual machine doesn't work
nicely with dynamic languages . It's a pretty messy business.
The possible solutionshttp://sapientarticles.com/soft/
Since Google is about to include V8 into Android 4 (or so it seems),
we would have a situation where your phone would include two very fast
virtual machines (Dalvik for Java and V8 for Javascript), but you can
only write native applications for one of them.
My idea is that Google should provide, natively, a bridge between the
Dalvik world and the Javascript world, so that it is finally possible
to write native Android applications using Javascript. This can be
done two ways: the obvious way is to make Dalvik work with Javascript
code. To me, it's looking less and less likely that this will ever
happen.http://sapientarticles.com/soft/
The other option is quite involved: it would require Google to make it
possible to have native applications written in Javascript, and allow
them to access the system libraries (System C library, Media
Libraries, Surface Manager, SGL, LibWebCore, 3D libraries, FreeType,
SQLite) from Javascript. You will also need the Java.hardware classes
(in Javascript). This way, Native Javascript applications wouldn't
come with an overhead as big as a full browser for a start (there
would be no need, since all you are using is the V8 virtual machine,
like Node.JS did).http://sapientarticles.com/soft/
Am I dreaming? Maybe. I wonder if I am the only one who thinks that
being locked to Java deserves a solution -- a real one.http://sapientarticles.com/soft/
Search Engine Optimization companies are making a fortune by doing the
menial work that is overlooked by many designers. It is ridiculously
easy to do most of the work done by most SEO companies, all you have
to do is create good habits.

There are 9 main points you should focus on:

• Keywords
• URL Text
• Description, Meta tags
• Title tags
• Image Names
• ALT tags
• Heading tags
• Content
• Hyperlinks

The focus of these 8 steps is to load your pages with as many
"keywords" as possible.

Keywords
Keywords are the most important aspect of good SEO, this is where you
tell the Search Engines what your site is about. Search Engines use an
algorithm to determine the "Keyword Density" of your site, this
formula is:

Total Words ÷ Keywords= Keyword Density

Use this formula on your competitors web site and see how they score,
then aim to beat that score.

Choose keywords that best relate to the information, products or
services that you are offering. For instance, if I am designing a site
about "Web Design", I want my site to include the words "Web Design"
as many times as possible.

However, most people don't just search for just one word, they type
phrases, so you should consider the phrases that best suit your sites
target market. For example, if I am creating a site about "Web Design"
in New Orleans, I would include "New Orleans web design" in my
keywords. Another way around this is to not separate my keywords with
commas, just use spaces, and the Search Engines will make the phrases
for you. The most important thing to remember is that the content of
each page is different, so only use keywords pertaining to that page.
http://www.sapientarticles.com/soft/search_result.php/cp/1/kw/seo
URL Text
When you name a new page you have the option to call it anything you
could possibly think of, why not se a keyword? After all, the URL
address is the first things a search engine comes across when indexing
your pages. You have to remember content doesn't come easy to
everyone, so you gotta slip in your keywords when the process gives
you an easy one.

Description Meta tags
These tags are dwindling in importance since Search Engines are now
looking at content, but every little bit counts.
http://www.sapientarticles.com/soft/search_result.php/cp/1/kw/seo
Optimize your meta tags to match your content, products, and services,
and the Search Engines that still look at meta data will reward your
efforts.

Title Tags
Title tags are the tags that tell the Search Engine the title, or
formal description of the document or page. This is the word or phrase
that is seen at the top of the browser window. The most important rule
about title tags is, don't put anything in the title tags but
keywords. Once again this is an easy time to slip in your keywords, so
don't miss out.
http://www.sapientarticles.com/soft/search_result.php/cp/1/kw/seo
Image Names
As I said before, content doesn't come easy to everyone, so slip in
your keywords whenever possible, this applies to image names. If you
are saving a picture of a guy working on a computer for your web
design web site, don't call it "some_dude.jpg", call it
"web_site_design.jpg". The Search engine will look at the code for the
site and see the image pertains to the content of the site and this
will be another relevant element on that particular page. You have to
take the easy ones when you are given a chance.

ALT tags
Alt tags are keywords that you can attach to images, giving more
weight to the image since Search Engines can't analyze the content of
the image itself. Here is a chance to slip in more keywords without
writing great content, use it.
http://www.sapientarticles.com/soft/search_result.php/cp/1/kw/seo
Heading tags
Heading tags are associated with the bold font that leads into a
section of text. Like this:

Web Design
Web Design Inc. offers custom web site designs...

Your heading tags should only be keywords, and should be presented in
the order that your Meta tags follow.

H1= first meta tag, H2= second meta tag...

Try to utilize all 6 heading tags on each page to ensure maximum page
optimization.
http://www.sapientarticles.com/soft/search_result.php/cp/1/kw/seo
Content
As every expert will tell you, "Content is King." Each web page should
have at least 350 words on it, and the more the better, but keep in
mind the formula for keyword density. You don't want to fill a page
with 1500 words of jibba-jabba and only 5 keywords in it. Some people
get hung-up on how browsers display text, and use images with text in
them because they want a cool font, but browsers can't read the text
embedded in images, so this content ads no weight to the page in a
Search Engines eyes.
http://www.sapientarticles.com/soft/search_result.php/cp/1/kw/seo
Linkbaiting is the new trend among high ranking sites. Linkbaiting
means writing quality content, or articles that other web sites can
display on their pages as long as they give credit, and a link to your
site.

You don't have to be a vi or emac expert to write good web content,
just be thoughtful of how you word things and incorporate your
keywords.
http://www.sapientarticles.com/soft/search_result.php/cp/1/kw/seo
Hyperlinks
Hyperlinks are text links to other pages on your site. The rules of
SEO and hyperlinks are easy:

• Use hyperlinks so the Search Engine will have a text link to follow
to the next page
• Don't use one word links, use long link phrases, preferably keyword
phrases
• Use bullets, or some sort of small image that you can attach an ALT
tag to, this will ad more importance to the link, and throw in a
couple of free keywords for you.

Keep these 9 aspects in mid when designing a site, and you are sure to
have a leg up on the competition.

Loading...