visual basic.net a look into the.net programming model bryan jenks integrated ideas ©2005

48
Visual Basic .NET A look into the .NET Programming Model Bryan Jenks Integrated Ideas ©2005

Upload: ami-floyd

Post on 17-Dec-2015

213 views

Category:

Documents


1 download

TRANSCRIPT

Visual Basic .NETVisual Basic .NETA look into the .NET Programming ModelA look into the .NET Programming Model

Bryan Jenks

Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETProgramming Language

HierarchyThe .NET Infrastructure.NET Project TypesDesigning for .NETApplication Design Issues

Planning and Designing for .NETProgramming Language

HierarchyThe .NET Infrastructure.NET Project TypesDesigning for .NETApplication Design Issues

Bryan Jenks - Integrated Ideas ©2005

Language HierarchyLanguage Hierarchy

Machine Code

Assembly

Compiler

Runtime Engine (JIT)

Intermediate Language

Un-managed Code

Managed Code

Compiler

Bryan Jenks - Integrated Ideas ©2005

.NET Infrastructure.NET Infrastructure

.NET Framework

CLR

Portable Executable

VB C# VJ#

Application Manifest MSIL

Bryan Jenks - Integrated Ideas ©2005

ASP.NET ArchitectureASP.NET Architecture

CLR

DATABASEASP.NET

IIS

.NET Framework

HTTP Request In HTTP Response Out

ASP HTML

Bryan Jenks - Integrated Ideas ©2005

.NET Projects.NET Projects

Windows ApplicationWeb ApplicationClass LibraryWindows ServiceWeb ServiceControl LibrariesSetup and Deployment

Windows ApplicationWeb ApplicationClass LibraryWindows ServiceWeb ServiceControl LibrariesSetup and Deployment

Bryan Jenks - Integrated Ideas ©2005

Designing for .NETDesigning for .NET

Standalone ArchitectureSingle PE

Three-Tier ArchitecturePresentation TierBusiness Logic TierData Tier

N-Tier ArchitectureWeb servicesMobile Applications

Standalone ArchitectureSingle PE

Three-Tier ArchitecturePresentation TierBusiness Logic TierData Tier

N-Tier ArchitectureWeb servicesMobile Applications

Bryan Jenks - Integrated Ideas ©2005

Design IssuesDesign Issues

Code ReuseScalabilityMaintainabilityPerformanceSecurityDurability Integration and Interoperability

Code ReuseScalabilityMaintainabilityPerformanceSecurityDurability Integration and Interoperability

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Object Oriented Programming ConceptsObject Oriented ProgrammingObjects vs. StructuresMethods, Events, and PropertiesOverloadingInterfaces and Inheritance

Object Oriented Programming ConceptsObject Oriented ProgrammingObjects vs. StructuresMethods, Events, and PropertiesOverloadingInterfaces and Inheritance

Bryan Jenks - Integrated Ideas ©2005

Object Oriented Programming

Object Oriented Programming

ObjectsAbstractionEncapsulationPolymorphismInheritance

ObjectsAbstractionEncapsulationPolymorphismInheritance

Bryan Jenks - Integrated Ideas ©2005

Object ComponentsObject Components

The ObjectData

MembersProperties

BehaviorMethodsEvents

The ObjectData

MembersProperties

BehaviorMethodsEvents

Bryan Jenks - Integrated Ideas ©2005

Objects vs. StructuresObjects vs. Structures

Objects Members Properties Events Methods Instantiation Interfaces Inheritance

Objects Members Properties Events Methods Instantiation Interfaces Inheritance

Structures Members Properties Methods

Structures Members Properties Methods

Bryan Jenks - Integrated Ideas ©2005

Objects vs. StructuresObjects vs. Structures

Public Structure Person Public Appendages As Integer Public Male As Boolean Public EyeColor As ColorEnd Structure

Public Class Person Public Appendages As Integer Public Male As Boolean Public EyeColor As ColorEnd Class

Bryan Jenks - Integrated Ideas ©2005

MethodsMethods

Public Class Person Private Sub setBaby() ' Baby is born End Sub

Private Function getBaby() As Person ' Baby is returned Return New Person End FunctionEnd Class

Bryan Jenks - Integrated Ideas ©2005

EventsEvents

Public Class Person Public Event Birth(ByVal Birtday As Date)

Private Sub getBaby() ' Baby is born RaiseEvent Birth(Now) End SubEnd Class

Bryan Jenks - Integrated Ideas ©2005

PropertiesProperties

