You are on page 1of 12

Chapter 1: Introduction

Introduction
The Evolution from C 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
 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)
 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

 .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
– 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)
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).
– 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

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 Faces)
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
– F# (Best comparison is a .Net version of Fortran)

You might also like