Designing Enterprise Applications with Microsoft® Visual Basic® .NET

Book description

Learn how to put the power of Visual Basic .NET to work to design and implement enterprise applications!

Most books about Visual Basic .NET focus on the language or the development environment, but few give you insights into critical design decisions. This book provides the detailed guidance you need to make the right choices as you design and build enterprise-level applications with Visual Basic .NET. The author—a former member of the Microsoft Visual Studio® .NET team with extensive experience in designing, testing, and optimizing enterprise applications—discusses the technical and architectural trade-offs you'll face as you develop large, multitier, multideveloper distributed applications. He also shows how to create a workable enterprise infrastructure, and he reveals inside tips and techniques for implementation, performance tuning, and testing. You'll find out how to take advantage of key state-of-the-art OOP features in Visual Basic .NET plus platform enhancements in Microsoft .NET to develop serious enterprise applications quickly.

Table of contents

  1. Designing Enterprise Applications with Microsoft® Visual Basic® .NET
  2. Dedication
  3. A Note Regarding Supplemental Files
  4. Introduction
    1. The Purpose of This Book
    2. Who Should Read This Book
    3. Organization of This Book
    4. Updates and Other Information
    5. Acknowledgements
    6. System Requirements
    7. Installing the Sample Files
    8. Support
  5. I. Moving to Enterprise Development with Visual Basic .NET
    1. 1. Enterprise Application Development and Visual Basic .NET
      1. Enterprise Application Development
        1. Team Development
        2. Performance, Scalability, and Reliability
          1. Performance
          2. Scalability
          3. Reliability
        3. Implementation Technologies and Integration
        4. The Distributed Environment
      2. The Development Process
        1. Collecting Requirements
          1. Customer Requirements
          2. Infrastructure and Availability Requirements
          3. Performance Requirements
          4. Deployment Requirements
        2. Design and Architecture
          1. The User Interface
            1. Option 1: client only
            2. Option 2: thin client
            3. Option 3: fat client
            4. Option 4: mixed client
          2. The Component Architecture
          3. The Network Architecture
        3. Implementation
        4. Testing
        5. Deployment
      3. Visual Basic .NET
        1. Visual Basic Then and Now
          1. The Limitations of COM
          2. Visual Basic: The Next Generation
          3. Moving Beyond COM
        2. Good Coding Practices
          1. Implicit vs. Explicit Programming
          2. Naming Conventions
            1. Methods
            2. Variables
      4. Conclusion
    2. 2. Visual Basic .NET for the Enterprise
      1. Moving Beyond Visual Basic 6.0
        1. Option Strict Is Not Optional
          1. Narrowing Conversions
          2. Late Binding
        2. Short-Circuiting Your Operators
        3. Calling Platform Functions Directly: Declare and DllImport
      2. Types in Visual Basic .NET
        1. Type Magic: Boxing and Unboxing
        2. Classes and Modules
        3. Structures
          1. Structures and Interfaces
        4. Interfaces
        5. Enumeration Types
          1. Neat Enum Tricks
        6. Delegates and Events
          1. Defining Your Delegates
          2. Declaring and Publishing Events
      3. Visual Basic and OOP
        1. Making the Most of Namespaces
          1. Organizing Your Applications
          2. Namespace Tips
        2. Inheritance: The Wily Beast of OOP
          1. Inheritance: The Rules of the Road
          2. Inheritance: No Substitute for Good Design
          3. Inheritance Nuances
            1. Controlling inheritance
            2. Polymorphism and inheritance
            3. Me, MyBase, and MyClass
          4. Encapsulation
          5. Shared Members
          6. Object Construction
        3. Singletons
      4. Exception Handling Redux
        1. Exception Handling Basics
        2. Throwing Exceptions
        3. Exception Handling No-Nos
        4. Custom Exceptions
      5. Resource Management and IDisposable
        1. The Garbage Collector
        2. The IDisposable Interface
          1. Implementing IDisposable
      6. Conclusion
    3. 3. Multithreaded Programming
      1. An Overview of Basic Threading Concepts
        1. Processes and Threads
          1. Execution Time
          2. Limitations of Threads
        2. Creating Threads
      2. Encapsulating Threads
        1. Wrapping a Thread with a Class
      3. Controlling Thread Execution
        1. The ThreadState Property and the Life Cycle of a Thread
          1. Unstarted
          2. Running
          3. Suspended
          4. WaitSleepJoin
          5. Stopped
          6. Aborted
        2. Referencing the Current Thread
        3. Thread Control Methods
          1. Thread.Start
          2. Thread.Sleep
          3. Thread.SpinWait
          4. Thread.Suspend
          5. Thread.Resume
          6. Thread.Abort
          7. Thread.Join
          8. Thread.Interrupt
        4. Tying It All Together
      4. Thread Synchronization
        1. Race Conditions and You
        2. Synchronization Constructs
          1. The WaitHandle Class
            1. WaitOne
            2. WaitAny
            3. WaitAll
          2. The AutoResetEvent and ManualResetEvent Classes
          3. The Mutex Class
          4. The Interlocked Class
            1. Increment and Decrement
            2. Exchange and CompareExchange
          5. The Monitor Class and SyncLock
          6. The ReaderWriterLock Class
      5. Thread Pooling
        1. The ThreadPool Class
      6. Conclusion
    4. 4. Playing Nice with Others: Native Code and COM Interoperability
      1. The PInvoke Service
        1. Calling Native Methods
          1. The Declare Statement
            1. String-encoding options
            2. The Alias option
            3. Limitations of Declare
          2. The DllImport Attribute
        2. Marshaling Types
          1. Basic Types
            1. ByRef vs. ByVal
            2. Dealing with constants
          2. Marshaling Strings
            1. Strings as parameters
            2. Functions that return strings
          3. Marshaling Structures
            1. Structures and strings
            2. The StructLayout attribute
            3. Structure definition shortcuts
          4. The Marshal Class
        3. Implementing Callback Functions
        4. Wrapping Things Up
      2. COM and Visual Basic .NET
        1. What Is COM Interop?
        2. COM vs. .NET
          1. Type Libraries vs. Assemblies
          2. Interfaces and Inheritance
          3. New vs. New
          4. Object Identity
          5. Error Handling
          6. Object Lifetimes
          7. IDispatch vs. Reflection
        3. What COM Interop Does
        4. Using COM from Visual Basic .NET
          1. Creating an RCW
            1. Tlbimp and RCWs
          2. Using Your RCW
            1. Garbage collection and reference counting
        5. Using Visual Basic .NET from COM
          1. Creating a More Sophisticated COM Class
        6. COM Threading Models
          1. Threading Concerns
      3. Performance Considerations
        1. Memory Considerations
      4. Conclusion
  6. II. Building an Enterprise Infrastructure
    1. 5. Distributed Programming in .NET
      1. Serialization
        1. Serialization Formats
        2. The Serializable Attribute
          1. Selective Serialization
          2. Custom Serialization
          3. Limitations of the Serializable Attribute
      2. XML Web Services
        1. Getting Started
          1. Consuming an XML Web Service
        2. SOAP Header Extensions
        3. Performance
          1. Calling Overhead
        4. Limitations of Web Services
        5. Security
          1. User Authentication
          2. Content Security
          3. Custom Security
            1. Custom authentication
            2. Custom content security
      3. Remoting
        1. Getting Started
        2. Picking the Right Channel
          1. The TcpChannel Class
          2. The HttpChannel Class
        3. Marshaling Data
          1. Marshaling Types By Value
          2. Marshaling Types By Reference
        4. Using a Separate Interface
        5. Remoting Singletons
          1. Lifetime Leases
        6. Security
          1. Securing the Communications Channel
          2. Securing the Message’s Content
        7. Tying It All Together
      4. Conclusion
    2. 6. Custom Network Communication
      1. An Overview of Network Communication
        1. Network Architectures
        2. Communications Protocols
          1. The IP Protocol
            1. IPv4 vs. IPv6
          2. IP-Based Protocols
            1. TCP
            2. UDP
          3. Pluggable Protocols
      2. The WebRequest Class: More Than Meets the Eye
        1. Supporting Client Authentication
        2. Managing Your Connections
        3. Creating Custom WebRequestModules
        4. Advanced WebRequest Features
          1. Asynchronous Operations
      3. The WebClient Class
      4. Socket Programming
        1. Getting Started with Addressing
          1. Creating Simple Addresses
          2. DNS Host Name vs. IP Address
        2. Using the TcpClient, TcpListener, and UdpClient Classes
          1. TcpClient and TcpListener
          2. UdpClient
        3. Down to the Wire: Socket-Level Network Programming
          1. The Socket Class
          2. Example: Creating Ping
      5. Conclusion
    3. 7. Windows Services
      1. Introduction to Windows Services
      2. The ServiceController Class
        1. The Service Manager Application
      3. The Windows Event Log
      4. A Simple Service
      5. A Timely Example of a Service
        1. Communicating with the Service
        2. Updating the Date and Time
      6. Installing a Service
      7. Debugging a Service
        1. Debugging the OnStart Method
        2. The Trace Class
      8. Conclusion
    4. 8. Integrating Enterprise-Level Services
      1. Understanding COM+ and Enterprise Services
        1. COM+ Requirements
        2. Creating a Serviced Component
        3. Understanding Application Activation
        4. Understanding COM+ Contexts
        5. COM+ Object Construction
        6. Object Pooling
          1. The Life Cycle of a Pooled Object
          2. Requirements for Pooled Objects
          3. Other Pooling Considerations
          4. Creating a Poolable Object
        7. Just-in-Time Activation
          1. Creating a JIT-Activated Component
        8. COM+ Transactions
          1. The ACID Rules
          2. Creating a Transactional Component
          3. Building a Transactional Component
          4. The MyTransactionalClass Object
      2. Messaging
        1. Messages
        2. Message Queues
          1. Transactional Queues
          2. Queued Components
        3. Messaging in Visual Basic .NET
          1. The Message Class
          2. The MessageQueue Class
        4. Creating Your First Queue
        5. Working with Your Queue
          1. Receiving Messages from a Queue Asynchronously
          2. Sending More Sophisticated Messages
        6. Automating Queue Installation
      3. Conclusion
    5. 9. Adding Security to Your Applications
      1. Security Features in .NET
        1. Role-Based Security
        2. Web Application Security
        3. Evidence-Based Security
        4. Cryptography
          1. Cryptographic Algorithms
          2. Random Number Generation
            1. Validating data
          3. Digital Signatures
          4. Cryptography and Visual Basic .NET
        5. Buffer Overrun Detection
      2. Enterprise Security Scenarios
        1. Code Security
          1. Code Access Security
          2. Requesting Code Permissions
        2. User Identity
        3. Scripting Security
          1. Scripting Security Policy Changes
          2. Scripting Against Named Code Groups
        4. Authentication and Authorization
          1. Windows Identity in Server Applications
          2. Forms-Based Authentication
          3. Authorizing Users and Roles
      3. Conclusion
  7. III. Performance and Debugging
    1. 10. Essential Debugging Techniques
      1. Debuggers
        1. The Visual Studio .NET Debugger
        2. Other Debuggers
          1. The Microsoft CLR Debugger
          2. The CorDbg Debugger
          3. The Microsoft Console Debugger and Microsoft NT Symbolic Debugger
          4. The Windows Debugger
      2. Better Debugging with the .NET Diagnostic Tools
        1. The Debugger Class
        2. Event Logs
          1. Creating New Event Log Entries
          2. Creating Event Logs
            1. The EventLogInstaller class
          3. Monitoring an Event Log
            1. The EventLogEntry class
          4. Accessing the Event Log Entries
          5. The EventLog Sample Application
        3. The Trace and Debug Classes
          1. Using Debug and Trace
          2. Enabling and Disabling Debug and Trace
          3. TraceListener Objects
            1. Predefined TraceListener classes
            2. Creating a custom TraceListener
          4. Controlling Debug and Trace Output
            1. The BooleanSwitch class
            2. The TraceSwitch class
            3. The Switch classes
      3. Conclusion
    2. 11. Common Performance Issues
      1. String Concatenation
        1. StringBuilder Makes the Grade
        2. Format Strings
        3. String Performance by the Numbers
      2. Late Binding
      3. Designing Types
      4. Error Handling
        1. On Error Goto and On Error Resume Next vs. Exceptions
        2. Exception Handling Best Practices
      5. Database Issues
        1. Database Connection Leaks and Connection Pooling
          1. Making the Most of Connection Pools
          2. Tracking Down Connection Leaks
            1. Symptoms of a potential connection leak
            2. Avoiding connection leaks
        2. Using a DataReader with a Stored Proc Whenever Possible
        3. Using Ordinals Instead of Column Names
      6. Resource Management and IDisposable
      7. ASP.NET
        1. ASP.NET Session State
        2. STA COM Interop in ASP.NET
          1. Fun with Construction
          2. COM, Session State, and the Application Object
      8. Loading the Right Runtime
      9. Conclusion
    3. 12. The Art of Performance Tuning
      1. Performance Testing
        1. Tools of the Trade
          1. Windows Task Manager
          2. Performance Monitor
          3. Debuggers
          4. Profilers
          5. Performance and Stress Tools
        2. Performance Test Planning
          1. Deciding on Acceptable Results
          2. Building a Performance Profile
      2. Performance Tuning
        1. The Sanity Check
          1. Processor Usage
            1. Pegged processor
            2. Single processor pegged (multiprocessor machine)
            3. Cyclic processor
            4. Erratic Processor
            5. Stalled Processor
          2. Memory Behavior
            1. Stable memory usage
            2. Undulating memory usage
            3. Ever-increasing memory usage
          3. Network Usage
            1. Low
            2. High
          4. That’s All, Folks
        2. Attaching a Debugger
          1. Performance Counters
        3. Low-Level Analysis
      3. Conclusion
  8. A. Using Visual Basic .NET in a Multideveloper Environment
    1. Architecture and Design Issues
      1. Analyzing Business Requirements
      2. Defining the Technical Architecture for a Project
      3. Visual Studio .NET Enterprise Architect
    2. Making the Most of Visual Studio .NET
      1. Modeling Tools
      2. Enterprise Templates
      3. Visual SourceSafe and Source Control
        1. Adding a Project to the Source Control Repository
        2. Creating a Project from the Source Control Repository
        3. Exclusive Checkouts
      4. Managing Web Projects
      5. Managing Dependencies
        1. Database Dependencies
        2. COM Dependencies
      6. Customizing the Start Page
  9. B. Getting Started with Application Center Test
    1. An Overview of ACT
      1. Using the Standalone Version of ACT
    2. Useful Techniques for Customizing ACT Tests
      1. Inserting Random Delay into Your Tests
      2. Extracting ASP.NET ViewState from the Response Object
      3. Appending ASP.NET ViewState to a Request
    3. The ACT Test Object Model
  10. C. Common Language Runtime Performance Counters
    1. .NET Performance Counters
      1. .NET CLR Data
      2. .NET CLR Exceptions
      3. .NET CLR Interop
      4. .NET CLR JIT
      5. .NET CLR Loading
      6. .NET CLR LocksAndThreads
      7. .NET CLR Memory
      8. .NET CLR Networking
      9. .NET CLR Remoting
      10. .NET CLR Security
    2. Performance Counters for ASP.NET
      1. ASP.NET Applications
  11. D. Performance Counter Quick Reference
    1. Common Performance Counters
    2. Application-Specific Counters
      1. ASP.NET and Web Services
      2. SQL Database Applications
      3. Applications That Use Interop or Remoting
  12. E. About the Author
    1. Robert Ian Oliver
    2. Contributing Authors
  13. F.
    1. Wood File
  14. Index
  15. About the Author
  16. Copyright

Product information

  • Title: Designing Enterprise Applications with Microsoft® Visual Basic® .NET
  • Author(s):
  • Release date: October 2002
  • Publisher(s): Microsoft Press
  • ISBN: 9780735617216