microsoft net l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Microsoft .NET PowerPoint Presentation
Download Presentation
Microsoft .NET

Loading in 2 Seconds...

play fullscreen
1 / 69

Microsoft .NET - PowerPoint PPT Presentation


  • 513 Views
  • Uploaded on

Microsoft .NET Gaurav Gupta Dinesh Chandnani CSc 630 Spring 2002 Acknowledgements Microsoft MSDN http://www.msdn.microsoft.com/library Microsoft GotDotNet http://www.gotdotnet.com Sun Microsystems http://www.java.sun.com Csharp Help http://www.csharphelp.com Sam Gentiles Website

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 'Microsoft .NET' - jaden


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
microsoft net

Microsoft .NET

Gaurav Gupta

Dinesh Chandnani

CSc 630 Spring 2002

acknowledgements
Acknowledgements
  • Microsoft MSDN http://www.msdn.microsoft.com/library
  • Microsoft GotDotNet http://www.gotdotnet.com
  • Sun Microsystems http://www.java.sun.com
  • Csharp Help http://www.csharphelp.com
  • Sam Gentiles Website

http://www.project-inspiration.com/sgentile/

  • Brinkster Web Hostinghttp://www.brinkster.com
  • DotNetBuzz http://www.dotnetbuzz.com
  • .netWire http://www.dotnetwire.com
  • The IT Portal http://www.theitportal.com/dotnet
  • .NET Experts http://www.dotnetexperts.com

CSc 630: Microsoft .NET

outline
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

slide4

Microsoft Vision

Empower people, any time, any place,and on any device through great software

CSc 630: Microsoft .NET

outline5
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

net design goals
.NET Design Goals
  • Unifies programming models
  • Dramatically simplifies development
  • Provides robust execution environment
  • Supports multiple programming languages
  • Natively supports XML Web Services

CSc 630: Microsoft .NET

outline7
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

the net framework

VB

C++

C#

JScript

Visual Studio.NET

Common Language Specification

ASP.NET: Web Services

and Web Forms

WindowsForms

ADO.NET: Data and XML

Base Class Library

Common Language Runtime

The .NET Framework

CSc 630: Microsoft .NET

terminology abc
Terminology "ABC"
  • CLR: Common Language Runtime
    • One runtime for many programming languages
  • Assembly
    • Container for code, metadata and resources—your new term for what you used to call “D-L-L“
  • Intermediate Language(IL)
    • One intermediate, high-level assembly-style language that is emitted by language compilers
  • Metadata
    • Information that describes the shape of data and the runtime behavior of a program

CSc 630: Microsoft .NET

execution model clr

Source code

VB

C#

C++

Unmanaged

Component

Compiler

Compiler

Compiler

Managed

code

Assembly

IL Code

Assembly

IL Code

Assembly

IL Code

Common Language Runtime

JIT Compiler

Native Code

Operating System Services

Execution Model: CLR

CSc 630: Microsoft .NET

common language runtime
Common Language Runtime
  • Robust and secure execution environment
    • Type safe, garbage-collecting
  • Common for multiple languages
    • Deep-integration options
  • Simplifies deployment and management
    • No registry involved, zero-impact install
    • Side-by-site execution of multiple versions
  • Potentially Multi-Platform ?

CSc 630: Microsoft .NET

common language runtime12
Common Language Runtime
  • Execution environment for "managed code"
  • Managed?
    • Code resides on disk as IL
      • Must be translated into machine code
    • Code references other code
      • Other code residing in other assemblies must be found
    • Memory must be managed
      • .NET employs a garbage collector to do that job
    • Execution must be as secure as possible
      • Safeguard code against viruses and worms

CSc 630: Microsoft .NET

clr execution model conceptual

Assembly

Language Compiler

Native

Code

JIT Compiler

Execution

CLR Execution Model: Conceptual

Compilation

Code (IL)

Source Code

Metadata

Before installation or the first time each method is called

CSc 630: Microsoft .NET

slide14

Assembly

  • Assemblies
    • contains the code that CLR executes
    • functional building blocks
    • self-aware
    • retrieve any dependant assemblies
    • does not execute without Assembly Manifest

CSc 630: Microsoft .NET