Public Class Person Private myAppendages As Integer

Public Property Appendages() As Integer Get Return myAppendages End Get Set(ByVal value As Integer) myAppendages = value End Set End PropertyEnd Class

Bryan Jenks - Integrated Ideas ©2005

OverloadingOverloading

Public Class Person Private Sub Feed(Food as Integer) ' Person is fed food End Sub

Private Sub Feed(Crap as Double) ' Person is fed crap End SubEnd Class

Bryan Jenks - Integrated Ideas ©2005

Interfaces and InheritanceInterfaces and Inheritance

InterfacesEnforces DesignEnsures Compatibility

InheritanceProvides CouplingEnables Code Reuse

[demonstration]

InterfacesEnforces DesignEnsures Compatibility

InheritanceProvides CouplingEnables Code Reuse

[demonstration]

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Advanced Programming ConceptsVariables

ScopeArraysCollections

Object Passing and Optional Parameters

Inheritance ControlOverridesShadows

Advanced Programming ConceptsVariables

ScopeArraysCollections

Object Passing and Optional Parameters

Inheritance ControlOverridesShadows

Bryan Jenks - Integrated Ideas ©2005

Variable ScopeVariable Scope

DimProtected (Module Level Access)Private (Base Class Level Access)Public (Project Level)Friend (Assembly Level)

StaticShared

DimProtected (Module Level Access)Private (Base Class Level Access)Public (Project Level)Friend (Assembly Level)

StaticShared

Bryan Jenks - Integrated Ideas ©2005

Arrays and CollectionsArrays and Collections

Array Size Item(Index)

Array Size Item(Index)

Collection Size Item(Index) Item(Key) Add(Item) Remove(Item) Contains(Item)

Collection Size Item(Index) Item(Key) Add(Item) Remove(Item) Contains(Item)

Bryan Jenks - Integrated Ideas ©2005

[Array and collection demonstration]

Object Passing and Parameters

Object Passing and Parameters

Object PassingByRefByVal

Optional ParametersKeyword: Optional= [Default Value]

Object PassingByRefByVal

Optional ParametersKeyword: Optional= [Default Value]

Bryan Jenks - Integrated Ideas ©2005

Inheritance ControlInheritance Control

OverridesReplaces inherited member with

permission

ShadowsMasks inherited member

OverridesReplaces inherited member with

permission

ShadowsMasks inherited member

Bryan Jenks - Integrated Ideas ©2005

[Inheritance Control demonstration]

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

More Advanced Programming ConceptsThreadingDelegatesException Handling

Types of ErrorsUnstructured HandlingStructured HandlingRaising and Throwing Exceptions

More Advanced Programming ConceptsThreadingDelegatesException Handling

Types of ErrorsUnstructured HandlingStructured HandlingRaising and Throwing Exceptions

Bryan Jenks - Integrated Ideas ©2005

ThreadingThreading

Application Threading ConceptsThe application threadSystem.Threading NamespaceThread.Kill, Sleep, SuspendThreading Issues

Dangling ThreadsSynchronizationThread Safety

Application Threading ConceptsThe application threadSystem.Threading NamespaceThread.Kill, Sleep, SuspendThreading Issues

Dangling ThreadsSynchronizationThread Safety

Bryan Jenks - Integrated Ideas ©2005

DelegatesDelegates

Process Flow DelegationThe Delegate KeywordDelegate DeclarationThe AddressOf keywordMulticasting

System.Delegate.Combine

Process Flow DelegationThe Delegate KeywordDelegate DeclarationThe AddressOf keywordMulticasting

System.Delegate.Combine

Bryan Jenks - Integrated Ideas ©2005

Exception HandlingException Handling

Types of ErrorsSyntax ErrorsLogic ErrorsRuntime Errors

Types of ErrorsSyntax ErrorsLogic ErrorsRuntime Errors

Bryan Jenks - Integrated Ideas ©2005

Unstructured Exception Handling

Unstructured Exception Handling

On Error Goto [location] On Error Resume Next

Benefits Easy to read Simple to implementDrawbacks Difficult to troubleshoot Poorly structured

On Error Goto [location] On Error Resume Next

Benefits Easy to read Simple to implementDrawbacks Difficult to troubleshoot Poorly structured

Bryan Jenks - Integrated Ideas ©2005

Structured Exception Handling

Structured Exception Handling

The Err Object Try, End Try Catch Finally

Benefits Structured ReliableDrawbacks Complicated Requires Planning

The Err Object Try, End Try Catch Finally

