The Java program language and environment design is to solve modern
Problem in programming. It was originally a larger scale "
Part of the Advanced Software Development Project of the E-Products,
The purpose of the project is to develop small, reliable, portable, distributed
Facts, real-time embedded systems. We have begun in the project.
C is used, but some problems have been encountered. Initially, that only
It is a compiler technology problem, but we have encountered more
More difficult, and found the best solution is to replace programming language
Say.
Java
Java is a simple, object-oriented, distributed, interpretation, health
Strong, safe, structure neutral, portable, high-efficiency, multi-threaded
, Dynamic language.
One way to describe system characteristics is to put a bunch of high performance
Pan together. As described above, we also use a set of standards.
Terms to describe Java. The following we will explain these terms in
The meaning of the representative of Java, as well as the problem we try to solve
Which.
"First, we want to introduce Achi MiD (Archimedes)
Inc.); it is our fictional in order to facilitate Java functionality
A software company. Akimi is engaged in basic physics teaching
The software development of the use, its software design is to be with users
Generate interactions, not only provides a text like traditional textbooks
With illustrations, and also include a set of software experiment studios for supply
The employers conduct experiments and simulate the physical behavior of the real world. example
For example, its most basic experiment allows students to form a leverage and slippery
Wheel, then observe their physical effects. In the following discussion
In the next, we will be by these experiments and the Akimi designer.
White to explain the Java language concept. "
simple
We want to build a truly simple system, which allows users
Easily design the program without need to be like today's standard procedures
Accept the training of the Olympics. At present, most programming designers use
C language, and object-oriented programming designers use C .
So even if we find C is not suitable for us, I
They still as far as possible in Java, they are similar to C ,
To ensure that the system is easier to understand.
Java deletes many very rarely used, not easy to understand and confuse
C features, these features can only be in our experience
Bring trouble rather than efficiency. Deleted features mainly include operators
Operator overloading, multiple inheritance (inheritance)
And a wide range of automatic coercions;
Overloading refers to a multi-project with an identification element, Java language
Also provide overloaded functions, but it is overloaded to be a method (Method)
Non-variables or operators.
We increase automatic memory garbage collection (Auto Garbage Collection)
Function, therefore simplifies the Java program, but it also makes the system a little more
Miscellaneous. Storage Management (Storage Management) is C and C
Common reasons for applications become complicated, that is, memory
Allocation and release. Automatic garbage collection function in Java language (periodically
Release unused memory) not only simplifies programming work, but also
It can greatly reduce the quantity of small errors (BUGS).
"Achi Mi Die designers originally spend time thinking about lever and pulley
Later, it was found that most of the time was wasted in the secularity.
The program works. In fact, their core expertise is
Teaching instead design. The most complex part of these procedures work
The part is to find those places from their 20,000 stroke sequence code.
Wasted memory. "
Ensure another feature of Java "simplification" is "small and single
pure". One of Java's goals is to help development can be independently
Software successfully implemented on a machine. Java basic interpreter
(Interpreter) and object class (Class) support account for about 4om, and
Increase basic standard libraries and thread support (it
In fact, a complete self-contained microcaround is to increase 175K. The size of the size is important for the use in embedded systems, and
This Java can easily download through the network.
Object-oriented
This is one of the terms that are over-rendering in the industry. However,
Objects are a strong design function because it contributes to clear
Interface definition, and allow developers to establish repeatable "soft"
Part IC.
Simply put, object-oriented design is a data (object)
And its interface is the programming technology of the center of gravity. We take carpenter than
An example; a "object-oriented" carpenter value is what he wants to make
The chair, followed by the tool he used to make a chair. in contrast
, A "non-object-oriented" carpenter is putting the main heart
On the tool. Object-oriented design is also how to define program modules
"Plug and Play" mechanism.
Object-oriented facilities of Java are essentially C , and include
Objective C's extension to provide more dynamic solution
Program.
"Akimi designer is designed in their simulation
Things, including ropes and rubber bands. Their initial C version
Product is a very large system because they must be individual
Design software to describe rope and rubber bands. Object-oriented
When they re-design the application, they find that they can define one
Basic objects come representing the commonality between the rope and the rubber rib
Some, then the rope is defined into a basic object type with the rubber band.
Sub object class. Later, when they need to increase
It can be very easy to establish when adding a chain, because they can
To establish these links in previously designed objects
On, without the need for the entire redesign new object simulation. "
distributed
Java has a wide range of routine libraries to easily
TCP / IP protocol, such as HTTP and FTP, etc. This makes it in Java
It is easier to create a network connection than in C or C . Java application
The order can be opened and accessed by the URL through the network,
It is as simple as accessing a local (local) file system.
"The Aqui Designer originally established their procedures in CD-
ROM. However, they want to put some interactive teaching game procedures
Concept is placed in the next product. For example, they want to make different electricity
Students on the brain establish an analog machine for everyone to learn.
However, all network systems they have evaluated are too complicated.
Requests the profession of the Software Engineering. So they had
Water from this concept. "
robust
Java's goal is to assist developers must be available in all aspects.
Rely. Java emphasizes that it may exist in the early stages of design
The problem, after which it performs dynamic (runtime) and excluded
It is easy to have erroneous conditions.
Strongly type, such as the advantage of C is allowed
In-depth checks in compile, so as to find an error in advance.
Unfortunately, C inherited C in compilation check (Compile-Time)
Some vulnerabilities when Checking; C's inspection is relatively loose,
Do not in terms of the method / process statement. We request in Java
Declare, but does not support the implicit statement of C style.
Linker understands the type system and repeats many
Type checks that have been completed by the compiler to avoid versioning of the version
Match the problem.
One of the biggest differences between Java and C / C is that Java has
A pointer model that eliminates memory
The possibility of overlaying and destroying data. Java does not adopt a reference
The synthesis, but provides a real array. This allows the program to execute
The subscript is checked, and it is impossible to happen.
Type conversion will turn an arbitrary integer into a pointer.
"Achi Mi Designer's application is basically in the case
When it is fast. However, their software development schedule has been backward, because
Escape their inspections for small errors that have not been cleaned. they
In the face of many troubles, including memory distribution failure, the version is inconsistent,
The interface does not match. C Let them add some clever designs in the program code, but they must be considered for time
Ensure the quality of the program. Since the mistake is unclear, they
After the software launches the first edition, you have to write the repair. "
Although Java can't rule out the quality confirmation, it makes this
The order is simpler.
Many dynamic languages such as Lisp, TCL and SmallTalk, etc.
It is often used to make prototyping. They are here
The reason for success is because they are very robust (Robust).
Let program designers are no longer afraid to handle memory problems because they
Do not worry that memory failure. Java has this feature. Java
Programmers can be relatively unfarest to deal with memory problems, because
There is no pointer in Java, and the Java program is impossible to cover one.
The end of the tablet buffer. Java programs are not possible to illegally access
Memory, but these may happen in C or C .
Dynamic language is one of the reasons for developing prototyping procedures,
They will not ask you to develop clear decisions in the early days of development.
Policy. Java is just the opposite, it is forced you to make a choice. This
Some options are accompanied by many assistance: You can write method calls
(Method Invocations), and if you have some wrong ground
Square, you will get notifications when compiling, don't worry
Call the error.
Safety
Java design is to be used in network / distributed computing loops
territory. To this end, Java highly emphasizes security to ensure that the establishment is
Virus and will not be invaded. Java's verification technology is
The public-key encryption method is based.
There is a strong mutual mutual mutual mutual mutual mutual mutual relationship between "robustness" and "safety"
Role relationship. For example, the pointer is changed, allowing the application
It is impossible to fake object structure access, or access them is right.
There is no private data in the image. This is equivalent to close the door,
Block most of the virus activities.
"Someone wrote an interesting repair for the PC version of the Akima.
Replenishment, then post it to a major electronic bulletin board
Face circulation. Because this patch is easy to achieve and
Add some interesting features to the system, so many people download
use. This program has not been tested by Akimi designers, no
It seems still not bad over it. Until April 1 day, good
Thousands of users found the teaching software used by their children
Jump out a few pictures that are unbearable. Don't add more, Aqui
Although Mi's designers don't have to take responsibility for this accident, but
They still have to try to control the breaks caused by the patch.
Bad. "
Structural neutrality
Java's design goals are to support network applications. Generally
Words, the network is composed of many different systems, including various
CPU and operating system structure. In order to make Java applications
Execute anywhere on the network, its compiler will produce a kind of
Structural Personality (Architecture Neutral)
formula. The compiled program code can be provided in Java Runtime system
A variety of different processors are executed.
This is also very helpful to web applications, but also very suitable for single
System software circulates. In the current personal computer market, application
Program developers must write IBM PCs for their prices, respectively.
Compatible with Apple Macintosh. Now, the PC market is
(Through Windows / NT) is dispersed into many CPU structures, and
Apple turns from 68000 to PowerPC, these facts make me
They are hardly designed to be soft on all platforms.
body. Java allows the same version of the app to be executed at all platforms
Row.
The Java compiler is not related to the output of a computer structure.
Byte code instructions to achieve the above functions. They can easily
Interpretation on any machine and dynamically convert into native mode
Machine code.
"Achi Mi is a small company. They start from design PC software
Home, because it is the biggest market. After a period of time, they have grown enough companies that are large enough, so they have the ability to
Macintosh platform development software, but that is indeed a big
Engineering, and investment remuneration is not really good. They are weak
Bare to port the software to PowerPC Macintosh or MIPS NT
The humanity and cost involved in the machine. When the first wave is coming
When they fails to catch the opportunity, and the competitors are 趁虚
Into. "
portability
Structural neutrality is the most important part of the program portable, not
There are many conditions that must be cooperated outside of this. And C and C
Different, there is no "structural dependence" in the Java specifications.
The statement exists. It specifies the size of the basic data type, and
The execution behavior of its arithmetic computing element. For example, "INT" represents one
Symbolic binary complement 32 bit integers, and "float"
Represents a 32-bit IEEE 754 floating point number. These options are
Today's environment is very applicable, because almost all CPUs have this
Some features.
The library belongs to a part of the system, which defines some portable portable
The program interface. For example, it includes an abstract windows class
And provide classes in UNIX, Windows, and
Implementation on the Macintosh platform.
The Java system itself has considerable portability. Compiler with Java
Write, and the Runtime program uses ANSI C, and there is a real
Improved portability with POSIX (Portability
boundary). "
Explanation
The Java Interpreter (Interpreter) can directly explain anyway
Interpretation of the interpreter, execute Java byte code, no storage.
Further, since its link is relatively tended to gradually increment and lightweight process,
Therefore, the development process is faster and more accurate.
Due to the information during the compilation, it belongs to a part of the byte code.
Series, therefore can carry more information during operation. This is exactly
The basis of the linker type check, it also makes the program easier to perform unlock.
"Akimi designer spends a lot of time to wait for the program and chain
. They also spend a lot of time to track many faults that cannot be sensed.
Mistaken, because some changes have not been able to complete compilation
Order (although they use the Make utility) and cause versions
Inconsistency. At the same time, I have to track some of the many declarations in the program.
Consistent procedure. So, their software development agenda has been extended
A few months. "
high efficiency
Although the interpreted byte code performance is quite good,
Something is still required to achieve higher performance performance.
Byte code can dynamically (runtime) for execution applications
The specific CPU is explained as a machine code. This is generally compiled for habits
The translator is a bit class with the designer of the dynamic loader.
It seems that the final machine code generator is placed within the dynamic loader.
The byte code format is designed to take into account the generation of machine code, because
This actual machine code generating program is quite simple. Output machine
The code is valid, the compiler automatically assigns the register, and
Some optimizations are also possible when outputting byte code.
We explain the code code in a Sun Microsystem SPARC
When executed on Station 10, 300,000 method calls per second are reached.
Method Calls. Byte code conversion
To machine code speed performance, almost and native
There are no two modes of C or C .
"When Aqui company is just set up, they
Design prototype program with SmallTalk. This assists the company to get
Self-help, but there is no truly helping them to produce
Product: In order to let their simulation procedures run fast enough and consolidated
System requirements, they have to redesign with C. "
Multithreading
In the real world, many things happen to us.
Multithreading is an application design
law. Unfortunately, you want to design a lot of things at the same time.
The program is more than the design of the traditional single thread C and C program.
Many complicated.
Java has a set of complex synchronization basic units, they
It is a widely used C.A.R. Hoare monitor and condition variable map
basis. After the concept is dissolved into the language, they become
It is easy to use and more robust. Most of this dissolved approach come from
Xerox's CEDAR / MESA system.
Other benefits of multi-thread include better interactive response capabilities
Perform behavior with real-time. However, this will be limited by the underlying platform.
System: Independently implemented Java operating environment with a good real-time implementation
For, if other systems such as UNIX, Windows,
Macintosh or Windows NT is executed due to the underlying
The reasons for the platform will be affected by real-time reactivity.
"Achi Mi's simulation programs perform many items at the same time
Check: Pull the rope, turn the wheel and "rod, and track
User input. Because they must design all these simulations
In a single thread's program format, all simultaneously
Health movements (regardless of whether there is a relationship with each other)
Working form is mixed. Use an event loop to make the situation
Come know more, but it is still a mess, the system becomes
Very fragile and difficult to understand. They capture data from the entire network.
But in the initial, they can only catch a block once, this series
Network communication is very slow. When they transfer to multi-threaded mode
After that, the network communication problem is solved. "
dynamic
In many ways, Java is a more dynamic than C or C
Property language. It emphasizes the computing ring in evolution
Provide support.
For example, one of the main problems in the production environment is
The size of the program code is generally designed. If Company A
Design an object class library, and it is purchased after B.
Put it in your own product, then change the procedure like A company
Gallery and provide new versions, then Company B will almost
It must be recompiled and re-circulated their new software. Most
End users buy software (such as A)
Is a homework system manufacturer, and B is an app manufacturer), then
The problem is generated.
For example, if Company A supplies an upgrade version for its library
This, then all of Company B's software will have to be modified. although
C can avoid this problem, but that is extremely difficult, and
It also means that any object-oriented power cannot be directly used directly.
can.
"Achi Mi has the object-oriented picture-oriented process with 3DPC
The library creates their products. 3DPC later launched a new version
Graphics library, and there are several computer manufacturers to match it
The new machine is shipped. Admiration customers purchased these new machines
I am very disappointed that their old software cannot continue to use. (in
In the real world, this situation only occurs on UNIX systems. in
In the PC field, 3DPC will never launch such a program.
Library, because they change and use C object-oriented functionality
The force is greatly limited. )
Java is built for the module and module at a later stage.
Connect, therefore, it is completely avoided these problems and can be more directly
Use the object-oriented design system. The library can be freely increased
New Methods and Execion Variables, without producing them
Any effect.
Java can understand the interface concept from Objective C.
Simply put, the interface is the specification of a group corresponding to the object.
Law, but how the objects implement these methods will be resolved. One
Class implementation an interface is to provide all of this interface included
Implementation of the method. In contrast, the derived subclass is inherited from the parent class.
A set of methods and their implementation. A Java class can be implemented
Multiple interfaces, but can only inherit from one parent class. Interface tells the connection
Objects can be done instead of doing, make it more on code
It has flexibility and reuse.
The object class has a Runtime representation: it has a class called Class, which includes the runtime class definition. In c or
In the C program, if you have a pointer to a pair
To, but you don't know why the object is, then you will not
There is a way to find it. However, in Java, according to the Runtime class
Search for information is very straightforward. Because, in Compile
Data type conversion is checked when TIME and RUN-TIME, so
You can trust this conversion in Java. On the other hand, C is
The C compiler just believes that you have made the right process.
Also, it may also find one from a string containing names.
Object category definition. This means you can calculate a data class
Type name, then easily link to the execution system
System.
"Achi Mi is expanded to expand the camp, I hope to make their products
Use the new entry module to expand the system. This expansion
It is possible to do in the PC, just rarely realized. They must
There must be some new programming designers because those work is
Miscellaneous, but also increases many amplifies problems. "
to sum up
Java language provides a powerful tool support program designer.
Java makes programming more easily because it belongs to facing
Language, and providing automatic memory garbage collection
can. Furthermore, since the Java code has structural neutrality, it
Application becomes a non-wealthy operation environment (such as Internet)
Ideal.