Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures

Home

Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips

Books

Submit News
Search the site here...
Search...
 
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

Java is better than .NET! part II

JavaFAQ Home » Good To Know Go to all tips in Good To Know


Bookmark and Share

Is Java better than .NET or not, it is up to you to decide after you read all the facts below... Part II.

Part I was published here...

.NET

In the summer of 2000 Microsoft already had in mind a new Internet strategy. It immediately generated a great deal of optimism about the ability of .NET to make Web technology and services delivery easier.

As spoken by many, One of the most modern aspects about the Microsoft.NET framework is the Common Language Runtime. Such allows developers create a single  runtime application for any language.

 

 



The Common Language Runtime will save developers time by enabling greater code reuse. Microsoft announced .NET not as a new operating system but as a new Internet and web based infrastructure that could deliver software as a web service. A framework of universal service, a server and also the promise that it would run on any browser. NET was based on the most recent Web standards.

.NET framework:

The .NET Framework is a development and execution environment allowing different programming languages & libraries to work together. This will give the possibility
to create Windows-based applications that are easier to manage, build, deploy, and integrate with other networked systems.

It supports C#, C++, Visual Basic and Microsoft version of Java script, as well as some 3rd party language like Perl, Python and so on.

C# :

C# is Microsoft's programming language for its recent platform, the .NET  Framework.

The .NET Framework is based in a runtime environment designed to manage execution of code, and a complete set of class libraries which allow almost  any programming task that is necessary.

Even though .NET code can be written in many languages, C# is the only language  conceived in particular for the .NET Framework.

Please look at the example below:

Code:

namespace FirstProgram {
    using System;
   
    class Example {
        static void Main () {
        Console.WriteLine ("Hello world!");
    }
  }
}

ASP+ :

ASP+ is the next "version" of ASP. ASP+ offers an entirely new paradigm for creating server-side Web scripts and it is based on XML.

ASP+ supports Visual Basic, C# and JScript as languages you can program to within a page and let us not forget that it contains a large set of HTML controls.

Let us observe carefully the following example.This is a simple example which shows Where and How we apply ASP.NET:

Code:


<html>
    <body bgcolor="yellow">
        <center>
            <h2>JUG-HOWRAH !</h2>
            <p>
                <%Response.Write(now())%>
            </p>
         </center>
    </body>
</html>

Win Form and Web form:

Both Winform and Webform are User Interface components framework applications accessible from Visual Studio.

ADO+ :

When referring to ADO+ one must affirm that this is an outstanding development to Microsoft ActiveX Data Objects (ADO) that supplies platform interoperability and scalable data access.

Because Extensible Markup Language (XML) is the format for carry out data, any application that can read the XML format can process data. Let us also keep in mind that the receiving component does not need to be an ADO+ component at all. It might be a Microsoft Visual Studio - based solution or any application running on any platform.
 

Comparison between Java and C#

 Java C#
It is derived from C/C++ It is also derived from C/C++
Code:

Illustration:( Definig static number):

class Mathoperation{
  static float  mul(float x, float y){
    return x*y;
  }
 
  static float divide(float x,float y){
    return x/y ;
  }

}

class Mathapplication{
  public void static main(string args[]){
    float a = Mathoperation.mul (4.0,5.0);
    float b = Mathoprtaion.divide(a,2.0);
    system.out.println("b="+b");
  }
}

Code:


// Imports types from System
// namespace, such as Console

using System;
class Counter{
  // New types are typically
  // classes or structs

  // --- Data members ---
  int value; // field of type int
  int value; // field of type int
  int scaleFactor; // field of type int
 
  // Constructor, used to initialize
  // a type instance

 public Counter(int scaleFactor){
   public Counter(int scaleFactor){
     this.scaleFactor = scaleFactor; 
  }

  // Method
  public void Inc(){
    value+=scaleFactor;
  }

  // Property
  public int Count{
    get {return value;}
  }

}

class Test{
  // Execution begins here
  static void Main(){
    // Create an instance
    // of counter type
    Counter c = new Counter(5);
    c.Inc();
    c.Inc();
   
    // prints "10";
    Console.WriteLine(c.Count); 

    // create another instance
    // of counter type
    Counter d = new Counter(7);
    d.Inc();
   
    // prints "7";
    Console.WriteLine(d.Count);
   }
}


It runs on any platform , with Virtual Machine. It only runs on windows base.

 These are the main two contrasts between Java and .NET languages.

Comparing  "Stack" function between J2EE and .NET

Stack Function J2EE . Net
Rational Database Access JDBC ADO.NET
Web Client JSP ASP.NET /ASP+
Standalone Client AWT/Swing Windows Forms
XML JAX Pack (JAXM, JAXR, JAXB, JAXP) System.Xml and .NET in general is built around XML.
Distributed Components RMI/IDL .NET  Remoting
Messaging Java Messaging Service (JMS) Microsoft Message Queuing (MSMQ)
Web Services Support Java Web Services Developer Pack (JWSDP) as well as vendor specific tools. Built directly into .NET and Visual Studio
Enterprise Components/Transactions COM+ Enterprise Java Beans (EJB)
Component Registration Active Directory Java Naming and Directory Interface JNDI

It is true that from the above table is not easy to choose a winner so to speak, they are quite similar at the end. Let us take for example computer monitoring- one is LG and another is Sun. Both are the same and share the same function but still what is the difference? Probably their company and Quality. So it is up to you to decide the right choice.

The followings points are to be considered an IT professional  or managers choose among them:

Importance of applications: What are your needs?

One must first evaluate his needs before coming to any conclusion. Java is Platform independent as mention earlier and .NET it only runs in Net framework. If in one hand Java is a very good deal in the other Microsoft tools are always reliable and easy to use.

Number of quality developer and infrastructure:

When considering the number of developers and infrastructure in a company Pacific Life Insurance Co. for instance, did not hesitate to adopt .NET technology. Brad Sewell, an assistant vice president in IT at Newport Beach, Calif.-based Pacific Life said his life insurance division would not consider Java because the division had deeply invested in Microsoft infrastructure.

Which is supported by other vendor?

One of the major points to hold is to know what other Vendors support. Vendors like Oracle corp and SAP-AG support Java instead of .NET. Just keep in mind that Java is older than .NET. It is an important decision to take concerning your company.

Cost :

Another vital aspect it to manage a budget and deal with the costs. Windows server operating system ships with a built-in application server, while going for the popular
Java-based application servers can cost up to $10,000 per CPU. These are extremely high values for a small company to handle.

Conclusion:

After many questions and clarifications it is still hard to say which is the best or which is worth acquiring. Both have their own characteristics and some identical properties; it is a fact. It is all a matter of requirements. Every day around the world thousands of IT developers question is is the best to use. This too is a question that will fill your mind and only you can decide. Remember, it all comes down to a case of need, always choose the one that match your requirements and your budget in order to have a happy client at the end of your day.

Reference:

  1. MSDN -- from Microsoft.com
  2. O' Reilly -http://www.oreillynet.com/pub/a/oreilly/Java/news/farley_0800.html
  3. Computer World: -J2EE vs. .NET
  4. Computer world: J2EE vs. .NET: The choice depends on your needs
  5. W3schools.com

 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search



Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy