You are previewing Professional Enterprise .NET.
O'Reilly logo
Professional Enterprise .NET

Book Description

Comprehensive coverage to help experienced .NET developers create flexible, extensible enterprise application code

If you're an experienced Microsoft .NET developer, you'll find in this book a road map to the latest enterprise development methodologies. It covers the tools you will use in addition to Visual Studio, including Spring.NET and nUnit, and applies to development with ASP.NET, C#, VB, Office (VBA), and database.

You will find comprehensive coverage of the tools and practices that professional .NET developers need to master in order to build enterprise more flexible, testable, and extensible .NET applications with minimal upfront costs.

  • Helps C#, VB.Net, and ASP.NET developers who wish to migrate both their applications and their own skillsets to newer, more flexible enterprise methodologies

  • Describes each new pattern or feature along with its benefits, then outlines the pros and cons of its implementation

  • Includes an introduction to enterprise development and a comprehensive overview of the differences between new enterprise patterns and older, traditional Microsoft programming

  • Explains how to implement these patterns by upgrading an existing code base

  • Covers benefits including flexibility, automated testing, extensibility, and separation; modular code; test-driven development, unit test, test automation, and refactoring; inversion of control; and object relational mapping

  • Also covers enterprise design patterns: MVC including Ruby on Rails, Monorail, and ASP.NET MVC, MVP, observer, and more

  • Contains a primer on object-oriented design

Professional Enterprise .NET focuses on the often-inevitable compromise between forward-thinking design and the needs of business, helping you build applications that serve both.

