You are on page 1of 71

.NET: what is it?

 “Strategy for delivering software as a


service’’
Microsoft .NET Framework is:
 A platform for building, deploying, and
running web services and applications.
 It provides a highly productive,
standards-based, multi-language
environment for integrating existing
investments with next-generation
applications and services as well as the
ability to solve the challenges of
deployment and operation of Internet-
scale applications.
Features of .NET
 •NET is a new platform for the
development and deployment of
modern, object-oriented, “managed”
applications.
 Fully functional •NET applications can
be developed using any programming
language that targets the •NET runtime.
 •NET provides a comprehensive
framework of language-neutral class
libraries.
Features of .NET
 •NET supports the creation of self-
describing software components.
 •NET supports Multilanguage
integration, cross-language component
reuse, and cross-language inheritance.
 •NET introduces a new way to develop
Windows desktop applications using
the Windows Forms classes.
Features of .NET
 •NET provides a new way to develop
Web browser-based applications using
the ASP.NET classes.
 •NET’s ADO.NET classes provide a new
disconnected architecture for data
access via the Internet.
 •NET supports the creation of platform-
independent XML Web services using
standards such as SOAP (Simple
Object Access Protocol) and WSDL
(Web Service Description Language).
Features of .NET
 •NET provides a new architecture for
the development and deployment of
remote objects.
 •NET makes many Windows
technologies and techniques obsolete.
.NET Framework
Design Goals
 Dramatically simplifies development and
deployment
 Unifies programming models
 Provides robust and secure execution
environment
 Supports multiple programming
languages
Introducing the .NET
Framework
 The .NET Framework is Microsoft’s next-
generation application platform
 You can create:
 Windows applications
 Windows services
 Web applications
 Web services
 Console applications
 And much, much more
.NET Clients
 PCs,
 laptops,
 workstations,
 phones,
 handheld computers,
 Tablet PCs,
 game consoles, and
 other smart devices that
run operating systems
such as Windows CE,
Windows Embedded,
Window 2000, and
Windows XP.
A Sample Bank Application Using .Net
The .NET Evolution
Applicatio
n

Code and
data
structures

Before COM, applications were


completely separate entities
with little or no integration
The .NET Evolution

COM provides a way for


components to integrate;
However, each
component must provide
the “plumbing” and
objects cannot
directly interact
The .NET Evolution

With the .NET Framework


common language runtime,
components are built on a
common substrate; No
“plumbing” is needed and
objects can directly interact
.NET Framework
 Consists of three main parts:
 Common Language Runtime;
 .NET class library;
 ASP.NET.
The .NET Architecture

.NET Framework
Unified Classes
ASP.NET
W eb C lasses (AS P.N ET)
Controls, Caching, Security, Session, Configuration e

Unified Classes
D ata (ADO .NET) W indow s Form s
ADO , SQ L,Types etc Design, Cm pnt M odel etc

Common Language Runtime


XM L C lasses Draw ing C lasses
XSLT, Path, Serialization etc
Drawing, Im aging, Text, etc

Windows System Classes


Operating System Services Collections, Diagnostics, G lobalization, IO , Security
(COM+, Transactions, Message Queuing etc) Threading Serialization, Reflection, Messaging etc
Framework, Languages,
And Tools
VB C++ C# JScript J#

Common Language Specification

ASP.NET

Visual Studio.NET
Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO.NET and XML

Base Class Library

Common Language Runtime

Operating System
Framework, Languages, And Tools

VB C++ C# JScript J#

Common Language Specification

ASP.NET

Visual Studio.NET
Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO.NET and XML

Base Class Library

Common Language Runtime

Operating System
Common Language
Runtime
 The Common Language Runtime is the
execution engine for .NET Framework
applications:
 CTS: Common Type System
 CLS: Common Language Specification
 CIL and Metadata
 VES: Virtual Execution System
Common Language Runtime
Base Class Library Support

Thread Support COM Marshaler

Type Checker Exception Manager

Security Engine Debug Engine

IL to Native Code Garbage


JIT Compiler Manager Collector

Class Loader
Common Language Runtime
 Manages running code
 Verifies type safety
 Provides garbage
collection, error
handling
 Code access security for
semi-trusted code
 Provides common type
system
 Value types (integer,
float, user defined, etc)
 Objects, Interfaces
 Provides access to
