0% found this document useful (0 votes)
24 views

3-Intro To Net and Java

This document provides an overview of C# programming and the .NET platform. It discusses the evolution of programming languages from machine code to C to Java to C# and the components of the .NET platform like the Common Language Runtime. The document also compares features of Java and .NET.

Uploaded by

210907
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

3-Intro To Net and Java

This document provides an overview of C# programming and the .NET platform. It discusses the evolution of programming languages from machine code to C to Java to C# and the components of the .NET platform like the Common Language Runtime. The document also compares features of Java and .NET.

Uploaded by

210907
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

C# Programming

Introduction to C#
Dot Net Platform
⚫ Platforms provide environments for development and execution of
programs
⚫ Two “largest” platforms out there today is Microsoft .Net and Java
– Both provide similar executable modules that rely on an “interpreter” at
execution time, but in different ways
⚫ .Net runs only on Microsoft Windows devices,
– but there are many front end languages that can be used to generate the
“Common Intermediate Language” (CIL).
– Only one IDE is available
⚫ Java provides only the Java programming language,
– Open Source (although now owned by Oracle)
⚫ Android Law Suite
– Multiple IDEs that all pretty much try to do the same thing.
– The resulting “bytecodes” can be used on several different operating systems
Main Objective of .Net Platform
⚫ Provide component based support for Web Applications, Web
Services and Windows Application.
– Classes are self-describing and reusable
⚫ When I do not comb
– One would compile a program to an object file, and then link the
object files into an executable
⚫ Same subroutine was compiled and placed into EXE over and over.
(Each EXE would have a copy)
⚫ When I comb over
– Concept of DLL (Dynamic Link Library) introduced
⚫ Separate pre-compiled routines that could be called from main
programs to do work
⚫ Was a mess with the way it was managed usually resulting in multiple
DLLs on a machine that did the same thing, but different version.
Main Objective of .Net Platform

⚫ If I shaved it all off:


– .Net Assemblies were introduced that used the Common
Intermediate Language (CIL) approach to produce reusable
components
⚫ Assemblies result in either an EXE or a DLL
– Exe has a “Main” entry point
– DLL’s can have multiple entry points that are self-described
⚫ What the heck does “self-described” mean?

– DLL’s can be shared between programs (or as a Web Service)


⚫ Assemblies are what execute through the Common
Languages Runtime (CLR)
.Net Platform Components

⚫ .Net Framework
– CLR (Common Language Runtime)
⚫ Virtual machine that “interprets” the CIL and manages the
execution of the program or call to the library
– Framework Class Library
⚫ A set of base classes used by C# that can be used by other
.Net Languages. (Types, Strings, Objects, etc)
⚫ Compilers
⚫ Interactive Development Environment (Visual Studio)
⚫ .Net Enterprise Servers (SQL Server, BizTalk,
Sharepoint for example)
From C To Shining C#
⚫ In the beginning there was machine code. Programs were entered with a
bunch of ones and zeroes (and if you were lucky, maybe in octal or hex). Every
machine was different. Life pretty much sucked.
⚫ Next came machine language which mapped a mnemonic to an instruction, and
introduced variables instead of direct addressing. Life sucked, but not as bad.
⚫ Then development programming took off and all the academic and business
types got their own damn programming languages. (COBOL, FORTRAN,
Basic, PL/1, LISP, etc.)
⚫ Finally, the “C” language (based somewhat on ALGOL) was introduced that
added a layer of abstraction for lower level system development making it
easier and more consistent to program, but still allowing for lower level “stuff” to
happen that may not be that welcomed in a development language like Basic,
COBOL or FORTRAN.
– All the basics were there. If you needed something else (string manipulation for
example), you wrote it yourself or tried to find someone else that already did it and
borrowed the code.
– Machine Language finally could be replaced with it’s own “higher level language”
– Programs (and operating systems) that were traditionally written in Assembly
Language, quickly adopted “C”
⚫ Unix, Microsoft Windows for example
– BTW – Yes, there was a “B” developed at Bell Labs. Not so sure about an “A”
though!!
From C To Shining C#

