Java vs net
Download
1 / 17

- PowerPoint PPT Presentation


  • 280 Views
  • Updated On :

Java vs. .NET. Java vs. C# Swing vs. WinForms. Class Declaration .NET Types Event Handling Exception Handling Operation Parameters Operation Visibility. Component Assemblies Package Structure Class Properties and Structures Class Indexers Source Code Attributes.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about '' - Leo


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Java vs net l.jpg

Java vs. .NET

Java vs. C#

Swing vs. WinForms

The Object Services Company, Inc.


C language differences l.jpg

Class Declaration

.NET Types

Event Handling

Exception Handling

Operation Parameters

Operation Visibility

Component Assemblies

Package Structure

Class Properties and Structures

Class Indexers

Source Code Attributes

C# Language Differences

The Object Services Company, Inc.


Class declaration l.jpg
Class Declaration

  • class SomeClass : ExtendedClass, Interface1, Interface2

    • SomeClass extends ExtendedClass

    • SomeClass implements Interface1 and Inteface2

  • More than one object can be declared inside the .cs file

The Object Services Company, Inc.


Package structure l.jpg
Package Structure

  • To import use ‘using’ keyword

The Object Services Company, Inc.


Net types l.jpg

Value Types can be used as Objects

Aliased to System types so that any .NET language can use them from any other .NET language

(See column to the right) 

Structures

Can have constructors

Java boolean

bool (System.Boolean)

Java bytes

byte (System.Sbyte)

Java char

char (System.Char)

Java int

int (System.Int32)

Java long

long (System.Int64)

Java float

float (System.Single)

Java double

double (System.Double)

.NET Types

The Object Services Company, Inc.


Exception handling l.jpg
Exception Handling

  • Catch Block can trap no Exception or specific Exceptions

The Object Services Company, Inc.


Event handling l.jpg
Event Handling

  • .NET Delegates

    • Much different than Java

The Object Services Company, Inc.


Class properties l.jpg

Declare a variable

Only a getter implies a read-only property

Can use lazy initialization

Can be defined in an Interface

Class Properties

The Object Services Company, Inc.


Class indexers l.jpg

Instances of a class can be referenced with Array notation on the class

Class Indexers

The Object Services Company, Inc.


Operation parameters l.jpg
Operation Parameters on the class

  • Undetermined Number of Parameters

    • public void methodCaller( params int[] a );

      • methodCaller( 1 );

      • methodCaller( 1, 2, 3, 4, 5 );

  • Pass by Reference

    • public void increment( ref int a )

      • Can possibly change the value of ‘a’

  • Pass by Reference and Change Value

    • public void DoNothing( out int a )

      • Ensures ‘a’ is changed

The Object Services Company, Inc.


Operation visibility l.jpg
Operation Visibility on the class

  • Overriding Inherited Operations

    • Requires superclass method to be marked ‘virtual’

    • Overriding method must be marked ‘override’

  • public, protected, and private are the same as in Java

  • internal

    • Member is accessible from the entire assembly.

    • More than one object can be declared inside the .cs file.

    • Each object has a handle to the internal member

  • protected internal

    • A union of protected and internal.

    • Can be accessed from the entire assembly, or within objects which derive from this class

The Object Services Company, Inc.


Component assemblies l.jpg
Component Assemblies on the class

  • Common Language Runtime (CLR)

    • Similar to Java VM

    • But multi-lingual, i.e. VB, C++, C#

  • Shareable Dynamic Link Libraries

  • Shareable Code Modules

    • Linked at compile-time

  • Transparency to all .NET languages

    • Should be aware of data types, naming and formatting standards

The Object Services Company, Inc.


Source code attributes l.jpg
Source Code Attributes on the class

  • Used for compiler and runtime processing

  • Attributes are derived from System.Attribute

  • New and confusing for us Java Developers

The Object Services Company, Inc.


Swing and winforms l.jpg
Swing and WinForms on the class

  • .NET has the same GUI components as Swing

  • No Layout Managers

  • .NET has Data Binding!

    • DataProvider manages DataSources

    • DataSet is a disconnected, in-memory data cache

  • Lots of 3rd Party Controls converted from COM Components to .NET

    • Especially Tables and 2D Graphs

  • Extensible Application Markup Language (XAML)

The Object Services Company, Inc.


Ide s l.jpg
IDE’s on the class

  • Visual Studio

    • Requires .NET Framework install first

    • Horrendously lengthy installation

  • SharpDevelop

    • Open Source

  • Improve C# Plugin

    • Eclipse

  • CodeWright

    • By Borland

The Object Services Company, Inc.


References l.jpg

C# for Java Developers on the class

Allen Jones, Adam Freeman

Microsoft Press

C# Language Pocket Reference

Peter Dayton, Ben Albahari, Ted Neward

O’Reilly Books

XAML

C# Namespaces Doc

.NET CodeDom

GotDotNet

How Do I?...Common Tasks

.NET 24/7

Windows Forms QuickStart Tutorial

References

The Object Services Company, Inc.


Conclusions l.jpg
Conclusions on the class

  • More web info for Java than .NET …for now…

  • Longhorn and XAML

    • XAML can be translated at run-time for WinForms or WebForms

  • If Windows is the only client platform for deployment…why not use .NET?

    • Front-end .NET and Back-end Java J2EE?

The Object Services Company, Inc.


ad