开发者

Why firefox is written in C++ and javascript UI?

Well..I am learning java now and I am curious to know will this yield a noticeable performance increase ? And If many developers are following similar methodology for windows programming ( C++ back end and Java UI ) or other开发者_JS百科 languages are used like python?

*this : C++ back end and other languages for UI instead of using the other language to write the whole program .


Firstly, Java and JavaScript are completely different and unrelated languages. Firefox uses JavaScript; it does not use Java at all.

Secondly, this was not done for performance reasons, it was done to make it simpler to write add-ons and extensions that can be used with Firefox on any platform. C++ code needs to be compiled, and once compiled will only run on the platform that it was compiled for. JavaScript is an interpreted language which runs in an interpreter embedded in the browser, and so the same extensions can generally run on MacOS, Linux, or Windows (or anything else that Firefox runs on).

And yes, there are other programs that use scripting languages for this sort of purpose (to allow easy customization and extension). For example, Civilization IV's UI and game logic is written entirely with Python and XML for this reason, while the performance-intensive graphics code is still in C++.


This question really doesn't make any sense unless you're really asking whether you should implement your applications as XUL applications. Javascript by itself doesn't give you anything with which to build a user interface. A tremendous amount of the code in Firefox is C++ code to provide the Javascript components with a UI framework.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