Benefits Structured ReliableDrawbacks Complicated Requires Planning

Bryan Jenks - Integrated Ideas ©2005

Structured Exception Handling

Structured Exception Handling

Throwing ExceptionsThe Exception ClassThrow [Exception]

Raising ErrorsThe error handling heirarchyErr.Raise

Throwing ExceptionsThe Exception ClassThrow [Exception]

Raising ErrorsThe error handling heirarchyErr.Raise

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Data Access Using ADO.NETDatabase ConceptsData ConnectionsData AdaptorsDatasetsData Readers

Data Access Using ADO.NETDatabase ConceptsData ConnectionsData AdaptorsDatasetsData Readers

Bryan Jenks - Integrated Ideas ©2005

Database ConceptsDatabase Concepts

Flat DatabasesText FilesDBF, DB4, DB5COBOLRelational DatabasesMS AccessSQL ServerOracle

Flat DatabasesText FilesDBF, DB4, DB5COBOLRelational DatabasesMS AccessSQL ServerOracle

Bryan Jenks - Integrated Ideas ©2005

Database ConceptsDatabase Concepts

Database ComponentsTablesRelationsConstraintsUsersStored ProceduresUser Defined TypesCatalogs

Database ComponentsTablesRelationsConstraintsUsersStored ProceduresUser Defined TypesCatalogs

Bryan Jenks - Integrated Ideas ©2005

Data Access ComponentsData Access Components

Data AdaptorsData ConnectionsDatasetsData Readers

Data AdaptorsData ConnectionsDatasetsData Readers

Bryan Jenks - Integrated Ideas ©2005

Data ConnectionsData Connections

Data Connection FeatuesSoftware Channel to DatabasePropagates Authentication Criteria Isolates Data FlowData Connection TypesOleDbODBCSQLClient

Data Connection FeatuesSoftware Channel to DatabasePropagates Authentication Criteria Isolates Data FlowData Connection TypesOleDbODBCSQLClient

Bryan Jenks - Integrated Ideas ©2005

Data AdaptorsData Adaptors

Functions of the Data AdaptorUnderstanding the DatabaseMaintaining Query ObjectsMaintaining Query ParametersRetrieving and Updating Data

Functions of the Data AdaptorUnderstanding the DatabaseMaintaining Query ObjectsMaintaining Query ParametersRetrieving and Updating Data

Bryan Jenks - Integrated Ideas ©2005

DatasetsDatasets

Dataset ComponentsDataTables

DataColumnsDataRows

RelationsConstraintsXML Interpolation

Dataset ComponentsDataTables

DataColumnsDataRows

RelationsConstraintsXML Interpolation

Bryan Jenks - Integrated Ideas ©2005

DataReadersDataReaders

DataReader FeaturesOperates in Connected

ArchitectureLive Data StreamLow memory overhead

DataReader FeaturesOperates in Connected

ArchitectureLive Data StreamLow memory overhead

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Testing and Debugging in .NETBreakpointsStepping Through Code

Step IntoStep OverStep Out

Debugging WindowsLocals, Autos, and WatchCall Stack and ThreadsImmediate/Command

Testing and Debugging in .NETBreakpointsStepping Through Code

Step IntoStep OverStep Out

Debugging WindowsLocals, Autos, and WatchCall Stack and ThreadsImmediate/Command

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Planning and Designing for .NETObject Oriented Programming

ConceptsAdvanced Programming ConceptsMore Advanced Programming

ConceptsData Access Using ADO.NETTesting and Debugging in .NETThe .NET Framework

Bryan Jenks - Integrated Ideas ©2005

VB.NET Programming and the .NET Architecture

VB.NET Programming and the .NET Architecture

The .NET FrameworkMicrosoftSystem

IOTextWindowsCollectionsNetSecurityThreadingDataWeb

The .NET FrameworkMicrosoftSystem

IOTextWindowsCollectionsNetSecurityThreadingDataWeb

Bryan Jenks - Integrated Ideas ©2005

ReferencesReferences

Designing VISUAL BASIC .NET ApplicationsDavid Vitter – CORIOLIS

MSDN Onlinehttp://msdn.microsoft.com

Wikipedia - Object-oriented programminghttp://en.wikipedia.org/wiki/Object-oriented_programming

Designing VISUAL BASIC .NET ApplicationsDavid Vitter – CORIOLIS

MSDN Onlinehttp://msdn.microsoft.com

Wikipedia - Object-oriented programminghttp://en.wikipedia.org/wiki/Object-oriented_programming