building on the.net framework visual basic learning user group may 17, 2004 creating professional...
TRANSCRIPT
Building on the .Net Framework
Visual Basic Learning User Group
May 17, 2004
Creating Professional WinFormsApplications
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Agenda
Where we start Where we’re going How we’re going to get there Code examples throughout Reuse – The Results
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Novick Software
The consulting company of Andrew Novick Business Applications
Design – Programming - Project ManagementCoaching - Training
SQL Server, VB, C#, VB.Net, ASP.Net, XML http://www.NovickSoftware.com
Home of the
Transact-SQL User-Defined Function of the Week
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Where We’re Starting
Windows Relational Database .Net Framework
4000 Classes Windows Forms 30 + Controls Several Programming Languages
C#, VB.Net, Jscript, J#, COBOL, APL
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Start
Building on the .Net Framework
Destination
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
The Destination
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Typical n-Tier Architecture
ApplicationBusinessObjects
DataAccess
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
What makes an Application Great? Robust User Friendly Supportable Maintainable Attractive/Modern Scalable Secure
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Additional Process Objective
Programmer Productivity Programmer Productivity Programmer Productivity Flexibility – Easily enhanced
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
3 Aspects Built on .Net
Business Objects Manage Data
Robustness Insure the application delivers it’s promises
Presentation Make it look good and up-to-date.
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Bus
ines
s O
bjec
ts
Robustness
Trac
ing
Con
figur
atio
n
Messages
Presentation
Applic
ation
Life
time E
ase of Use
Appearance
DestinationStart
How are we going bridge the gap?
Dep
loym
ent R
eport Display
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Extended Framework Architecture
Application
Business ObjectsData
AccessConfiguration
Tracing/Support
Lifetime Mgmt
Appearance Mgmt
Deployment
Security
Etc……Etc……
Etc……Etc……
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Application 3
Component RelationshipsApplication 2
Application 1
Business Objects
Framework
Framework Biz Obj
CSLAApplication Blocks Free
GeneratedWrittenOnce
Written
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Business Objects/Data
Data DB Connection Management Object/Relational Mapping Business Rules SQL Server Replication
Reporting Report Distribution Security/Authorization Database Connectivity
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Business Objects - Options
Data Centric Solutions DataSets - Typed DataSets Deklarit/Component One/Other products
Object Oriented UML Object/Relational Mapping Tools Hand crafted business objects
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Business Objects - Choice
CSLA Visual Basic .Net Business Objects
By Rockford Lhokta (Software Legend) ComExpress
Generates CSLA Objects Will generate a simple user interface
SQL Server Replication
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Why CSLA?
UI application gets simplified data access. myGrid.DataSource = myOjbect.LoadList (key)
Scalable to multiple physical tiers Works fine in 2-tier (Client/Server) Scales to 3-tiers without changes to the
application Supports multilevel Undo
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Reporting – Options
Crystal SQL Server Reporting Brio, ActiveReports, etc…. Roll your own
Could use Business Objects
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Reporting – Choice
Crystal Comes in the box Has a standalone version Has a web based distribution product. Covers most of the bases
But It Doesn’t … Have a good development environment Use business objects.
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Reporting – Code to support Crystal Dynamic database connection Menu Creation
Category Menus Report Items Supports Security
Parameter Gathering
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Replication
Create Subscription Update Subscription Check status and clean up.
Requires Interop to: SQL-DMO SQL Server ActiveX objects for replication
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Database Security
Requirements Easy administration Users can not use the database outside of the application.
Solution Database access based on a Windows Group
(Also known as Integrated Security) The group has no access to database objects SQL Server Application Role has all access rights SQL account needed for Crystal Reports
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Database Concurrency - Choices Pessimistic Locking Optimistic Locking Check-in/Check-out
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Database Concurrency – Choice Check-in/Check-out (Timestamp) Automated by the application Reservations Expire SysAdmin Override Form Batch Program Can SideStep
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Presentation - Options
Stick with standard WinForms controls Enhance the standard controls Purchase one or more enhanced controls
Component One Sharp (DataDynamics) Janus Infragisitcs Many others
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Standard WinForms Controls
30 or so controls Plain – mid 90’s look
Can be enhanced
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Presentation - Choice
Infragistics NetAdvantage Suite Covers all the bases Gradients on all controls Borders on all controls Consistent Appearance management
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Robustness (1/3)
Deployment Initial MSI (.Net Framework, Crystal, Ctlrs) No-Touch Deployment Updater Application Block
Handle Application Lifetime Correct number of instances Command line parsing Global Exception Handling
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Robustness (2/3)
Supportability Event/Exception reporting/Help Desk notification.
Tracing Manage Trace Log locations Enhance Trace Contents
Configuration Before Application Startup System Wide Individual
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Robustness (3/3)
Interface Management Application code shouldn’t directly access:
Win 32 API Office Com Objects Some parts of the .Net Framework
Security Who can do what when Auditing/recording of user actions
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Robustness - Options
Roll-your-own Emerging Open Source Frameworks
Gengis Commercial Products
None available yet?
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Robustness - Choice
Roll-your-own Built on a huge amount of example code
Google MSDN GotDotNet.com CodeProject.com WinForms.Net
Buy components where they’re available
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Deployment - Requirements
Install COM components Install Components into the GAC Create Event Logs Allow for offline work Update automatically, even when the
application is in use. Force update when on-line
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Deployment - Choices
XCOPY MSI No-Touch Deployment No-Touch with NetRun Updater Application Block (UAB)
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Deployment Dimensions
Dimension Consideration Preference
1st Install How is the 1st install done on each client? Automatic
Updates How are updates applied? Automatic
Offline Does it support offline work? Yes
Security What are the security requirements? Full Trust
App.Config Can you use an App.Config file? Yes
COM Can COM objects be installed and used? Yes
GAC Can components be installed in the GAC Yes
Other Files Can other files be deployed? Yes
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Deployment - Analysis
Type1st
Install UpdatesOff-line Security
App. Config COM GAC
Other Files
XCOPY Manual Manual Yes Full Trust Yes No No Any
MSI Manual Manual Yes Full Trust Yes Yes Yes Any
No-Touch
Auto Auto No Sandbox No No No No
No-Touch
NetRunAuto Auto No Full Trust Yes No No No
UABManual
MSIAuto Yes Full Trust Yes No No Any
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Deployment - Choice
Initial MSI COM install Crystal component install Installer project to create event log Merge Module for Infragistics
Updater Application Block Downloads and applies updates when they become
available (5 min lag) The implementation can force a the user to wait for a
download during application startup.
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Application Lifetime
How many instances are allowed at once? One One with many main windows Many
Did the application crash the last time? Crete an Exceptional Event Notification
Is Windows Shutting Down?
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Configuration - Types System information need by .Net
Trace Flags Error handling
Application information Application wide
Before a database is available After a database is available
Per User information Before a database is available After a database is available
Overrides for Support
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Configuration – Options
App.Config …. exename.exe.config Database Registry Settings files
XML INI
Isolated Storage
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Configuration – Choice
App.Config Needed by .Net (trace flags, UAB, etc.) Before there is a database connection. Distributed with the software. Overrides database setting for support
Database – Uniform across the application Isolated Storage
Per Application / Per User Can be written to under CAS
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Tracing/Exceptional Events
Used during both development and production
Trace object supplied by .Net Add a trace listener
Exceptional Events Event log Send e-mail to the help desk
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Interface Management
Eliminate Win32 API calls in applications Minimize COM Interop in applications
Implement a series of helper classes WordManager, WordDoc SQLReplication, SQLServerManagement
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Security
Privileges – permission to do something Groups – collections of IDs
MayI
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Security – Schema
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Additional Tools (Free)
Documentation VBCommentor PowerToy from GotDotNet NDoc from SourceForge
Development RegEx Tester Format Tester
Testing N-Unit Fx-Cop
CodeSmith Generation of strongly typed collections
Software Reuse
Don’t Start from Scratch
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Application 3
Component RelationshipsApplication 2
Application 1
Business Objects
Framework
Framework Biz Obj
CSLAApplication Blocks Free
GeneratedWrittenOnce
Written
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Reuse Quantified
Component K LoC %
Application 1 8 12Business Objects 18 28
Framework 15 24
Framework Biz Obj 9 14
CSLA 7 11
Application Blocks 7 11
Totals 64 100
.Net Framework
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Where Did the Code Come From
22%
42%
24%
12%
Available For Free
Generated
Written Once
Application Code
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Resources
www.windowsforms.net www.codeproject.com www.gotdotnet.com MSDN Windows Forms Programming in
Visual Basic .Net by Chris Sells & Justin Gehtland
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Transact-SQL User-Defined Functions
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
New England Visual Basic ProfessionalUser Group 1st Thursday of each month
Microsoft’s Waltham office Focus on VB.Net Speakers
Local Professionals INETA Microsoft
www.NEVB.com [email protected]
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
www.NovickSoftware.com
www.NovickSoftware.com© Copyright 2004 Andrew Novick
Building on the .Net Framework
Andrew NovickVB Learning UG
May 17, 2004
Thanks for Coming
Please send feedback to:[email protected]
www.NovickSoftware.com