Table of Contents

  1. Copyright
  2. About the Author
  3. Credits
  4. Acknowledgments
  5. Introduction
    1. What This Book Covers
      1. Chapter 1: What is Enterprise Design?
      2. Chapter 2: The Enterprise Code
      3. Chapter 3: Emancipate Your Classes
      4. Chapter 4: Test Driven Development
      5. Chapter 5: Make it Simple Again
      6. Chapter 6: Getting to the Middle of Things
      7. Chapter 7: Writing Your Own Middleware
      8. Chapter 8: Mining Your Own Business
      9. Chapter 9: Organizing Your Front End
      10. Chapter 10: The Model-View-Presenter Pattern
      11. Chapter 11: The Model-View-Controller Pattern
      12. Chapter 12: Putting it All Together
    2. How This Book Is Structured
    3. Conventions
    4. Source Code
    5. Errata
    6. p2p.wrox.com
      1. Setting Expectations
  6. I. Introduction to Practical Enterprise Development
    1. 1. What is Enterprise Design?
      1. 1.1. What Is Enterprise Architecture?
      2. 1.2. What Is Enterprise Development?
        1. 1.2.1. Reliability
        2. 1.2.2. Flexibility
        3. 1.2.3. Separation of Concerns
        4. 1.2.4. Reusability
        5. 1.2.5. Maintainability
      3. 1.3. Where Is All of the Microsoft Enterprise?
        1. 1.3.1. The COM Factor
        2. 1.3.2. The Shift to Java
        3. 1.3.3. The .NET Revolution
      4. 1.4. Summary
    2. 2. The Enterprise Code
      1. 2.1. A New Way to Look At Code
        1. 2.1.1. Modularity
        2. 2.1.2. Loosely Coupled Classes
        3. 2.1.3. Unit Testing
        4. 2.1.4. Inversion of Control Containers
      2. 2.2. Summary
  7. II. The New Code — Changing the Way You Build
    1. 3. Emancipate Your Classes
      1. 3.1. Evaluating Your Code for Dependencies
        1. 3.1.1. Rigidity
        2. 3.1.2. Flexibility
        3. 3.1.3. Separation of Concerns
        4. 3.1.4. Reusability
        5. 3.1.5. Maintainabilty
      2. 3.2. Separation of Concerns and Identifying Modularity
      3. 3.3. The Dependency Inversion Principle
      4. 3.4. Turning Classes Inside Out Using Dependency Injection
        1. 3.4.1. Rigidity
        2. 3.4.2. Flexibility
        3. 3.4.3. Separation of Concerns
        4. 3.4.4. Reusability
        5. 3.4.5. Maintainability
      5. 3.5. Summary
    2. 4. Test Driven Development
      1. 4.1. Tic Tac Toe and Test Driven Development: An Example
        1. 4.1.1. Tic Tac Toe Requirements
          1. 4.1.1.1. Initial Tests
        2. 4.1.2. Testing Frameworks
          1. 4.1.2.1. NUnit
          2. 4.1.2.2. MS Test
          3. 4.1.2.3. MbUnit
          4. 4.1.2.4. TestDriven.Net
        3. 4.1.3. Identifying Testable Elements
          1. 4.1.3.1. Don't Test Trivial Code
          2. 4.1.3.2. Testing Third-Party Modules
          3. 4.1.3.3. Testing at the Right Level of Abstraction
          4. 4.1.3.4. Testing Boundary Conditions
        4. 4.1.4. Writing Unit Tests that Work and Help
          1. 4.1.4.1. Tests Should Run Fast
          2. 4.1.4.2. Tests Should Run Automatically
          3. 4.1.4.3. Tests Should Be Atomic
          4. 4.1.4.4. Tests Should be Repeatable
          5. 4.1.4.5. Tests Must Be Explicit and Readable
          6. 4.1.4.6. Tests Should Be Independent
          7. 4.1.4.7. Tests Should Be Easy to Setup
          8. 4.1.4.8. Test Coverage and Testing Angles/Triangulation
          9. 4.1.4.9. Automating — the Real Benefit
      2. 4.2. Refactoring
      3. 4.3. Refactoring Tools
        1. 4.3.1. ReSharper
        2. 4.3.2. Refactor Pro
      4. 4.4. Dealing with Dependencies in Test Driven Development — Mocking, Stubs, and Fakes
      5. 4.5. Mocking Frameworks
        1. 4.5.1. Rhino Mocks
        2. 4.5.2. Moq
        3. 4.5.3. NMock
      6. 4.6. Summary
    3. 5. Make It Simple Again — Inversion of Control
      1. 5.1. Creating Dependencies
      2. 5.2. Factory Pattern
      3. 5.3. Service Locator
      4. 5.4. Inversion of Control and IoC Containers
      5. 5.5. What's in a Name? Dependency Injection vs. Inversion of Control
        1. 5.5.1. Choosing Your Container
          1. 5.5.1.1. Build Your Own Lightweight IoC Container
      6. 5.6. StructureMap
        1. 5.6.1. Wire Up Using the Fluent Interface
        2. 5.6.2. Wire Up Using Attributes — the Plugin Family
        3. 5.6.3. Wire Up Using Configuration Meta Data
      7. 5.7. To XML or Not to XML, That Is the Question
        1. 5.7.1. Other IoC Frameworks
          1. 5.7.1.1. Windsor Container
          2. 5.7.1.2. MS Unity
          3. 5.7.1.3. Spring.Net
      8. 5.8. Summary
  8. III. Enterprise Design Patterns
    1. 6. Getting to the Middle of Things
      1. 6.1. On Middleware
      2. 6.2. The Wild West
      3. 6.3. Tiered Designs
      4. 6.4. The Internet Age
      5. 6.5. The Enterprise Middleware Age
      6. 6.6. A WCF Web Service
      7. 6.7. The Messaging Model
      8. 6.8. A Brief Note on SOA
      9. 6.9. Summary
    2. 7. Writing Your Own Middleware
      1. 7.1. Business Logic Layer
      2. 7.2. Patterns for Your Business
        1. 7.2.1. Transaction Script
        2. 7.2.2. Active Record Pattern
        3. 7.2.3. Domain Model Pattern
        4. 7.2.4. Which Pattern to Use?
      3. 7.3. Serving Your Business
        1. 7.3.1. The Service Layer
        2. 7.3.2. Putting Patterns into Practice
        3. 7.3.3. Mortgage Loan Prequalification Application
        4. 7.3.4. Talking the Language of the Domain
      4. 7.4. A Little Bit about Domain-Driven Design
        1. 7.4.1. Entities
        2. 7.4.2. Value Objects
        3. 7.4.3. Aggregates and Aggregate Roots
        4. 7.4.4. Talking with the Domain Expert
        5. 7.4.5. Building the Domain Model
        6. 7.4.6. Identifying the Aggregates
        7. 7.4.7. Building the Application
        8. 7.4.8. Creating the Repositories
        9. 7.4.9. Creating the Domain Services
      5. 7.5. Summary
    3. 8. "Mining" Your Own Business
      1. 8.1. What Is the Data Access Layer?
        1. 8.1.1. Rolling Your Own Data Access Layer
        2. 8.1.2. Object Relation Mapping
          1. 8.1.2.1. The Role of ORMs
        3. 8.1.3. The Data Context
          1. 8.1.3.1. Data First and the Data Access Object Pattern
          2. 8.1.3.2. LinqToSQL
        4. 8.1.4. Entity Framework
        5. 8.1.5. LinqToSQL or the Entity Framework?
          1. 8.1.5.1. Model First
          2. 8.1.5.2. Repository Pattern
          3. 8.1.5.3. POCO and Persistence Ignorance
          4. 8.1.5.4. NHibernate
        6. 8.1.6. Mapping the Mortgage Application with NHibernate
      2. 8.2. Summary
    4. 9. Organizing Your Front End
      1. 9.1. The Neglected Front End
      2. 9.2. Early Front-End Patterns
        1. 9.2.1. Java Struts
        2. 9.2.2. ASP.NET
        3. 9.2.3. Model-View-Presenter
        4. 9.2.4. Back to MVC ... the Rails Way
      3. 9.3. Summary
    5. 10. Model-View-Presenter
      1. 10.1. The MVP Pattern — Simplified
        1. 10.1.1. The Model
        2. 10.1.2. The View
        3. 10.1.3. The Presenter
        4. 10.1.4. The MVP Mortgage Calculator — Web Sample
      2. 10.2. Switching Platforms — Thick Client Sample
        1. 10.2.1. Setting Up the WPF Application
      3. 10.3. Summary
    6. 11. The Model-View-Controller Pattern
      1. 11.1. Back to Basics
        1. 11.1.1. Models
        2. 11.1.2. Controllers
        3. 11.1.3. Views
          1. 11.1.3.1. Routing
        4. 11.1.4. The Mortgage Loan Application
        5. 11.1.5. The Model
        6. 11.1.6. The Controller
        7. 11.1.7. The View
        8. 11.1.8. A Simple Repository
        9. 11.1.9. Creating and Editing
        10. 11.1.10. Flushing Out the Model
        11. 11.1.11. The Full Source Code
      2. 11.2. Summary
    7. 12. Putting It All Together
      1. 12.1. One Step Back, Many Steps Forward
      2. 12.2. The Concepts
        1. 12.2.1. Reliability
        2. 12.2.2. Flexibility
        3. 12.2.3. Separation of Concerns
        4. 12.2.4. Reusability
        5. 12.2.5. Maintainability
        6. 12.2.6. The Big Picture
      3. 12.3. The Code
        1. 12.3.1. The Big Picture
      4. 12.4. The Patterns
        1. 12.4.1. Middleware
        2. 12.4.2. Persistence
        3. 12.4.3. The User Interface
        4. 12.4.4. The Big Picture
      5. 12.5. Being Holistic — The Big, BIG Picture
        1. 12.5.1. The Mortgage Service
          1. 12.5.1.1. The Simple Mortgage Calculator
          2. 12.5.1.2. The Mortgage Loan Prequalification Application
      6. 12.6. Final Thoughts
      7. 12.7. Summary
    8. A. C#.NET Primer
      1. A.1. .NET Concepts
        1. A.1.1. Multiple Languages
        2. A.1.2. Flexible Runtime Environment
        3. A.1.3. Garbage Collection
        4. A.1.4. No More COM
        5. A.1.5. Programming in C#
          1. A.1.5.1. Types and Entities
        6. A.1.6. System Defined Types
        7. A.1.7. User-Defined Types
        8. A.1.8. Scope and Declaration
        9. A.1.9. Properties, Delegates, and Events
        10. A.1.10. Namespaces
        11. A.1.11. C# 3.0 Language Features
        12. A.1.12. Implicitly Local Typed Variables
        13. A.1.13. Lambda Expressions
        14. A.1.14. Extension Methods
        15. A.1.15. Object and Collection Initializers
        16. A.1.16. Object-Oriented Concepts
        17. A.1.17. Classes and Objects
        18. A.1.18. Inheritance
        19. A.1.19. Encapsulation
        20. A.1.20. Polymorphism and Abstraction
      2. A.2. C# and the Web SDK
        1. A.2.1. System.Web
        2. A.2.2. System.Web.UI
        3. A.2.3. System.Web.UI.WebControls
        4. A.2.4. System.Web.UI.HtmlControls
        5. A.2.5. System.Web.Services
        6. A.2.6. System.Web.Security
        7. A.2.7. System.Web.Mobile
        8. A.2.8. System.NET.Mail Namespace
        9. A.2.9. System.Web.Mvc Namespace
        10. A.2.10. System.Web.Mvc.Ajax Namespace
        11. A.2.11. System.Web.Mvc.Html Namespace
        12. A.2.12. System.Data
        13. A.2.13. System.IO
        14. A.2.14. System.NET
        15. A.2.15. System.Xml
      3. A.3. Summary