system resources
 Native API, COM interop,
etc
Compilation And Execution
Compilation

Source Language Code (IL)


Assembly
Code Compiler Metadata

Native JIT
Code Compiler At installation or the
first time each
Execution method is called
All Languages are compiled to IL code
Portable Executable File (PE File)

PE Header

CLR Header

Metadata

MSIL Code

Resources

.NET PE File example: Hello world!


Metadata and IL Code
Example: Hello World!
C# version metadata and IL code
Managed C++ version compile metadata and IL code

 Metadata:
 data about data; description of assembly, description of types, attributes
 objects can communicate with each other
 Stored in binary format, CLR loads metadata into memory for reference
 IL code:
 intermediate language, CPU independent sets of instructions
 Assembly:
 a basic unit of versioning, deployment, security management, execute, reuse
and sharing.
 Manifest: Assembly Metadata
Assembly (1)
 An assembly is the primary building
block of a .NET Framework application.
 It is a collection of functionalities that is
built, versioned, and deployed as a
single implementation unit (as one or
more files).
 In general assemblies consist of:
 Assembly metadata (manifest)
 type metadata
 IL code
 Resources
Assembly (2)
The Manifest
 identity (name, version number, optional
culture)
 file list (name + cripto hash for files in
the assembly)
 referenced assemblies (references to
other assemblies (which version?))
 exported types and resources
 permission requests (requested, desired,
never granted)
Type Metadata
 signature (description) for types
contained in the assembly
 name, visibility, base class, interfaces
implemented
 members (methods, fields, properties,
events, nested types)
 custom attributes:
 user defined, complier defined, framework
defined
 used for design, reflection, conversion,
serialization, debugging, profiling
How CLR Acts as a Virtual
Machine?

 mscoree.dll (execution engine)


 mscorwks.dll (does most
initialization)
 mscorjit.dll (contains JIT)
 mscorlib.dll (BCL)
 fusion.dll (assembly binding)
Common Type System (1)
 The Common Type System is a rich type system,
built into the Common Language Runtime, that
supports the types and operations found in most
programming languages.
Common Type System (2)
Common Language
Specification
 The Common Language Specification is
a set of constructs and constraints that
serves as a guide for library writers and
compiler writers.
 It allows libraries to be fully usable from
any language supporting the CLS, and
for those languages to integrate with
each other.
 Supported languages: C#, VB, C++,
Python, Perl, Eifell, Cobol, Smalltalk,
Haskell, ML, Scheme.
VES: Virtual Execution
System

 Class Loading
 Type Verification
 IL to native JIT conversion
Class Loader
 Loads referenced classes from assemblies
into memory
 it ensures:
 some consistence checking for loaded types
 stubs calling JIT compiler for new loaded classes
 known amount of required space for classess of
instantiable types, subclasses of abstract types
 the shape of the space is known
 references made by the loaded type to types that
have already been loaded are resolved.
Type Safety and Verification
 Constraints to verify:
 A reference to a type is strictly compatible with the
type being referenced (typed thing and reference).
 Only appropriate operations can be invoked on an
object.
 Identities are what they claim to be (no way to
corrupt or spoof objects).
 The loader:
 ensures that type signatures are consistent
between the use and implementation of every
method and field (the incoming values have the
indicated type signature).
 The verification algorithm:
 ensures that the implementation maintains the
correctness of the type signatures.
JIT Compilation
 Before MSIL can be executed, it must
be converted to native code
 convert the MSIL as it is needed
 caching of the resulting native code for
subsequent calls.
Simplify Development
 Completely eliminates COM plumbing
 No more…
 Registration =>self described apps
 GUIDs =>hierarchical namespaces
 .IDL files =>unified object model
 HRESULTs =>structured exceptions

 IUnknown =>common root object

 AddRef/Release =>garbage collector

 CoCreateInstance =>”new” operator


Simplify Development
 Common Type System
 Common instance and type definition
 Enables clean OO programming
 Classes and interfaces
 Constructors, properties, methods, events
 Cross language inheritance
 Built-in interoperability
 With COM
 With native (Win32 style) DLLs
®
Everything Is An Object
 Traditional views of primitive types
 C++, Java™: They’re “magic”
 Smalltalk, Lisp: They’re full-blown objects
 .NET Framework solution: Value types
 unifies with no performance cost
 Deep simplicity throughout system
 Improved extensibility and reusability
 New primitive types: Decimal, SQL…
 Collections, etc., work for all types