assembly
Assembly
  • Assemblies are loadable entities containing
    • Assembly metadata
    • Type metadata
    • MSIL code
    • Resources
  • Assemblies contain:
    • Modules
  • Consists of one or multiple physical files
    • Bundled by a "packing list": The Manifest

CSc 630: Microsoft .NET

manifest standard elements
Manifest: Standard Elements
  • Manifest is a table with information records
  • Manifest contains information about:
    • Assembly name
    • Version information
    • Processor and OS
    • Files that make up this assembly
    • References to types and resources

CSc 630: Microsoft .NET

modules
Modules
  • Module is a compiled unit
  • Modules contain metadata and IL
    • Metadata describes structure
    • IL describes runtime behavior
  • Modules cannot be loaded independently
    • Must be contained in assembly

CSc 630: Microsoft .NET

intermediate language il
Intermediate Language (IL)
  • .NET languages are compiled to an Intermediate Language (IL).
  • CLR accepts the IL code and recompiles it to machine code.
  • The recompilation is just-in-time (JIT) meaning it is done as soon as a function or subroutine is called.
  • The JIT code stays in memory for subsequent calls.
  • In cases where there is not enough memory it is discarded.

CSc 630: Microsoft .NET

outline19
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

slide20

.assembly hello {}

.assembly extern mscorlib {}

.method static public void main() il managed {

.entrypoint

.maxstack 1

ldstr "Hello World from IL!"

call void [mscorlib]System.Console::WriteLine(class System.String)

ret }

MSIL: Hello World

class HelloWorld {public static void Main() {System.Console.WriteLine("Hello World");   } }

CSc 630: Microsoft .NET

metadata
Metadata
  • A type must be self descriptive: It must describe properties and methods that it exposes.
  • Examples:
    • The type Integer describes what values it takes and what operations it accepts.
    • The type Check describes what values (e.g., AccountNo and Amount) it takes and what operations (e.g., Cash, Deposit) it accepts.

CSc 630: Microsoft .NET

slide22

.NET JVM: CLR

  • JIT (Just-In-Time)
    • compiles methods
    • caches the native code
  • Verify MSIL to be type safe
  • Managed code can contain platform specific calls and dependencies.

CSc 630: Microsoft .NET

slide23

Common Type System

CSc 630: Microsoft .NET

net class library
.NET Class Library
  • In traditional environments different categories of services are provided to the programmer via libraries such as: C run time library, Win32 APIs, I/O and database access libraries, etc.
  • These libraries are language dependent, operating system dependent, and often contain simple subroutine calls as opposed to self describing types.
  • In .NET all services fall into a single, hierarchy organized, language independent class library

CSc 630: Microsoft .NET

the collector in action

Generation 1

Generation 0

The Collector In Action
  • New heap begins with new generation
  • Accessible references keep objects alive
  • Preserves / Compacts referenced objects
  • Objects left merge with older generation
  • New allocations rebuild new generation

CSc 630: Microsoft .NET

.NET-25

CSc 630: Microsoft .NET

garbage collection
Garbage Collection
  • The CLR includes garbage collection.
  • Managed heap always points to the next available spot, so allocation speed is closer to stack allocation.
  • Memory is allocated successively, resulting in fewer page faults and improved cache use.
  • System.GC gives access to the GC:

GC::Collect(int generation) etc.

CSc 630: Microsoft .NET

outline27
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

visual studio net
Visual Studio .NET
  • Supports multi-language
  • Designs applications more quickly
  • Builds solutions with rule-enforcement templates
  • Tests applications for stability

CSc 630: Microsoft .NET

vs net core languages
VS.NET Core Languages
  • Visual Basic
    • Substantial language innovation
    • First class .NET language
    • Leverage existing skills
  • C#
    • More productive C/C++ language for .NET
    • Full RAD support
  • Visual C++
    • Still most powerful and flexible language
    • Enables incremental migration to .NET

CSc 630: Microsoft .NET

other languages
Perl

Python

COBOL

Eiffel

Haskell

ML

JScript

Ada

APL

C

Other Languages. . .
  • Pascal
  • C++
  • Visual Basic
  • C#
  • SmallTalk
  • Oberon
  • Scheme
  • Mercury
  • Objective Caml
  • Oz

CSc 630: Microsoft .NET

slide31
C#
  • Modern object oriented, type-safe, garbage collected
  • Familiar to C/C++ programmers.
  • Integrated COM, Platform API, and XML support
  • No class libraries, uses only common .NET libraries
  • Implementation of a new language with full support for the .NET framework.

CSc 630: Microsoft .NET

slide32
C#

C#

Java

Class structure

Single inheritance

Interfaces

Garbage Collection

Code safety

Reflection

JavaDoc

Convenience &

Additional

Features

Properties

Indexes

Attributes

Delegates

C++

Feature richness,

Direct access to memory

Legacy keywords

CSc 630: Microsoft .NET

slide33

Public interface Icalc {

int add(int x, int y);

int subtract(int x, int y);

}

Public class Calculator : Icalc {

int add(int x, int y) {

return x + y;

}

int subtract(int x, int y) {

return x-y;

}

}

Interface and Class in C#

CSc 630: Microsoft .NET

slide34

Public Interface Icalc

Function Add(X As Integer, Y as Integer)

Function Subtract(X As Integer, Y as Integer)

EndInterface

Public Class Calculator

Implements ICalc

Function Add(X as Integer, Y as Integer)

Implements Icalc.Add

Add = x + y

End Function

Function Subtract(X as Integer, Y as Integer)

Implements Icalc.Subtract

Subtract = x – y

End Function

End Class

Interface and Class in VB.NET

CSc 630: Microsoft .NET

slide35
C++
  • Managed C++ can be used to write .NET Framework applications
  • It relies on extensions to the standard language
  • C++ will be important for non-Framework-based applications
  • The core semantics of C++ does not match with CLR

CSc 630: Microsoft .NET

slide36

Cross-Language Interoperability

‘This is a VB.NET code

Namespace MyCSClass

Public Class CSClass

Public Sub CSClass()

'code

End Sub

‘returns the length of the passed string

Public MyMethod(str As String) As Integer

MyMethod = str.Length;

End Sub

‘returns n squared

Virtual Public MyVirtualMethod(n As Integer) As Integer

MyVirtualMethod = n*n;

End Sub

End Class

CSc 630: Microsoft .NET

slide37

#using "MyCSClass.dll"

usingnamespace MyCSClass;

CSClass *cs = new CSClass();

// will return 11

int result;

result = cs->MyMethod("Hello World");

// will return 2 squared

result = cs->MyVirtualMethod(2);

Cross-Language Interoperability

Can use components written in different languages

How ?

CSc 630: Microsoft .NET

slide38

Cross-Language Inheritance

  • Derive a new class in language C from MyClassclass NewClass : public MyCSClass::CSClass
  • Override virtual method. . .
  • virtual int MyVirtualMethod( int param )
  • And access your new class normally. . .
  • NewClass *newCls = new NewClass();result = newCls->MyVirtualMethod(param);
  • All this without the source code to the previous
  • component or knowledge of it s language.

class CPPClass : public MyCSClass::CSClass {

public: // returns the cube of the given number

virtualint MyVirtualMethod(int n) {

return n*n*n;

}

};

CSc 630: Microsoft .NET

cross language features
Cross-Language Features

Support across components and languages:

  • Inheritance
  • Exception handling
  • Debugging
  • Good for extending 3rd party components in the language of your choice.

CSc 630: Microsoft .NET

visual basic form as a class
Visual Basic Form as a Class
  • All .NET languages use the same tools (WinForms) to create the user interface of an application as a form
  • A form a class containing other classes (called controls) such as TextBox, ListBox or Button
  • The act of drawing a form (such as Form1) generates the VB.NET code that defines the corresponding class named Form1
  • As a class, Form1 has methods, properties, and events.
    • Form1.Show is a method that displays the Form1 on the screen.
    • Form1.EmpName.Text references the contents of the TextBox EmpName in Form1.
    • EmpName_Change is the name of the event handler that is invoked when the user changes contents of EmpName TextBox.

CSc 630: Microsoft .NET

server side controls
Server-Side Controls
  • ASP and JSP provide a language to generate HTML markups. In ASP.NET the complexity of this language is significantly reduced by using server-side controls.
  • For each HTML control there exists a server-side control in ASP.NET.

CSc 630: Microsoft .NET

slide42

<script runat="server" language="vb">

Public Sub doClick(sender as object, e as EventArgs)

TheLabel.Text = "Hello, world! (from ASP.NET in VB NET,code inline)"

End Sub

</script>

<html>

<head><title>In-line ASPX

file in VB .NET

</title></head>

<body>

VB .NET ASP.NET application

with inline code<P><P>

<form runat="server">

<asp:button runat="server"

text="Say Hello"

onclick="doClick" />

<p>

<asp:label runat="server"

text="" id="TheLabel" />

</form>

</body>

</html>

VB.NET ASP.NET APPLICATION

CSc 630: Microsoft .NET

slide43

<script runat="server" language="C#">

void doClick(object sender, EventArgs e) {

TheLabel.Text = "Hello, world! (from ASP.NET in C#, code inline)";

}

</script>

<html>

<head><title>In-line ASPX

file in C#</title></head>

<body>

C# ASP.NET application

with inline code<P><P>

<form runat="server">

<asp:button runat="server"

text="Say Hello"

onclick="doClick" />

<p>

<asp:label runat="server"

text="" id="TheLabel" />

</form>

</body>

</html>

C# ASP.NET APPLICATION

CSc 630: Microsoft .NET

why another data access api
Why another Data Access API?
  • Most new applications are
    • Loosely coupled - even disconnected
    • More and more use XML to encode data
  • This is very different from the classical connected, tightly coupled client/server model

CSc 630: Microsoft .NET

ado net xml integration

Mapping

ADO.NET & XML Integration

Visual Studio.NETDesigners & Controls

XSLT, XpathValidation

XMLDataDocument

DataSet

ManagedProvider

XMLReader

XMLTextReader

XMLNodeReader

XMLDocument

XML Stream

SQL Server

CSc 630: Microsoft .NET

net and dom
.NET and DOM

XmlDocument doc = newXmlDocument();

doc.Load( "test.xml" );

XmlNode root = doc.DocumentElement;

foreach( XmlNode personElement in root.ChildNodes )

Console.WriteLine( personElement.FirstChild.Value.ToString() );

Fred

Bill

<PEOPLE> <PERSON>Fred</PERSON> <PERSON>Bill</PERSON> </PEOPLE>

CSc 630: Microsoft .NET

net and xpath
.NET and XPath

// This is C# code

XPathDocument xpdoc = new XPathDocument("test.xml");

XPathNavigator nav = xpdoc.CreateNavigator();

XPathExpression expr = nav.Compile("descendant::PEOPLE/PERSON");

XPathNodeIterator iterator = nav.Select(expr);

while (iterator.MoveNext())

Console.WriteLine(iterator.Current);

CSc 630: Microsoft .NET

outline48
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

slide49

Users store, access and share based information anytime, any place, from any device

XML

Web Service

Message

Developers create and deliver compelling solutions to huge customer base

Operators run efficient, secure, and reliable data centers for their user base

What is .NET Web Services ?

Internet

CSc 630: Microsoft .NET

slide50

.NET Web Services

<%@ WebService Language="C#" Class="Hello" %>

/* Hello.asmx */

using System.Web.Services;

public class Hello: WebService {

[ WebMethod ]

public string IssueGreeting() {

return "Hello, World!";

}

}

CSc 630: Microsoft .NET

slide51

.NET Web Services

<%@ WebService Language="C#" Class="Hello" %>

/* Hello.asmx */

using System.Web.Services;

public class Hello: WebService {

[ WebMethod ]

public string IssueGreeting() {

return "Hello, World!";

}

}

CSc 630: Microsoft .NET

slide52

.NET Web Services

<%@ WebService Language="C#" Class="Hello" %>

/* Hello.asmx */

using System.Web.Services;

public class Hello: WebService {

[ WebMethod ]

public string IssueGreeting() {

return "Hello, World!";

}

}

CSc 630: Microsoft .NET

user centric web services

.NETCalendar

.NETPresence

.NETDocuments

.NET

Application Settings

.NETLocation

.NET

Favorite Web Sites

.NETContacts

.NETDevices

.NETWallet

.NETAlerts

.NETLists

.NETCategories

.NETInbox

.NETProfile

.NETServices

User-Centric Web Services

CSc 630: Microsoft .NET

before net my services

Sync

Replication

Web App

Local Store

Local Store

Local Store

Local Store

  • Multiple disconnected local stores
  • Sharing information between applications and devices is difficult
  • Sharing with others impossible
  • You have to remember to synchronize

manual data entry into smaller devices

Before .NET My Services

CSc 630: Microsoft .NET

after net my services

Shared Store

  • Single shared store
  • Sharing is easy and natural
  • Sharing with others is second nature
  • Information is always correct, accurate, live

Web App

After .NET My Services

CSc 630: Microsoft .NET

slide56

.NETCalendar

.NETCalendar

.NETCalendar

.NETAlerts

Individuals

Groups

Organizations

.NETContacts

.NETContacts

.NETContacts

.NETInbox

Not Just Users

CSc 630: Microsoft .NET

using the myservices together
Using the MyServices Together

Travel Agent Example

A simple way for customer to be identified at the site

Passport Authentication, myProfile, other my* services

Easy for customer to pay

myWallet

myCalendar of customer

myCalendar of hotel vacancies

Match customer’s vacation dates with available hotels

Tickets purchased become available at a lower price, or flights delayed/canceled

myNotifications (any device)

myContacts, myInbox,

myCalendar

Coordinate with customer’s friends or family

Advise customers about local events and offers

myLocation

CSc 630: Microsoft .NET

outline58
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

slide59

.NET Architecture

CSc 630: Microsoft .NET

slide60

J2EE Architecture

CSc 630: Microsoft .NET

clr versus jvm
CLR versus JVM

J#

C#

VB

.NET

Managed

C++

Java

MSIL

Byte Codes

CLR

CTS GC Security

Runtime Services

JVM

GC Security

Runtime Services

Windows OS

Mac

Win

Unix

Linux

Both are middle layers between an intermediate

language and the underlying OS

CSc 630: Microsoft .NET

clr versus jvm62
CLR versus JVM
  • CLR  language independence
    • Multiple languages for development
    • Underlying OS: Windows (?)
  • JVM  platform independence
    • Single language: Java (?)
    • A separate JVM for each OS & device

CSc 630: Microsoft .NET

jump to net
JUMP to .NET
  • JUMP: Java User Migration Path
  • Consists of 2 important tools:
    • A Java-to-C# tool to convert Java source code into C# codes. Migration of syntax & library calls. Unconvertable Java codes will be tagged for manual conversion.
    • Visual J# .NET

CSc 630: Microsoft .NET

j net
J#.NET
  • J# is not Java (.java)
  • It is Java Language Syntax (.jsl)
  • J# compiler: J# -> MSIL
  • jbimp.exe: Java bytecode -> MSIL
  • Does not support the generation of .class bytecode files (Sun technologies)
  • Implementation of an old language so that legacy applications can run with access to the .NET framework.

CSc 630: Microsoft .NET

j net65
J# .NET
  • Can make use of .NET modules written in other languages in your J# module
  • Can integrate new .NET functionality such as ADO .NET, web services, Windows forms, ASP .NET into your J# module
  • Can consume .NET framework libraries in J#
  • Applications written using J# can only run on .NET framework, not on a JVM
  • J# does not compile .java files to .class files
  • J# includes Jbimp tool which can convert .class files to IL assemblies

CSc 630: Microsoft .NET

slide66

.NET vs J2EE

  • .NET Pet Shop, Sun's best-practice application, has same functionality as the J2EE version, but
  • uses one-thirdthe code of the J2EE version.
  • performance exceeds that of the J2EE version by 28 times

CSc 630: Microsoft .NET

outline67
Outline

Microsoft Vision

  • .NET Design Goals
  • .NET Framework
  • Visual Studio.NET
  • Web Services
  • .NET vs J2EE
  • Conclusion

CSc 630: Microsoft .NET

conclusion
Conclusion
  • .NET makes it easier to design a good solution
    • Object Oriented
    • Native Support for Many Design Goals
    • Native Support for Web Services
  • Visual Studio makes it easier to implement a good solution
    • Multi-Project Solutions
    • Multi-Language Solutions
    • Excellent Debugging
    • Productivity Enhancements

CSc 630: Microsoft .NET

microsoft net69
Microsoft .NET

Questions ?

CSc 630: Microsoft .NET