FCI-Helwan blog

Just another FCI-H weblog

Explore the java platform- part1 – what is java?

Explore the Java platform
part 1
What is java?

1.1 Introduction

This part aims at getting the reader familiar with Java as fast and simple as possible as we will see a simple overview of the Java platform to help us getting through the rest of the parts in a non complex flow.
As a personal point of view, talking about Java is endless. Java is more than a platform; you can treat Java as a person, really! Sometimes you love and miss Java, and sometimes you reach the point of no going back, sometimes you say poems about the great technology, and sometimes you call it a peace of garbage.
That what makes Java very special, when you use it you feel the human thinking in every thing, you have the chance to understand every single step you do to develop an application.

Personally, I am a great fan of Java, not to be different, but because I dealt with other technologies which are mainly from Microsoft, for example; when you learn .NET, you know the steps to accomplish some tasks without knowing why, you just click here and there and write some code (IF YOU DO SO!!!) because they told you that.
Dealing with Java is very much different, as you can get to know every single detail concerning every thing, including the Java platform source code itself.

1.2 What is Java?
Java is an object-oriented programming language developed by Sun Microsystems in the early 1990s. Java applications are often compiled to bytecode, which may be compiled to native machine code at runtime.
The language itself borrows much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities.

1.2.1 History
Java was started as a project called “Oak” by James Gosling in June 1991, the goal of this project was to build a virtual machine and a language that accomplish “Write Once Run Anywhere” (WORA) concept, where you can write an application and run it on any platform without any runtime costs.
Java as a programming language passed over many levels of enhancements, now, the standard Java language is known as ‘Java2’.

1.2.2 Philosophy

Primary Goals:
It should use the object-oriented programming methodology.
It should allow the same program to be executed on multiple operating systems.
It should contain built-in support for using computer networks.
It should be designed to execute code from remote sources securely.
It should be easy to use by selecting what was considered the good parts of other object-oriented languages.

Platform independence
One characteristic, platform independence, means that programs written in the Java language must run similarly on any supported hardware/operating-system platform. One should be able to write a program once, compile it once, and run it anywhere.
This is achieved by most Java compilers by compiling the Java language code “halfway” to bytecode (specifically Java bytecode)—simplified machine instructions specific to the Java platform. The code is then run on a virtual machine (VM), a program written in native code on the host hardware that interprets and executes generic Java bytecode

Automatic Garbage Collection
One idea behind Java’s automatic memory management model is that programmers should be spared the burden of having to perform manual memory management. In some languages the programmer allocates memory to create any object stored on the heap and is responsible for later manually deallocating that memory to delete any such objects. If a programmer forgets to deallocate memory or writes code that fails to do so in a timely fashion, a memory leak can occur.
In Java, this potential problem is avoided by automatic garbage collection. The programmer determines when objects are created, and the Java runtime is responsible for managing when to remove this object from memory.

1.2.3 Syntax
Java’s syntax shares a great deal of C++ syntax, however, C++ can not be considered a fully Object Oriented language rather than a hybrid language because it combines the properties of structured, generic, and OOP. For example; In C++, the program is executing inside the main function which is not a member of any object.
Java was built from the ground up as an object oriented language. As a result, almost everything is an object and all code is written inside a class. The exceptions are the intrinsic data types (ordinal and real numbers, Boolean values, and characters), which are not classes for performance reasons.

Hello world in java

// Hello.java
Public class Hello
Public static void main (String[] args)
System.out.println (“Hello, World!”);

As you can see in the hello world example, a main method is defined as a member method of the class Hello. Any class can have a main method as long as it has a signature similar to the hello world class, however, if you have an application with many classes containing main methods, only one main method will execute at runtime.

1.2.4 Criticism

Java can be perceived as significantly slower and more memory-consuming than natively compiled languages such as C or C++.
In general, interpreted languages require additional instructions to execute, and can potentially run several times slower than directly compiled machine code. There also is a significant overhead in both time and space, since many Java interpreters and runtimes take up many megabytes and take many seconds to start up. This arguably makes small Java utility programs uncompetitive with programs compiled in other compiled languages. To be fair, several tests have indicated that the Java overhead is less noticeable for sophisticated or large Java programs.
Java’s performance has increased substantially since the early versions, and performance of JIT compilers relative to native compilers has in some tests been shown to be quite similar.The performance of the compilers does not necessarily indicate the performance of the compiled code; only careful testing can reveal the true performance issues in any system.