⚫ C++ was introduced to support Object Oriented Programming


and correct some “mistakes” in base “C”
– Implementation of the New and Delete operators to better request
and remove memory allocations during run-time
– Providing byRef type arguments to function calls
– Basing types on Classes that can inherit their attributes from other
Classes allowing developers to create their own new data types
– Improvements to the struct concept (well, really making a struct
and a class the same thing). Both classes and structures can
contain data definitions as well as functions and can specify the
visibility of these attributes.
– Many applications written in C were upgraded to C++ when it
become available.
From C To Shining C#
⚫ Java was then developed from C++ to provide an overall IDE that
resulted in simplifying development and deployment.
– Java Virtual Machine and bytecode meant that one could compile on one
operating system and run the resulting object on another
– All Java code is contained in classes (a Java program is a collection of
classes, where at least one of these classes contains a main).
– There is compile-time strong type checking between all the classes in a
program, regardless of which source files the class definitions are
contained in.
– Therefore, there is no need for header files, and header files are not
supported.
– Like C, and unlike C++, call by value is the only parameter passing
mechanism.
– Java has much more restrictive use of pointers (no address or explicit
dereference operator).
From C To Shining C#

⚫ More Info on Java


– Note that in Java, a variable is a local variable, parameter,
or a field.
– In Java, all garbage collection is automatic.
– The existence of a Java execution system (i.e., the JVM)
that guarantees how primitive types are implemented,
promotes safety, guarantees binary portability, and provides
dynamic linking.
– A modified form of Java became the language for Android
App development.
From C To Shining C#
⚫ C# is a modification of Java (in an approximate sense, C# is an
enlargement of Java) that:
– Includes some shout-outs from VB and Delphi
– Corrects mistakes made in the Java design (e.g., call by reference
and printf style formatting put back in language).
– Provides a type system that allows special objects (i.e., instances
of structs) to be treated as values, as opposed to Java where only
pointers and instances of primitive types are treated as values
(i.e., can be values of variables).
⚫ We’ll talk all this values and references next week
– In C#, the primitive types are defined as structs, arguably providing
C# with a type system that is more unified than the one in Java,
because, in C#, all types derive from Object (including
ValueType), and all value types (i.e., enumeration types and
structs) derive from ValueType.
From C To Shining C#
⚫ In C#
– A type is either a value type (in which case it derives from ValueType) or a
reference type (such as a class).
– Incorporates improved versions of some C++ features (such as operator
overloading) that were excluded from Java.
– Provides the option of including unsafe code, in which unprotected pointers
are used, so that C# can replace C and C++ in low-level implementations
such as device drivers.
– Provides features (such as properties, events, and attributes) that are
useful for component-based programming.
– Provides features such as indexers that are convenient for implementing
collection types.
– Provides improved versions of statements from non-C-family languages
(e.g., the foreach statement).
Top Level Java to C# Comparison
FEATURE JAVA .NET

Execution system JVM (Java Virtual CLR (Command Language Run Time)
Machine)
Class library Java class libraries FCL (Framework Class Library(

Intermediate code bytecodes CIL (Common Intermediate


Language)
Unit of deployment class file, jar file assembly

IDE JDeveloper, etc. Visual Studio 2013

SQL API JDBC, SQLJ; TopLink and ADO.NET, ADO.NET Linq to


other ORMs Entities

Web programming API servlets, JSP (Java ASP.NET Web Forms, ASP.NET MVC
Server Pages), JSF (Model View Controller)
(Java Server Paces)
GUI programming API AWT, Swing, JavaFX Windows Forms, Windows
(latter has RIA (rich Presentation Foundation
internet app) (latter has RIA support)
support)
.NET Other Languages

⚫ Because of it’s Common Intermediate


Language (CIL) and Common Language
Runtime (CLR), .Net provides for many front
end languages including:
– Visual Basic
– COBOL (believe it or not)
– F# (Best comparison is a .Net version of Fortran)

You might also like