You are previewing Microsoft .NET: Architecting Applications for the Enterprise, Second Edition.
O'Reilly logo
Microsoft .NET: Architecting Applications for the Enterprise, Second Edition

Book Description

A software architect’s digest of core practices, pragmatically applied

Designing effective architecture is your best strategy for managing project complexity–and improving your results. But the principles and practices of software architecting–what the authors call the “science of hard decisions”–have been evolving for cloud, mobile, and other shifts. Now fully revised and updated, this book shares the knowledge and real-world perspectives that enable you to design for success–and deliver more successful solutions.

In this fully updated Second Edition, you will:

  • Learn how only a deep understanding of domain can lead to appropriate architecture

  • Examine domain-driven design in both theory and implementation

  • Shift your approach to code first, model later–including multilayer architecture

  • Capture the benefits of prioritizing software maintainability

  • See how readability, testability, and extensibility lead to code quality

  • Take a user experience (UX) first approach, rather than designing for data

  • Review patterns for organizing business logic

  • Use event sourcing and CQRS together to model complex business domains more effectively

  • Delve inside the persistence layer, including patterns and implementation.

  • Table of Contents

    1. Title Page
    2. Copyright Page
    3. Dedication Page
    4. Contents at a glance
    5. Contents
    6. Introduction
      1. Organization of this book
      2. Who should read this book
      3. Assumptions
      4. This book might not be for you if...
      5. Downloads: Code samples
      6. Acknowledgments
      7. Errata, updates, & book support
      8. Free ebooks from Microsoft Press
      9. We want to hear from you
      10. Stay in touch
    7. Part I: Foundation
      1. Chapter 1. Architects and architecture today
        1. What’s software architecture, anyway?
          1. Applying architectural principles to software
          2. Acknowledging requirements
          3. What’s architecture and what’s not
          4. The architecture process
        2. Who’s the architect, anyway?
          1. An architect’s responsibilities
          2. The role of the architect
          3. Common misconceptions about architects
        3. Summary
        4. Finishing with a smile
      2. Chapter 2. Designing for success
        1. The “Big Ball of Mud”
          1. Causes of the “Big Ball of Mud”
          2. Symptoms of the “Big Ball of Mud”
          3. Using metrics to detect a BBM
        2. Mechanics of software projects
          1. Organizational culture
          2. Helping the team write better code
        3. Getting out of the mess
          1. That odd thing called “legacy code”
          2. Checkmate in three moves
          3. Deciding whether or not to add manpower
        4. Summary
        5. Finishing with a smile
      3. Chapter 3. Principles of software design
        1. Universal principles of software design
          1. From spaghetti code to lasagna code
          2. Separation of concerns
          3. Isolation
        2. Object-oriented design
          1. Pertinent classes
          2. Program to an interface
          3. Composition vs. inheritance
          4. A second pass at object-orientation
        3. Development and design vectors
          1. SOLID principles
          2. Patterns for handling dependencies
          3. Coding vectors
          4. Use of patterns
          5. Refactoring
        4. Defensive programming
          1. The If-Then-Throw pattern
          2. Software contracts
        5. Summary
        6. Finishing with a smile
      4. Chapter 4. Writing software of quality
        1. The art of writing testable code
          1. What is testability, anyway?
          2. Testing your software
          3. Common practices of software testing
        2. The practice of code extensibility
          1. Interface-based design
          2. Plugin architecture
          3. State machines
        3. Writing code that others can read
          1. Readability as a software attribute
          2. Some practical rules for improving readability
        4. Summary
        5. Finishing with a smile
    8. Part II: Devising the architecture
      1. Chapter 5. Discovering the domain architecture
        1. The real added value of domain-driven design
          1. What’s in DDD for me?
          2. Conducting analysis using DDD
          3. Strategic model design
        2. The ubiquitous language
          1. Purpose of the ubiquitous language
          2. Structure of the ubiquitous language
          3. How to define the ubiquitous language
          4. Keeping language and model in sync
        3. Bounded contexts
          1. Discovering contexts
          2. Context mapping
          3. Giving each context its own architecture
        4. The layered architecture
          1. Origins of the layered architecture
          2. Presentation layer
          3. Application layer
          4. Domain layer
          5. Infrastructure layer
        5. Summary
        6. Finishing with a smile
      2. Chapter 6. The presentation layer
        1. User experience first
          1. Focus on interactions
          2. UX is not UI
          3. How to create an effective experience
        2. Realistic scenarios
          1. ASP.NET websites
          2. Web Forms vs. ASP.NET MVC
          3. Adding device support to websites
          4. Single-page applications
          5. Desktop rich client
        3. Summary
        4. Finishing with a smile
      3. Chapter 7. The mythical business layer
        1. Patterns for organizing the business logic
          1. The fairytale of CRUD and an architecture Prince Charming
          2. The Transaction Script pattern
          3. The Domain Model pattern
          4. The Anemic Domain Model (anti-)pattern
        2. Moving the focus from data to tasks
          1. Task orchestration in ASP.NET MVC
          2. Orchestrating tasks within the domain
        3. Moving data across the boundaries
          1. Data flow in layered architecture
          2. Sharing the Domain Model entities
          3. Using data-transfer objects
        4. Summary
        5. Finishing with a smile
    9. Part III: Supporting architectures
      1. Chapter 8. Introducing Domain Model
        1. The data-to-behavior shift
          1. Rationale behind models and domains
          2. Database is infrastructure
        2. Inside the domain layer
          1. Domain model
          2. Aggregates
          3. Domain services
          4. Domain events
          5. Cross-cutting concerns
        3. Summary
        4. Finishing with a smile
      2. Chapter 9. Implementing Domain Model
        1. The online store sample project
          1. Selected use-cases
          2. Selected approach
          3. Structure of the I-Buy-Stuff project
          4. Selected technologies
          5. Bounded contexts for an online store
          6. Context map of the I-Buy-Stuff application
        2. The noble art of pragmatic domain modeling
          1. Behavior is a game-changer
          2. Entities scaffolding
          3. Value objects scaffolding
          4. Identifying aggregates
          5. Persisting the model
        3. Implementing the business logic
          1. Finding an order
          2. Placing an order
          3. Fidelity card (or customer loyalty program)
        4. Summary
        5. Finishing with a smile
      3. Chapter 10. Introducing CQRS
        1. Separating commands from queries
          1. Generalities of the CQRS pattern
          2. Benefits of CQRS
          3. Fitting CQRS in the business layer
          4. CQRS always pays the architecture bill
        2. The query stack
          1. The read domain model
          2. Designing a read-model façade
          3. Layered expression trees
        3. The command stack
          1. Getting back to presentation
          2. Formalizing commands and events
          3. Handling commands and events
          4. Readymade storage
        4. Summary
        5. Finishing with a smile
      4. Chapter 11. Implementing CQRS
        1. CQRS implementations
          1. Plain and simple CQRS
          2. CQRS with command architecture
        2. Implementing a query stack
          1. Creating a read façade
          2. Packaging data for callers
        3. Implementing a command stack
          1. Laying the groundwork
          2. Orchestrating use-cases via commands
        4. Summary
        5. Finishing with a smile
      5. Chapter 12. Introducing event sourcing
        1. The breakthrough of events
          1. The next big thing (reloaded)
          2. The real world has events, not just models
          3. Moving away from “last-known good state”
          4. The deep impact of events in software architecture
        2. Event-sourcing architecture
          1. Persisting events
          2. Replaying events
        3. Summary
        4. Finishing with a smile
      6. Chapter 13. Implementing event sourcing
        1. Event sourcing: Why and when
          1. Why event sourcing is a resource
          2. When event sourcing is appropriate
        2. Event sourcing with replay
          1. A live-scoring system
          2. Implementation of the system
        3. Event sourcing with aggregate snapshots
          1. A mini enterprise resource planning system
          2. Implementation of the system
        4. Summary
        5. Finishing with a smile
    10. Part IV: Infrastructure
      1. Chapter 14. The persistence layer
        1. Portrait of a persistence layer
          1. Responsibilities of the persistence layer
          2. Design of a Repository pattern
        2. Implementing repositories
          1. The query side of repositories
          2. Persisting aggregates
          3. Storage technologies
        3. Why should you consider nonrelational storage?
          1. Familiarizing yourself with NoSQL
          2. What you gain and what you lose
          3. Planning a sound choice
        4. Summary
        5. Finishing with a smile
    11. Index
    12. About the authors
    13. Back Cover