Lack of OO purity
Java’s primitive types are not objects. Primitive types hold their values in the stack rather than being references to values. This was a conscious decision by Java’s designers for performance reasons. Because of this, Java is not considered to be a pure object-oriented programming language. However, as of Java 5.0, autoboxing enables programmers to write as if primitive types are their wrapper classes, and freely interchange between them for improved flexibility.

1.3 Why Java?
Well, we have seen that there is a good language called java, so what? Why bothering ourselves with learning a new language as long as there are already languages that satisfy our needs and easy to use and learn?

First of all, we must confess that we as Egyptians were invaded by Microsoft from quite long time. Any normal computer user believes that the only thing that can operate a PC is of course windows; most of developers now see that the .NET is the ultimate magician that can do any thing. Unfortunately, that is not the case; the case is that we did not see any other technologies to judge the products we are using in a right way. I don’t say that we don’t use Microsoft technologies,(I use windows) but we have to move on to see the wide space full of technologies out there, we have to see and try to judge fairly, and believe me the result will be very surprising.

For example; the most popular language now in Egypt is C# which is considered to be very easy and very powerful for us as Egyptians. The reason of this is that we still have a relatively small and weak software industry. C# is a good and easy language, but at small scale projects.
Talking frankly, we can say that more than 85% of the .NET concepts are taken exactly from Java.

Java platform is a very powerful and stable language with a very wide collection of technologies utilizing the language. According to statistics stated at the JDC, java is now considered the number 1(C# as number 7!!). European SW industry is now heading towards using java especially at enterprise applications level.

Last but not least, java is an open source platform. The concept of open source applications will dominate within the next few years leaving no chance for closed source applications to exist, this concept ensures maximum efforts from providers to keep their products alive and also gaining money is ensured, but this is another topic which needs a whole article.

1.4 Summary

This article was a kind of seeing a small overview of java, in next articles we will get to talk about specific technologies of java hoping to really show the power of that platform


January 27, 2007 - Posted by | JAVA


  1. hi i might share u some of ur points of view but i’ve to say that some of ur words are very misleading
    considering u saying this
    “Talking frankly, we can say that more than 85% of the .NET concepts are taken exactly from Java.”

    who said so?

    both languages are implementing well known standards and from the way i’m seeing it .net is more better in implementing these standards
    for example all objects in .net are all derived from the same base class which is in this case is the System.Object

    more to say that java have just introduced the generics in there new release where i’ve been using it in .net from away long time ago

    “C# is a good and easy language, but at small scale projects.”
    excuse me but these words are VERY misleading
    i’m currently working in a company where working with very LARGE scale projects is a part of my daily work and i use .net
    and i mean really large like e-goverments and corportations systems

    while the tasks that i accomplish daily thanks to the .net technology is neartly impossible to do tasks if i’m using java

    java have introduced j2ee very long after the introduction of n tier and xml web services in .net

    “According to statistics stated at the JDC, java is now considered the number 1(C# as number 7!!).”

    who said so? a java evanglist? working for sun microssystems?
    where is his resources?
    i was there and i discussed this with him and the word “resources” seems like an odd thing for him

    “The concept of open source applications will dominate within the next few years leaving no chance for closed source applications to exist”

    r u kidding me?
    u want to say that developers will sell software for free? and wait for the customer to decide will s/he or will s/he not use there technical support or the technical support of there rivals?

    u 4got that FOSS = “Free” Open Source Software
    and no “Free” here is not from freedom as some guys tend to say, it means $0 i.e $0 sallary
    i love open source software but i love “using” it not “working” in it
    the whole FOSS marketing thing is just a trick from dying companies like SUN to stay on the market against microsoft and have a bigger slice of the pie and give u developers “nothing”

    and one last thing to say that no body can deny that .net design have far exceeded java in effeciency as no one can neglect how SLOW is java

    Comment by Fady Anwar | January 27, 2007 | Reply

  2. Youssef, plz do not compare between JAVA and C#.
    we do not need more arguments we here just want to deliver some technical stuff to others.
    If they need to know the difference they can search out

    Comment by Ramy Mahrous | January 27, 2007 | Reply

  3. I agree with that, Ramy. I really don’t want such arguments to take place here or anywhere else. Should we make it a “rule” for this blog to prevent arguments ?

    Comment by Mohammad Nabil | January 28, 2007 | Reply

  4. مقال رائع جدا

    Comment by م-هويدي | August 23, 2007 | Reply

  5. is .Net platform independent ?? plz justify ur answer


    Comment by Anonymous | November 1, 2008 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: