What Is Java?
Last updated Nov 2, 2007.
In 1995, Sun Microsystems made the first public version of Java available. It defined Java as
having the following attribute:
• Java is simple. That simplicity derives from syntax similar to C/C++ and the omission
of complex C/C++ features such as multiple implementation inheritance, pointers,
and operator overloading.
• Java is object-oriented. Java’s object-oriented nature encourages a developer to
think in terms of classes and objects rather than separate code and data. That
class/object focus results in code that is easier to write, easier to maintain, and easier
to reuse.
• Java is network-savvy. A TCP/IP library simplifies the development of programs that
communicate with HTTP, FTP, and other TCP/IP network processes. Furthermore,
the library’s use of the same stream-oriented mechanism for communicating with
remote network processes that file-oriented code uses to communicate with files on a
computer’s local hard drive helps a developer write network code faster.
• Java is interpreted. Java’s compiler translates source code into class files of
bytecode instructions. A virtual machine examines each instruction and uses that
instruction’s meaning to execute an equivalent sequence of platform-dependent
instructions. Interpretation speeds up the development process and simplifies
debugging.
• Java is robust. Errant programs do not crash the virtual machine or corrupt the
underlying (native) platform. Robustness is achieved, in part, by not supporting C/C+
+ pointers, by providing a garbage collector to automatically free up dynamically
allocated memory (instead of forcing the developer to accomplish that task), by
performing strict compile-time/runtime type checking, and by providing true arrays
with bounds checking.
• Java is secure. Java’s "sandbox" security model identifies sensitive operations (such
as file I/O) that a malicious program can exploit to harm the native platform, and
provides a mechanism for allowing or preventing access to those operations.
• Java is architecture-neutral. A compiled Java program’s bytecode instructions
target a generic virtual machine instead of a specific platform. Because each
platform-specific virtual machine implementation supplies a consistent interface to
the bytecodes, the same Java program runs on diverse platforms (via their virtual
machines).
• Java is portable. Portability is achieved through architecture neutrality and through a
strict definition of the language (which permits no implementation-dependent
features). For example, Java’s integer primitive type always means a signed 2’s
complement 32-bit integer. In contrast, the C/C++ integer type can be unsigned, and
its size varies according to a platform’s register size (typically 32 bits or 64 bits).
• Java is high-performance. Many virtual machines use a just-in-time (JIT) compiler
to dynamically compile a program’s bytecode instructions into platform-specific
instructions (which execute faster than bytecodes) as the program runs.
• Java is multithreaded. Support for threads is built into the language via thread-
synchronization primitives. There is also a thread library.
• Java is dynamic. Java’s use of an interface type to distinguish between what a
program must do and how that task gets accomplished helps Java adapt to a
continually evolving environment, and makes it easier for vendors to modify Java
libraries without breaking program code that uses those libraries.
The above definition implies that Java is not your average computer language. Unlike many
computer languages, a Java compiler doesn’t translate correct source code (based on a language
specification’s syntax and semantics) to equivalent executable code that runs directly on
Microsoft Windows/Intel, Sun Solaris/SPARC, or another platform (an operating system and
hardware architecture combination). Instead, Java’s compiler translates correct source code to
executable code that runs indirectly on a native platform via a virtual machine (a software
representation of a hypothetical computer). The virtual machine presents a well-defined
interface to a Java program’s bytecode instructions (operation codes and operands that have
meaning to the virtual machine) and situates between a Java program’s bytecodes and the
native platform.
Initially these goals were ambitious and required developers to spend a significant amount of
time testing and debugging their applications running in different virtual machines on different
operating systems, but as time moved forward, so did Java. Today, moving between modern
Java virtual machines, even from different vendors, is mostly transparent. No longer do you
have to think about if your application will run on Linux or Windows, if you choose to use Java
you get both for free, plus Macintosh, Sun, AIX, HP-UX, and any other operating system for
which there is a Java virtual machine.
The History of Java
Java’s abstraction of the underlying operating system, and hence the underlying network
infrastructure, can only be appreciated after a brief history lesson about how Java came to be.
In 1991, a research group at Sun Microsystems, as part of their "Green" project, was working to
develop software to control consumer electronic devices. The goal was to develop a
programming language that could be used to control and network "smart" devices, such as
televisions, toasters, and even buildings. These devices would all coexist and could
communication with one another.
The first prototype that Sun Microsystems developed was a device called the Star7 — a device,
similar to a remote control that could communicate with other Star7 devices. Now, the initial
intent was to use C++ to control the Star7, but as the result of frustration with C++, James
Gosling, a member of the Green project, developed a new language, called Oak, to control the
Star7. Why Oak you ask? Well, it is pretty technical, but here goes: rumor has it that the title
came from a tree that James could see out of his window while developing the language. Sun
later replaced the name Oak with Java because they found that Oak was already being used.
Anyway, as a result of Oak, or Java, being designed to run on small appliances, the language
had certain inherent benefits to it:
• It had to be small to run on the limited memory of small appliances
• It had to be efficient and reliable enough to function as a small appliance — we are
all used to crashes using computers, but what if your microwave oven changed its
power setting and cause your popcorn to catch fire?
• It had to be portable to run on different pieces of hardware
So what happened to Java after that? After graduating from the Green project, Java was used to
create one of the earliest Web Browsers in 1994, called HotJava, but Java came alive however,
in 1995 when Netscape licensed the Java programming language and included support for it in
its Navigator product.
In 1997 Sun released the Servlet API that revolutionized server-side web development away
from monolithic CGI scripts or proprietary solutions. In 1999 Sun released the first version of
the Java 2, Enterprise Edition (J2EE) specification that included JavaServer Pages (JSP) and
Enterprise JavaBeans (EJB) in a highly distributed enterprise middleware. Since then we have
seen enterprise Java flourish and evolve to the current Java 5, Enterprise Edition, and we have
seen hoards of open source and close source communities evolve.
The Power of Java
The Java syntax is easy to learn because it resembles C++, its object-oriented foundation makes
it intuitive, and its early beginnings in driving communication between devices makes network
programming a breeze, but what makes Java truly powerful is its community. One thing that I
have always told my students is that before you write any code, look and see if someone has
already written the code for you. As you peruse through the Java Reference Guide, you’ll
discover technologies like Struts (a Web framework), Hibernate (a persistence engine), Spring
(a powerful Inversion-of-Control engine that provides an alternative to enterprise Java), among
dozens of other technologies. The Java community has come together in a communal effort to
build the majority of technologies you need to build enterprise applications. This enables you to
focus on solving your business problems and not on building application infrastructure.
The best sources to discover these technologies are (1) Sourceforge.net and (2) Apache.org, in
which most Java projects are delegated to jakarta.apache.org. So the next time you are thinking
of building a cache or a connection pool or a web or EJB container, it might be better to check
these web sites before hand!
To help drive innovation, Java has a Java Community Process (JCP) through which standards
can be defined and accepted by the community. The JCP has seen the inception of a plethora of
new technologies and has provided a medium for interested parties to provide feedback and
shape the direction of new technologies.
Summary
Java is a feature-rich programming language with a robust set of inherent functionality to
empower beginners through experts to build top-quality applications. As a result, most colleges
have moved their programming curriculum to Java. But the thing that makes Java great is its
community: a group of individuals dedicated to making your job easier. And as such, the Java
community projects allow you to focus on solving your business problems rather than spending
most of your time building an infrastructure to support your application. If you’re new to
programming or you’ve been programming for decades, Java can not only make you more
productive, but can help you enjoy programming!
Server
Last updated Jun 13, 2008.
There are multiple server technologies, into which I am grouping both web and enterprise
applications, but the industry is dominated by three primary technologies:
• Microsoft Windows .NET
• Enterprise Java Technologies
• LAMP (Linux Apache, MySQL, and PHP)
.NET and Java are actually more similar than you might think, at least in terms of capabilities.
Enterprise Java has been in existence longer than .NET and as a result is probably a little more
mature, but not enough so to sway your decision. The main difference between the two is in
their deployment platforms: .NET should be deployed to a Windows technology stack whereas
enterprise Java applications can not only deploy to Windows, but also to Unix, Linux, and even
Macintosh. The important differentiator is that very large scale applications can run in very
large Unix environments with hundreds of thousands of nodes or even on multimillion dollar
mainframes. My travels have taken me to Java customers ranging from banks on Wall Street to
large healthcare companies to huge telecommunications companies, and each of them was
successful in solving their business problems using Java.
One of the things that has truly made Java a powerful competitor in the web and enterprise
technology space has been the emergence of open source technologies. For example, if you are
building a web application, rather than starting from scratch with the technology alone, you can
analyze your needs and find a proven framework that best solves your business problems. And
most of these technologies are running in thousands of different environments across the world,
all developed and supported by volunteers whose only aim is to provide the best performing
and most robust solution to a domain of business problems. If it were not for this open source
community, Java would not be nearly the technology that it is today. As a point of reference,
nearly half of the application architectures that I analyzed in my customer travels (in the
financial, healthcare, and telecom industries) used Apache Struts as their web framework.
Apache Struts was built as one of the first Model View Controller (MVC) architectures by
developers that did not want to reinvent the wheel with each new application they built and it
grew into a phenomenon of mass industry adoption. And if Struts does not solve your problem,
you might look at Spring MVC or Apache Velocity or Wicket or any one of a dozen
alternatives. Likewise, data persistence technologies such as Hibernate grew out of a need for a
simple object-relational persistence technology and now you can find Hibernate in a great
number of large-scale enterprise applications. The point is that the open source community that
has evolved around enterprise Java enables you to quickly piece together the best in breed
technologies and focus on solving your business problem, not on building an infrastructure.
LAMP is an interesting technology stack that is comprised of all open source technologies that
work together to rapidly produce web applications. LAMP should not to be discounted because
we have seen how powerful open source communities can become, but it has its limitations.
Namely, it is great at building dynamic web applications, but it lacks many of the enterprise-
scale checks-and-balances that Java provides, such complex transactional support that many
enterprise applications require. And without these features, you do not see too many large
companies using LAMP to implement their mission critical applications.
I have been focusing on large-scale applications, but when comparing .NET to Java, I must also
mention that Java is an ideal technology for very small-scale applications as well. The reason is
that the open source communities that have provided you with great frameworks have also
provided you with open source web and enterprise containers. Apache Tomcat is an open
source and completely free web container that has widespread adoption across our industry.
JBoss, Apache Geronimo, and Sun’s Glassfish provide support for enterprise technologies and
integrate very closely with Tomcat. So if you are working for a company that wants a very
large commercial partner you can choose IBM or BEA/Oracle, but if you want your software
licenses for free then you have open source alternatives that can give you great performance.
And because Java runs on Windows, Linux, Unix, and Macintosh, you can buy inexpensive
hardware and run a mission critical application in a heterogeneous environment, all with
enterprise-scale support that your applications need.
Summary
Last updated Jun 13, 2008.
When choosing a technology to use to solve your business problems, you need to consider
many factors, including physical cost, development cost, performance, robustness, flexibility,
as well as your eventual deployment platforms. Java provides technologies to help you solve
small-scale as well as very large-scale business problems and everything in between. On top of
that, Java applications can run on different platforms, which means that you are never locked
into a single vendor. Finally, the open source communities and projects that have evolved
around the Java industry can provide you with best of breed infrastructure to allow you to focus
on solving your business problems. This is all to say that Java allows you to rapidly develop
robust software with the flexibility to deploy that software to a wider audience than any of its
competitors. And as such, Java deserves your serious consideration for any application you are
getting ready to write.
Java là gì?
Ngày cập nhật 2 tháng 11 năm 2007.
Năm 1995, Sun Microsystems, thực hiện các phiên bản đầu tiên công cộng của Java có
sẵn. Nó được định nghĩa Java như có thuộc tính sau:
• Java là đơn giản. Đó đơn giản xuất phát từ cú pháp tương tự như C / C + + và các thiếu
sót nào của phức tạp C / C + +, các tính năng như thừa kế thực hiện nhiều, con trỏ, và nhà
điều hành quá tải.
• Java là hướng đối tượng. Java hướng đối tượng thiên nhiên khuyến khích một nhà phát
triển để suy nghĩ về các lớp học và các đối tượng chứ không phải là mã riêng và dữ liệu. Đó
là lớp / đối tượng kết quả được tập trung trong mã được dễ dàng hơn để viết, để duy trì dễ
dàng hơn, và dễ dàng hơn để sử dụng lại.
• Java là mạng hiểu biết. Một TCP / IP, thư viện đơn giản hoá việc phát triển các chương