Java vs. .NET - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Java vs. .NET

Description:

Value Types can be used as Objects. Aliased to System types so that any .NET ... Allen Jones, Adam Freeman. Microsoft Press. C# Language Pocket Reference ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 18
Provided by: chrisc65
Learn more at: http://www.austinjug.org
Category:
Tags: net | adam | java | jones

less

Transcript and Presenter's Notes

Title: Java vs. .NET


1
Java vs. .NET
  • Java vs. C
  • Swing vs. WinForms

2
C Language Differences
  • 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

3
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

4
Package Structure
  • To import use using keyword

5
.NET Types
  • 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)

6
Exception Handling
  • Catch Block can trap no Exception or specific
    Exceptions

7
Event Handling
  • .NET Delegates
  • Much different than Java

8
Class Properties
  • Declare a variable
  • Only a getter implies a read-only property
  • Can use lazy initialization
  • Can be defined in an Interface

9
Class Indexers
  • Instances of a class can be referenced with Array
    notation on the class

10
Operation Parameters
  • 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

11
Operation Visibility
  • 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

12
Component Assemblies
  • 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

13
Source Code Attributes
  • Used for compiler and runtime processing
  • Attributes are derived from System.Attribute
  • New and confusing for us Java Developers

14
Swing and WinForms
  • .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)

15
IDEs
  • Visual Studio
  • Requires .NET Framework install first
  • Horrendously lengthy installation
  • SharpDevelop
  • Open Source
  • Improve C Plugin
  • Eclipse
  • CodeWright
  • By Borland

16
References
  • C for Java Developers
  • Allen Jones, Adam Freeman
  • Microsoft Press
  • C Language Pocket Reference
  • Peter Dayton, Ben Albahari, Ted Neward
  • OReilly Books
  • XAML
  • C Namespaces Doc
  • .NET CodeDom
  • GotDotNet
  • How Do I?...Common Tasks
  • .NET 24/7
  • Windows Forms QuickStart Tutorial

17
Conclusions
  • 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
    deploymentwhy not use .NET?
  • Front-end .NET and Back-end Java J2EE?
Write a Comment
User Comments (0)
About PowerShow.com