From DNA to .NET Design Path - Alexander

Download Report

Transcript From DNA to .NET Design Path - Alexander

From DNA to .NET
Design Path
Objectives
 Sketch
up a typical Win DNA Application
 Sketch
up the .NET version
 Compare
Design and Implementation
 Advantages
 Migration
 Design
of .NET
from WinDNA to .NET
Guidelines to

Build Windows DNA applications ready for .NET

Have a smooth migration
 Definition
of a Migration Strategy
Contents
 Section
1: Windows DNA Reference Application
 Section
2: Microsoft .NET Reference Application
 Section
3: WinDNA vs. .NET Design
 Section
4: Migrating WinDNA to .NET
 Section
5: WinDNA Design Guidelines
 Section
6: Migration Guidelines
 Summary
 Questions
Section 1: Windows DNA Reference App
 WinDNA

DNA Web Application


User Interaction
DNA Service Application


Sample Application
Background Database Updates
DNA Web Service

Offer 3rd Party Data
WinDNA Web Application Design
Presentation Layer
Business Logic
Data Layer
IIS 5.0
COM+
SQL Server
(D)COM / XML
Transporter
Stored Procedures
HTML
ASP
Business Rules
Tables
Data Abstraction
ADO
WinDNA Service Application & Web
Service Design
Win32 Application
ADO
SOAP
Web Service
Stored Procedures
Tables
ASP Listener
(D)COM / XML
Service Implementation
SQL Server
COM+
Section 2: Microsoft .NET Reference App
 Design
of the .NET Web Application
 Design
of the .NET Service Application
 Design
of the .NET Web Service
.NET Web Application Design
Presentation Layer
Business Logic
Data Layer
IIS 5.0
.NET Components
SQL Server
DataSet
HTML
Transporter
Stored Procedures
ASP.NET
Web Forms
Business Rules
Tables
Data Abstraction
ADO.NET
.NET Service Application & Web Service
Design
.NET Application
ADO.NET
SOAP
Web Service
Stored Procedures
Tables
SQL Server
ASP.NET
Section 3: WinDNA vs. .NET Design
 Compare
Web Applications

Differences

Advantages of .NET
 Compare
Service Applications

Differences

Advantages of .NET
 Compare
Web Services

Differences

Advantages of .NET
Web Application Design Differences
 Similarities

Three tiers

Business layer divided into three parts

HTML User Input

Database access via Stored Procedures
 ASP
 No
has become ASP.NET
more (D)COM components
 DataSets
 ADO
instead of XML Documents
is replaced by ADO.NET
Advantages of .NET 1/4
 ASP.NET

Separation of Layout and Code

Object-oriented Programming Model

Entire .NET Framework platform available

Advanced Session State Management

Compiled Code, improved Performance

Rich debug and trace Facilities

Author in any .NET compatible Language
Advantages of .NET 2/4
 No
more (D)COM Components

No more Registry Entries

No more HRESULTS, GUIDS, IUnknown,...

No more Conversation to Types recognized by COM

The End of DLL Hell
 DataSets

instead of XML Documents
No more Conversion inside the Application
Advantages of .NET 3/4
 ADO.NET


Interoperability through use of XML

Open standard

Human readable and decipherable text
Performance Advantages relative to ADO COM
marshalling

Data passed as Text (XML)

No Conversation to Types recognized by COM
Advantages of .NET 4/4
 Summary

Improved Time-To-Market

Improved Productivity

Improved Quality

Improved Scalability

Improved Performance

Improved Maintenance
Service Application Design Differences
 Similarities

Database access via Stored Procedures

Web Service access via SOAP
 .NET Application
 ADO
is replaced by ADO.NET
Advantages of .NET 1/2
 .NET Application

.NET Framework

New Design Features (Sizing)

Freedom of Language Choice

Ease of using ADO.NET

Ease of consuming Web Services
 ADO.NET

Interoperability through use of XML

Performance advantages relative to ADO COM marshalling
Advantages of .NET 2/2
 Summary

Improved Time-To-Market

Improved Productivity

Improved Maintenance
Web Service Design Differences
 ASP
 No
has become ASP.NET
(D)COM Component
Advantages of .NET 1/3
 ASP.NET

Object-oriented Programming Model

Entire .NET Framework platform available

Web Service natively supported

Compiled Code, improved Performance

Rich debug Facilities

Author in any .NET compatible Language
Advantages of .NET 2/3
 No
(D)COM Component

No more Registry Entries

No more HRESULTS, GUIDS, IUnknown,...

No more Conversation to Types recognized by COM

The End of DLL Hell
Advantages of .NET 3/3
 Summary

Improved Time-To-Market

Improved Productivity

Improved Quality

Improved Performance

Improved Maintenance
Section 4: Migrating WinDNA to .NET
 Step
1: ASP to ASP.NET
 Step
2: COM+ to .NET Component
 Step
3: MSXML to .NET XML Classes
 Step
4: ADO to ADO.NET
 possible
further improvements using .NET specifics
Step 1: ASP to ASP.NET
 Separated
into two Parts

Transform .asp into .aspx Files

Extract Code into code-behind Classes
Transform .asp into .aspx Files 1/2
 Automatically
done

Migration of Visual InterDev Projects to VS.NET

Page Directives inserted
 To
do manually

Set Language and SessionState Directive

Move Code into correct Tags

Create PageLoad Event Handling

Watch out for Syntax Changes
Transform .asp into .aspx Files 2/2
 Strong
recommendations

Leverage exception handling

Leverage tracing features
 Benefits

Compiled ASP‘s

Ready for Debugging

Updates made easy
Move Code into code-behind Classes 1/2
 No
Wizard Support
 To
do manually

Check for Code includes

Create Helper and / or Base Classes

Add strong Data and Function Types

Decide Accessibility of Class Members
Move Code into code-behind Classes 2/2
 Benefits

Clean Code

Easy to extend

Easy to maintain

Less error prone

Reusable Classes

...
Step 2: COM+ to .NET Components 1/3
 Automatically
done

Wizard convert Projects and Classes

Wizard corrects Code to comply with Visual Basic.NET
Syntax

Migration Report
 To
do manually (Logic Layer)

Inherit from System.ServicedComponent

Object Instantiation

Interface Implementation

Cast of Value Type and String Return Values

Global Modules

Transaction Handling
Step 2: COM+ to .NET Components 2/3
 To
do manually (Presentation Layer)

Add Reference to Project

Add Import Statement

Change Object Instantiation

Mark Parameters passed by Reference
 Strong
recommendations

Rename components

Apply naming conventions

Provide registration support page
Step 2: COM+ to .NET Components 3/3
 Benefits

No more Registry Entries

No more Conversation to Types recognized by COM

The End of DLL Hell

no DLL Locks, better turn-around-handling

easy Updates, easy deployment
Step 3: MSXML to .NET XML Classes
 No
Wizard Support
 To
do manually

Identify the Classes needed

Create Helper to encapsulate commonly used
Functionality

Replace the Code
 Benefits

Improved Performance

Several independent Navigators on one Document

No DLL Hell
Step 4: ADO to ADO.NET
 No
Wizard Support
 To
do manually

Change central Method to execute Stored Procedure

Replace Calls on RecordSets with Calls on DataSets


DataReader is not appropriate here
Remove RecordSet-to-XML Transformation
 Benefits

Database Resources handled by ADO.NET

No more Transformation RecordSet / XML


Application wide use of DataSets
No DLL Hell
Possible further improvements
 Web
Forms

ASP.NET Server Controls

Validation Controls

User Controls

DataBinding

Caching
 Benefits

Same Programming Model as Win Forms

Support of different Client Types

Rapid UI Development
Section 5: WinDNA Design Guidelines 1/2
 Consider
Windows DNA Design Guidelines
 Avoid
Client-side Scripting
 Strict
Separation of Presentation and Logic inside ASP
 As
less Script Code as necessary
 Give
each Peace of Code as single, well-defined
Responsibility
 Put
global Code into Functions / Classes
 Use
XML / XSLT instead of Script Code
 Avoid
Attributes in XML Documents
Section 5: WinDNA Design Guidelines 2/2
 Be
familiar with OOD / OOP Concepts
 Use
all OO abilities of VB6

As much Class Modules as possible

As less Global Modules as needed

Put common Functionality into global Modules

 Get

E.g Access to Stored Procedures
familiar with Visual Basic language changes
Avoid things that don’t match quite well in VB.NET
Section 6: Migration Guidelines
 Do‘s

Check whether to migrate at all

Decide what and when to migrate

Take the Chances

Separate the Migration into small Pieces

Handle PageLoad Event
 Don‘ts

Migrate a whole Application in one single Step

Migrate just for the sake of having migrated
Summary
 Become
familiar with .NET Concepts
 Smooth
Migration needs a prepared WinDNA
Application
 Not
all Migration Work can be done by Wizards
 .NET
offers great Improvements, which makes
Migration worth it

Helps you to do a good Job

Keeps your Customers satisfied

Supports your Business
Questions?
Appendix: Exploring the Sample App
 WinDNA
Stock Application

Build for Educational Purposes

Used over the Internet

Scalable

Throughput

Easy Maintenance
 Step

by Step Migration
Reflects the Steps described