23
Overview of Microsoft.Net and Vb.Net ITSE 2349 Spring 2002 Material from Microsoft.Net an Overview for ACC faculty by Stuart Laughton and Introduction to VB using .Net by Wyatt and Oberg

Overview of Microsoft.Net and Vb.Net

  • Upload
    dillian

  • View
    49

  • Download
    0

Embed Size (px)

DESCRIPTION

Overview of Microsoft.Net and Vb.Net. ITSE 2349 Spring 2002 Material from Microsoft.Net an Overview for ACC faculty by Stuart Laughton and Introduction to VB using .Net by Wyatt and Oberg. What is .NET?. What is .NET? (according to some people) Microsoft’s version of Java - PowerPoint PPT Presentation

Citation preview

Page 1: Overview of Microsoft.Net and Vb.Net

Overview of Microsoft.Net and Vb.Net

ITSE 2349Spring 2002

Material from Microsoft.Net an Overview for ACC faculty by Stuart Laughton and Introduction to VB using .Net by Wyatt and Oberg

Page 2: Overview of Microsoft.Net and Vb.Net

What is .NET?

What is .NET? (according to some people)– Microsoft’s version of Java

What is .NET? (according to Microsoft)– Microsoft’s platform for XML Web services– Web Service = software component for the Web– People use web sites; Programs use Web Services

What is .NET? (for ACC students)– Software skills that are in demand

Page 3: Overview of Microsoft.Net and Vb.Net

Languages and CLR

Compile to intermediate language (MSIL- Microsoft Intermediate Language)

MSIL is JIT (just in time) compiled to native code and run by the Common Language Runtime(CLR)

MSIL is designed to support different languages

Page 4: Overview of Microsoft.Net and Vb.Net

.Net Languages

Microsoft ships several languages:– C# a new Java like language– VB.NET looks like VB– C++ managed extensions– J# Java syntax

3rd party– COBOL, FORTRAN, LISP

Page 5: Overview of Microsoft.Net and Vb.Net

.NET Languages

C# Source

VBSource File

Other .NET Language

MSIL

Machine independent

Native CodeMachine Specific

Compile

JIT Compile

Page 6: Overview of Microsoft.Net and Vb.Net

.NET Framework

C# VB.NET C++ Other

Visual Studio.Net

Common Language Specification

.Net Framework Class Library

Common Language Runtime

Page 7: Overview of Microsoft.Net and Vb.Net

.NET Framework Overview

Common Language Runtime– Provides services to executing programs– Traditionally different environments have different

runtimes. (standard c library, VB runtime)– The CLR manages execution of code and provides useful

services– Services are exposed through the programming

languages– Syntax varies from language to language, but underlying

engine is the same– Not all languages expose all the features of the CLR– C# does the best job, but VB.NET does pretty well

Page 8: Overview of Microsoft.Net and Vb.Net

.NET Framework Overview

.Net Framework Class Library– Huge, more than 2500 classes– All this functionality is built into the .NET

languages– 4 Main Parts

• Base class library (networking, I/O, diagnostics, etc.)• Data and XML classes• Windows UI• Web services and Web UI

Page 9: Overview of Microsoft.Net and Vb.Net

.NET Framework Overview

Common Language Specification– Important goal of .NET is to support multiple

languages.– CLS is an agreement among language designers

and class library designers about what common subset of features can be relied upon

– Example – do not rely on case for uniqueness for names – because some languages are not case sensitive

Page 10: Overview of Microsoft.Net and Vb.Net

.NET Framework Overview

Languages in .Net– Language is basically a lifestyle choice– Same built in data types are used in all the

languages – Classes written in one language can be

used in another language– A class written in one language can inherit

from a class written in another language

Page 11: Overview of Microsoft.Net and Vb.Net

MSIL (Microsoft Intermediate Language)

All VB.Net code is compiled to MSIL– Machine independent– MSIL is JIT compiled to native code then executed

Metadata– Detailed info about each code module

• Version information• All the types• Details of each type• Details about properties and methods of each type

– MSIL and metadata are packaged together– Metadata enables ‘intellisense’ and enables types to be

converted transparently

Page 12: Overview of Microsoft.Net and Vb.Net

Visual Studio.NET

Visual Studio is now one IDE for all the languages

When you start, you pick a profile (example, Visual Basic Developer Profile)

This arranges the windows and sets up the environment so it looks like VB

Most of the VB debugging tools are there (but, not the immediate window)

Page 13: Overview of Microsoft.Net and Vb.Net

Some of the Changes to VB

All VB source files now have extension.vb No variant type Parentheses always required on all subroutine

calls Values returned from functions by using return

keyword

Function CalculatePay(ByVal payRate as Single, hrsWorked as Single) as SingleDim grossPay as SinglegrossPay = hrsWorked * payRateReturn grossPay

End Function

Page 14: Overview of Microsoft.Net and Vb.Net

Some of the Changes to VB

Passing byVal is now the default Lower bound of arrays is always 0 Exception handling

Trycode that might cause error

Catch e as Exceptioncode to handle error

End Try

Page 15: Overview of Microsoft.Net and Vb.Net

Some Changes to OOP in VB.NET Objects and classes are more central to .Net

programming .Net makes vb into a real OO language .Net adds Inheritance to VB Shared Members

– A value or procedure associated with all instances of a class

Set is not needed for instantiation– myAcct = New BankAccount()

Page 16: Overview of Microsoft.Net and Vb.Net

Some Changes to OOP in VB.NET Syntax for Properties is different

Private m_Name as String

Public Property Name() as StringGet

Return m_nameEnd Get

Set(ByVal Value a String)m_name = Value

End SetEnd Property

Page 17: Overview of Microsoft.Net and Vb.Net

Some Changes to OOP in VB.NET Constructors

– Class_Initialize no longer exists– A class constructor called New

Public Sub New()m_acctNo = 0m_name = “”m_balance = 0

End Sub

Page 18: Overview of Microsoft.Net and Vb.Net

Database Access ADO.NET

Why ADO.NET?– Web applications have a more loosely

coupled structure– Many web apps use XML to encode data

that is passed over a network.– After the data has been extracted and

encoded, the connection can be closed– ADO.NET facilitates these kind of

disconnected scenarios

Page 19: Overview of Microsoft.Net and Vb.Net

Database Access ADO.NET

DataSet object– Holds in memory a representation of data that was

retrieved– In XML– Can hold information from multiple tables– Also holds information about relationships and

constraints (an in memory database) Connection object used for connection oriented

applications DataAdapter object used for disconnected

applications

Page 20: Overview of Microsoft.Net and Vb.Net

ADO.NET ArchitectureApplication

DataSet

.NET Data Provider(connection)

Database

XML Data

ConnectedAccess

Disconnected Access

Page 21: Overview of Microsoft.Net and Vb.Net

Disconnected Access

Class ApplicationMSIL

Class DataSetMSIL

DOMData Set

XML

Table 2

Table 1

Internal FormatTable 1

Internal FormatTable 1

Internal FormatTable 3

Page 22: Overview of Microsoft.Net and Vb.Net

Object Model of DataSetDataSet

Relationships Collection

Tables Collection

Relation Table

Constraints Collection

Primary Key

Columns Collection

Rows Collection

Constraint Data Column

Data Row

Page 23: Overview of Microsoft.Net and Vb.Net

Main Challenges for VB Developers Learning how to use the classes in

the .Net Framework Class Library effectively

Learning to use inheritance effectively Visual Studio Changes? Learning the ADO.Net architecture