Cours Porting C++ to Java

Extrait du cours porting C++ to Java

Java has taken the programming world by storm. In our own experience in developing software at Taligent, its turnaround time is several times faster than that of C++, a crucial feature in today’s markets. Moreover, it has significant advantages over C++ in terms of portability, power, and simplicity. These advantages are leading many people to consider replacing C++ with Java, not only for web applets, but increasingly for client and server applications as well.
If it ain’t wrong…
Since to a large degree Java follows C++ conventions, the bulk of your code will remain unchanged: variable names, flow of control, names of primitive types, and so on. As you do in C++, in Java you will write classes, override methods, overload methods,write constructors, instantiate objects, and so on. The following elements of the twolanguages are very close and generally need little modification.
o char, int, short, long, float, double, void (but not void*)
o variable names
·Flow of Control
o if, else, for, while, do, switch, case, default, break, continue, return, static
o +, -, !, %, ^, &, *, |, ~, /, >, <, (), [], {}, ?:, ., =, ++, –, ==, <=, >=, !=, >>, <<,||, &&, *=
o /*…*/, //
The compiler is yourfriend
The Java compiler is much more rigorous than that of C++, so much of the code that needs to be changed will be found by the compiler. With each description of a porting task, examples will show you what you have to do to C++ code to change it to Java code. In these examples, corresponding lines of code in C++ and Java are lined up (although in some older browsers this doesn’t work properly). The text is also color-coded, in the following fashion.
Getting down to business
This article is divided up into the web pages below. (It is not split up further, since it is pretty annoying to print very many pages with today’s browsers.) It is also organized to be useful when printed, with some caveats.[4] On each page in this article, there are links to the sections on that page, plus links to the top of the page (that look like ). There are also the occasional footnotes, which are indicated in the text with a superscripted number in brackets [3]  and found at the very end of the article.
Placement is Everything
Before you start porting, first create the directory structure that you will use. First, figure out what your main package name is. To get it, take your domain name and reverse the fields. Thus xyz.combecomes If you have two directories abcand deffor your project, then their packages become Now create directories that correspond to this structure, and copy all of your sources to the appropriate directory.

Si le lien ne fonctionne pas correctement, veuillez nous contacter (mentionner le lien dans votre message)
Cours Porting C++ to Java (391 KO) (Cours PDF)
Porting C to Java

Télécharger aussi :

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *