18
S.Kartikeyan Microsoft.NET Vs Sun JAVA BY

S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Embed Size (px)

Citation preview

Page 1: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

S.Kartikeyan

Microsoft.NET Vs Sun JAVA

BY

Page 2: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

MOTTO

Bill Gates

Bill Joy

Software to Connect Information,People,Systems and Devices

Write Once ,Run Anywhere

Microsoft.NET

JAVA

Page 3: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

DESIGN GOAL

Your Application

Windows OS

Monitor MouseKeyboard

Your Application

.NET Framework

Internet Devices

Cell Laptop Palmtop

Scanner

Classic Application .NET Application

(Contd…)

Page 4: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

JVM JVM JVM

Win OS Linux Apple

HardWare

HardWare

HardWare

Java Applications .NET Applications

.NET Framework

Microsoft Operating SystemsWin2000,WinServer2003,

Windows XP

Hardware

Page 5: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Why is .NET

1. Microsoft Wanted an alternative to maintain different libraries being written for VC++,VB,ASP etc.

2. Address Emergence of XML and Web Services3. Provide Something New4. Compete with JAVA world by providing free compilers5. Integrate all this in the next version of Visual Studio

Page 6: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Myths About C# ,.NET and Java

•Microsoft.NET is a Platform and C# is a language on it just like C is for UNIX.There are many other language on .NET like VB,VC++

•When people talk about Java they don’t know whether they mean Java Language or Java Compiler or Java Virtual Machine

Page 7: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Different Levels and Terminology

•Language Level Distinguishing C# and Java features•Compiling level How to locate the libraries and other dependencies•Runtime Level CLR Vs JVM and Runtime Libraries•At a developer level what are the differences•At the Enterprise Level what differences can be noticed•Finally what does the End User get out of both•Future of both the technologies

Managed Exe or Dll means that which are run by Common Language Runtime of .NET(mscoree.dll)

Page 8: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Language Level

1. Java is called a better C++ though some of the useful features like operating overloading was removed for no clear reasonsC# retains all the good features of C++ including operator overloading

2. Pointers considered the most useful feature and dangerous featureof C++ is completely removed in Java C# has a special block called unsafe{}. You have to use pointers only in these blocks.

3. C# provides all security access levels of the code which Java provides

James Gosling

Page 9: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

4. C# switch statement is more matured than Java switch statementwhich Java designers call themselves NONSENSE C SWITCH SYNTAX

5. Class files in Java are similar to C# Managed Dlls

6. Jar files in Java which are usually collection of class files such as servlet.jar are somewhat similar to .NET asp_net.dll

7. C# is object and component oriented where as Java is object oriented. To support component oriented programming C# supportsadding attributes to types which will be understood by compiler to generate corresponding IL code. C# dll’s or exes (managed) can callCOM components and COM components can call C# Dll’s and exec's.That is contrary to Java where it uses a package called beans

8. Example of attributes[STAThread]public static void Main(){}

9. Java applets has no C# equivalent. So writing Java Browser plugins is more easier than C# components ( ActiveX controls)

Page 10: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Compiler Level

CSC

Source Files

LibrariesC:\winnt\GAC

XYZ.dll Or

XYZ.exe

Source Files

Compile Time LibrariesC:\jdk\lib

XYZ.class

JAVAC

Page 11: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Runtime•Java Virtual Machine is called java.exe•JVM understands byte codes in class files•Runtime libraries exist in JRE directory•Running a program or class file is shell:>java.exe xyz•Java.exe calls xyz.Main()•Applies some permission objects and policy files and runs xyz in a sandbox

•.NET Virtual Machine is mscoree.dll •It is also called common language runtime (CLR)•JVM understands MSIL in dlls and executable files•Runtime libraries exist in C:\winnt\GAC•Running a program is just shell:\>xyz.exe no explicit invocation of CLR•CLR calls the xyz.Main()•Applies some permission objects and config files and runs xyz in a sandbox

Page 12: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Loading of CLR in Managed exe

C# compiler places JMP _CORExeMain in CODE Section mscoree.dll in IDATA section of abc.exe(say)In Unix to know the .so files a exe refers try sh:>ldd /bin/bash

You invoke abc.exe from a shell in the case of Managed exe

•Windows Loader checks the IDATA section and attaches Mscoree.dll to the process address space.•Then it fixes the _CORExeMain function address in CODE Section . •The _CORExeMain function does the invocation of JITCompilerWhich translates MSIL to Native.•Native code then executes

Page 13: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Loading of CLR in Managed DllIn the case of Managed dll being loaded at runtime you typicallyUse LoadLibrary() Method passing the name of the Managed dll file

•Windows Loader calls the DllMain() function of the Managed dll•DllMain() Loads MSCorEE.dll•DllMain() of MSCorEE.dll calls _CORDllMain() function• _CORDllMain performs all the tasks what _CORExeMain does•The _CORDllMain function does the invocation of JITCompiler• JITCompiler translates MSIL to Native.•Native code then executes

Page 14: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Developer Level

•In Java you have no option than to program in JAVA language•In .NET there are some 10 languages as of now ,of which the prominent one is C#.• All Language compilers compile their code to MSIL•This is possible as all adhere to the Common Type System(CTS) of .NET•Visual Studio.NET IDE is better than any JAVA IDE available today•It can be possible in JAVA if someone writes a new language compilerin for JVM which translates sources files to JVM compatible class files•Users in .NET now has the option of having any language to generatea library and it can be reused from any language

Page 15: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Enterprise Level

Presentation Tier (ASP.NET Vs JSP)

Middle Tier ( Web Services, DCOM VsWeb Services and Beans)

Database Tier(SQL Server Vs ____)

ADO.NET JDBC

Page 16: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

End User Level

•Microsoft.NET Passport is one of the services end-users are getting advantage as of now•More are expected to come

Page 17: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Future and Marketing Elements

•Microsoft has good Marketing expertise than SUN •Visual Studio.NET IDE is an added advantage to MicrosoftJava world has to wait for such an IDE •Microsoft is spending a lot of money in .Net R&D •On the other hand IBM is spending 10 times more than SUN to promote JAVA . •The support for XML in Microsoft.Net is Fundamental where is in JAVAit is an API based•As Microsoft.Net and Java support XML Web Services ,developershas the choice of either platforms

Page 18: S.Kartikeyan Microsoft.NET Vs Sun JAVA BY. MOTTO Bill Gates Bill Joy Software to Connect Information, People,Systems and Devices Write Once,Run Anywhere

Thank You