⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tij0030.html

📁 学习java的经典书籍
💻 HTML
字号:
<html><body>

<table width="100%"><tr>
<td>
<a href="http://www.bruceeckel.com/javabook.html">Bruce Eckel's Thinking in Java</a>
</td>
<td align="right">
<a href="tij_c.html">Contents</a> | <a href="tij0029.html">Prev</a> | <a href="tij0031.html">Next</a>
</td>
</tr></table>
<hr>

<H2 ALIGN=LEFT>
Java
vs. C++?
</H2>
<DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">Java
looks a lot like C++, and so naturally it would seem that C++ will be replaced
by Java. But I&#8217;m starting to question this logic. For one thing, C++
still has some features that Java doesn&#8217;t, and although there have been a
lot of promises about Java someday being as fast or faster than C++ the
breakthroughs haven&#8217;t happened yet (it&#8217;s getting steadily faster,
but still hasn&#8217;t touched C++). Also, there seems to be a perking interest
in C++ in many fields, so I don&#8217;t think that language is going away any
time soon. (Languages seem to hang around. Speaking at one of my
&#8220;Intermediate/Advanced Java Seminars,&#8221; Allen Holub asserted that
the two most commonly-used languages are Rexx and COBOL, in that order.)
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">I&#8217;m
beginning to think that the strength of Java lies in a slightly different arena
than that of C++. C++ is a language that doesn&#8217;t try to fit a mold.
Certainly it has been adapted in a number of ways to solve particular problems,
especially with tools like Microsoft Visual C++ and Borland C++ Builder (a
particular favorite of mine). These combine libraries, component models and
code generation tools to solve the problem of developing windowed end-user
applications (for Microsoft Windows). And yet, what do the vast majority of
Windows developers use? Microsoft&#8217;s Visual Basic (VB). This despite the
fact that VB produces the kind of code that becomes unmanageable when the
program is only a few pages long (and syntax that can be positively
mystifying). As successful and popular as VB is, from a language design
viewpoint it&#8217;s a mountain of hacks. It would be nice to have the ease and
power of VB without the resulting unmanageable code. And that&#8217;s where I
think Java will shine: as the &#8220;next VB.&#8221; You may or may not shudder
to hear this, but think about it: so much of Java is designed to make it easy
for the programmer to solve application-level problems like networking and
cross-platform UI, and yet it has a language design intended to allow the
creation of very large and flexible bodies of code. Add to this the fact that
Java has the most robust type checking and error-handling systems I&#8217;ve
ever seen in a language and you have the makings of a significant leap forward
in programming productivity.
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">Should
you use Java instead of C++ for your project? Other than Web applets, there are
two issues to consider. First, if you want to use a lot of existing libraries
(and you&#8217;ll certainly get a lot of productivity gains there), or if you
have an existing C or C++ code base, Java might slow your development down
rather than speeding it up. If you&#8217;re developing all your code primarily
from scratch, then the simplicity of Java over C++ will shorten your
development time.
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">The
biggest issue is speed. Interpreted Java has been slow, even 20 to 50 times
slower than C in the original Java interpreters. This has improved quite a bit
over time, but it will still remain an important number. Computers are about
speed; if it wasn&#8217;t significantly faster to do something on a computer
then you&#8217;d do it by hand. (I&#8217;ve even heard it suggested that you
start with Java, to gain the short development time, then use a tool and
support libraries to translate your code to C++, if you need faster execution
speed.)
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">The
key to making Java feasible for most non-Web development projects is the
appearance of speed improvements like so-called &#8220;<A NAME="Index71"></A>just-in
time&#8221; (JIT) compilers and possibly even native code compilers (two of
which exist at this writing). Of course, native-code compilers will eliminate
the touted cross-platform execution of the compiled programs, but they will
also bring the speed of the executable closer to that of C and C++. And cross
compiling programs in Java should be a lot easier than doing so in C or C++.
(In theory, you just recompile, but that promise has been made before for other
languages.) 
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Carmina Md BT" SIZE=3 COLOR="Black">You
can find comparisons of Java and C++, observations about Java realities and
practicality and coding guidelines in the appendices.
</FONT><P></DIV><DIV ALIGN=LEFT><FONT FACE="Da Vinci Extras" SIZE=39 COLOR="Black">b</FONT><a name="OLE_LINK5"></a><a name="Chapter_2"></a><a name="_Toc375545216"></a><a name="_Toc407441446"></a><a name="_Toc408018417"></a><P></DIV>

<div align="right">
<a href="tij_c.html">Contents</a> | <a href="tij0029.html">Prev</a> | <a href="tij0031.html">Next</a>
</div>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -