this is delicious cookie you must eat. :o~. problem domain designed to be reliable, high-performance...

Post on 01-Jan-2016

213 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

This is delicious cookie you must eat.:O~

Problem DomainProblem Domain• Designed to be

Reliable, high-performance and secure

Comfortable and familiar to Java-language developers

Assist in the transition to .NET framework

• Developed solely to write software for Windows, using the .NET framework

Historical ContextDeveloped by Microsoft from 1998 to

2002.Named after Java / J++

# marking it as one of the .NET languages (C#, F#,…)

Recycled from earlier attempt: Visual J++

Historical Context: J++Windows-specific implementation of JavaJ++ programs only capable of running on

Microsoft’s special interpreter, optimized for Windows.

Sun Microsystems had originally licensed Java to Microsoft but sued over failure to fully implement Java specifications.

As part of the settlement, Microsoft ceases distribution of the interpreter.

J++ developers marooned.

Evolution of the LanguageRun-time libraries frozen at the JDK 1.1.4

levelJDK compatibility largely irrelevant due to coverage elsewhere by the .NET framework.

J# integrated into releases of Visual StudioAnnouncements in January 2007:

J# upgrade for 64-bit runtime support, compatibility with next version of Virtual StudioJ# being retired from future versions of Virtual Studio, with support for the existing version ending 2015

New ConceptsSame syntax as javaAccess to both java API and .NET

Framework library (BCL - Base Class Library)

Cross-language capabilities method written in one language can be

overriden in another language

Familiar Java Syntaximport System.*;

public class Hello{    public static void main(System.String[] args)    {        System.out.println("Hello.");    }}

Familiar Java Syntax cont.For Java

To Compile - javac Hello.javaTo Run - java Hello

For J#To Compile - jc Hello.java

To Run - Hello

Access to both java API and .NET Framework library

package ConsoleApp;

import java.io.*;

public class ReadString{      public static void main(String[] args)      {            String firstName = null;            String lastName = null;                        System.Console.WriteLine("Enter your first name: ");            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));            try {

                  firstName = br.readLine();

            } catch (IOException ioe) {

                  System.out.println("IO error");                   System.exit(1);

            }             System.out.println("Enter your last name: ");            lastName = System.Console.ReadLine();             System.out.println("Hello " + firstName + " " + lastName);            System.Console.WriteLine("Hello {0} {1}", firstName, lastName);      }}

Cross-language capability //J# class

import System.*;public class JLanguage{     public void getMessage()     {         System.Console.WriteLine("J#");     }}

//C# classusing System;class CLanguage:JLanguage{  public static void Main()  {       CLanguage c = new CLanguage();       JLanguage j = new JLanguage();       j.getMessage();       c.getMessage();  }  public override void getMessage()  {       Console.WriteLine("C#");  }}

Google Search

(not all are re the language, of course)

String

J#C#

java

Google results

.4M5M64M

JAVA vs. J#/.NET

Advantages and Disadvantages

J# offers the following features:•Generates platform-neutral code•Support for class libraries of VJ++, JDK 1.1.4•Brings cross-language capabilities into Java language•Simultaneously supports both JDK 1.1.4 and BCL (Base Class Library) of .NET Framework•Accesses platform-native resources•Generates XML documentation•Writes ASP.NET applications•Writes web services•Retains the majority of Java-like syntax and features

J#'s disadvantages:Programs can't run under the umbrella of JVMNo support for the Java Native Interface or

Remote Method InvocationNo operator overloadingMinimal support to convert binaries making

J/Direct callsAutomatic generation of proxy classes for web

servicesCannot call WebService methods using Enum

typesCannot add reference to .exe files

top related