Everything Is An Object
 Boxing
 Allocates box, copies value into it
 Unboxing
 Checks type of box, copies value out
Dim i As Integer = 123 int i = 123;
Dim o As Object = i object o = i;
Dim j As Integer = CInt(o) int j = (int)o;

i 123

o System.Int32
123
j 123
Robust Environment
 Automatic lifetime management
 All objects are garbage collected
 Exception handling
 Error handling first class and mandatory
 Type-safety
 No buffer overruns, No unsafe casts,
Uninitialized variables
Secure Environment
 Security designed-in
 Code access security enforcement
 Security based on the identity of code
 Administratively configurable via policy
 ASP.NET integrated authentication
of user
 Windows identity, Passport , forms-based, …
®

 Cryptography library with XML


DSIG support
 Digital signature for XML (
www.w3.org/signature)
Simplify Deployment
And Management
 Zero-impact install
 Applications and components can be
shared or private
 Side-by-side execution
 Multiple versions of the same component
can co-exist on a system
 Assemblies
 Contain dependency information
Framework, Languages, And Tools
VB C++ C# JScript J#

Common Language Specification

ASP.NET

Visual Studio.NET
Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO.NET and XML

Base Class Library

Common Language Runtime

Operating System
Unify Programming Models
Consistent API availability regardless of
language and programming model

.NET Framework
RAD, Subclassing, Stateless,
Composition, Power, Code embedded
Delegation Expressiveness in HTML pages

VB Forms MFC/ATL ASP

Windows API
How Much Simpler?
Windows API
HWND hwndMain = CreateWindowEx(
0, "MainWClass", "Main Window",
WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
(HWND)NULL, (HMENU)NULL, hInstance, NULL);
ShowWindow(hwndMain, SW_SHOWDEFAULT);
UpdateWindow(hwndMain);

.NET Framework
Dim form As New Form()
form.Text = "Main Window"
form.Show()
Factored And Extensible
 The Framework is not a “black box”
 Any .NET class is available for you to
extend through inheritance
 Gives developers much more head room
 Plug and Play components
and subsystems
The .NET Framework Library

ASP.NET
Web Forms Web Services Windows
Mobile Internet Toolkit
Forms

ADO.NET and XML

Base Class Library


The .NET Framework Library
System.Web System.Windows.Forms
Services UI Design ComponentModel
Description HtmlControls
Discovery WebControls
Protocols System.Drawing
Caching Security Drawing2D Printing
Configuration SessionState Imaging Text

System.Data System.Xml
OleDb SqlClient XSLT Serialization
Common SQLTypes XPath

System
Collections IO Security Runtime
Configuration Net ServiceProcess InteropServices
Diagnostics Reflection Text Remoting
Globalization Resources Threading Serialization
Base Framework
System
Collections Security
Configuration ServiceProcess
Diagnostics Text
Globalization Threading
IO Runtime
Net InteropServices
Reflection Remoting
Resources Serialization
Data And XML
System.Data
OleDb SQLClient
Common SQLTypes

System.Xml
XSLT Serialization
XPath
ASP.NET
System.Web
Services UI
Description HtmlControls
Discovery WebControls
Protocols
Caching Security
Configuration SessionState
Windows Forms®

System.Windows.Forms
Design ComponentModel

System.Drawing
Drawing2D Printing
Imaging Text
Framework, Languages, And Tools
VB C++ C# JScript J#

Common Language Specification

ASP.NET

Visual Studio.NET
Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO.NET and XML

Base Class Library

Common Language Runtime

Operating System
Family of Languages
Languages
 The .NET Platform is language neutral
 All .NET languages are first class players
 You can leverage your existing skills
 Common language specification
 Set of features guaranteed to be in all languages
 MS providing
 Visual Basic.NET®, C++.NET, C#, J#, JScript®
 Third-parties are building
 APL, COBOL, Delphi, Pascal, Eiffel, Haskell, ML,
Oberon, Perl, Python, Scheme, Smalltalk…
Standardization
 A subset of the .NET Framework and C#
submitted to ECMA
 Adopted as International standards in
Dec. 2001 in the ISO fast-track process.
 Now Co-sponsored with Intel, Hewlett-
Packard
 Common language infrastructure
 Based on common language runtime and
base framework
 Layered into increasing levels
of functionality
.NET Languages (Microsoft)
 Microsoft: Visual Basic.NET
 Microsoft: C#
 Microsoft: C++ (Managed/Unmanaged)
 Microsoft: J#
.NET Languages (Others)
 APL  Oberon
 Fujitsu COBOL  Pascal
 Micro Focus COBOL  Perl
 Eiffel  Python
 Forth  RPG
 FORTRAN 95  S#
 Haskell  Scheme
 Mercury  Standard Meta
 Mondrian Language
Is .NET right for you?

 For developers, almost certainly if:


 You need to create or consume Web services
 Your applications are heavy producers or parsers of XML
 You want to go with the “disconnected dataset” model of
data access
 You are building Web applications and want to go with a
more object-oriented model of development
 Your clients are asking for it
 There is a large-scale, fundamental migration under
way from traditional Windows programming to .NET;
the market for the former is likely to undergo
substantial contraction
Is .NET right for you?
 For general businesses, almost certainly
if:
 They need to be able to integrate their
applications with those of their suppliers,
partners, or customers
 They’re spending a lot of money
“reinventing the wheel” each time they build
an ASP Web application and want to more
easily reuse presentation and business
elements
Is .NET right for you?
 Probably not yet for developers, if:
 Your clients aren’t asking for it
 You’re swamped with business for
application development in VB, C++, or
whatever other languages you develop in
Is .NET right for you?
 Probably not yet for businesses, if:
 You have no need to integrate your data-driven applications
with those of your suppliers, partners, or clients
 Your Web applications are relatively simple and you have only
modest requirements for code reuse
Analyst Perspective On .NET
“.NET is a brilliant strategy that enables Microsoft to
define the next shift in the software business.”
Gartner Group
“Everyone should build on the
XML/SOAP foundation.”
Gartner Web Services
Magic Quadrant
Meta Group
“Gartner believes Microsoft is now

Ability to Execute
providing more vision and influence
regarding this shift than any other
vendor.”
IBM

Sun
Gartner Group HP
“.NET is a leading example of what Oracle
we believe will be the dominant
architectural model for the third
generation of Internet applications.” Completeness of Vision
*Source: Gartner Research, 9/13/2001
Middleware App. Server & Web
Services Benchmark

 MiddleWare Co. re-test of J2EE vs. .NET Per./Scale


 Spent 4 months testing J2EE and .NET reference
applications
 Developed new J2EE application optimized for performance
 Conducted new series of comprehensive benchmarks
 All results taken by and certified by Middleware Company
 Includes Web Application, Web Services and
Distributed Transaction benchmarks
 Report available at
http://www.middleware-company.com/j2eedotnetbench
 Downloadable code, test scripts, discussion forum
also available
Web Application Benchmark
Tests n-tier Web application hosting
8000
2CPU
4CPU 550 MHz Compaq ProLiant 8500
7000
8CPU

6000

5000 Windows Server 2003 outperforms


Responses/sec

4000
J2EE by 339% on the Web
application benchmark
3000

2000

1000

0
J2EE Application J2EE Application .NET 1.0/W2K .NET 1.1/Windows.NET
Server A Server B
Web Services Benchmark
Web Service Hosting Performance
Multiple
1000
Clients Making Remote SOAP Requests over HTTP
2CPU
900 4CPU 550 MHz Compaq
800 8CPU

700
SOAP Requests/sec

600
.NET Framework 1.1 on Windows Server 2003
500 outperforms J2EE by 331% in Web service testing
400

300

200

100

0
J2EE A J2EE B MS W2K MS Win .NET
Developer Productivity:
Comparing .NET And J2EE Implementations
Based on new Middleware J2EE Reference Application with EJBs
and Equivalent .NET Reference Application with C# Components
.NET Implementation
16000
14004
J2EE Implementation
14000

12000
Lines of Code Required

10000
Optimizing, configuring
8000
J2EE: 10 man-weeks per application server
6187
.NET:
5567 2 man-weeks
6000

4000 2096
2053
1002 795
2000
197 197 102

0
Total User Interface Middle Tier Data Tier Config
Summary
 The .NET Framework
 Dramatically simplifies development and
deployment
 Unifies programming models
 Provides robust and secure execution
environment
 Supports multiple programming
languages
Discussion

You might also like