AOP in .NET: Practical Aspect-Oriented Programming
Summary

AOP in .NET introduces aspect-oriented programming to .NET developers and provides practical guidance on how to get the most benefit from this technique in your everyday coding. The book's many examples concentrate on modularizing non-functional requirements that often sprawl throughout object-oriented projects. Even if you've never tried AOP before, you'll appreciate the straightforward introduction using familiar C#-based examples. AOP tools for .NET have now reached the level of practical maturity Java developers have relied on for many years, and you'll explore the leading options, PostSharp, and Castle DynamicProxy.

About the Technology

Core concerns that cut across all parts of your application, such as logging or authorization, are difficult to maintain independently. In aspect-oriented programming (AOP) you isolate these cross-cutting concerns into their own classes, disentangling them from business logic. Mature AOP tools like PostSharp and Castle DynamicProxy now offer .NET developers the level of support Java coders have relied on for years.

About this Book

AOP in .NET introduces aspect-oriented programming and provides guidance on how to get the most practical benefit from this technique. The book's many examples concentrate on modularizing non-functional requirements that often sprawl throughout object-oriented projects. You'll appreciate its straightforward introduction using familiar C#-based examples.

This book requires no prior experience with AOP. Readers should know C# or another OO language.

What's Inside
  • Clear and simple introduction to AOP
  • Maximum benefit with minimal theory
  • PostSharp and Castle DynamicProxy

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Author

Matthew D. Groves is a developer with over ten years of professional experience working with C#, ASP.NET, JavaScript, and PHP.

Table of Contents
    Introducing AOP
  1. Acme Car Rental
  2. Call this instead: intercepting methods
  3. Before and after: boundary aspects
  4. Get this instead: intercepting locations
  5. Unit testing aspects
  6. AOP implementation types
  7. Using AOP as an architectural tool
  8. Aspect composition: example and execution
1114672154
AOP in .NET: Practical Aspect-Oriented Programming
Summary

AOP in .NET introduces aspect-oriented programming to .NET developers and provides practical guidance on how to get the most benefit from this technique in your everyday coding. The book's many examples concentrate on modularizing non-functional requirements that often sprawl throughout object-oriented projects. Even if you've never tried AOP before, you'll appreciate the straightforward introduction using familiar C#-based examples. AOP tools for .NET have now reached the level of practical maturity Java developers have relied on for many years, and you'll explore the leading options, PostSharp, and Castle DynamicProxy.

About the Technology

Core concerns that cut across all parts of your application, such as logging or authorization, are difficult to maintain independently. In aspect-oriented programming (AOP) you isolate these cross-cutting concerns into their own classes, disentangling them from business logic. Mature AOP tools like PostSharp and Castle DynamicProxy now offer .NET developers the level of support Java coders have relied on for years.

About this Book

AOP in .NET introduces aspect-oriented programming and provides guidance on how to get the most practical benefit from this technique. The book's many examples concentrate on modularizing non-functional requirements that often sprawl throughout object-oriented projects. You'll appreciate its straightforward introduction using familiar C#-based examples.

This book requires no prior experience with AOP. Readers should know C# or another OO language.

What's Inside
  • Clear and simple introduction to AOP
  • Maximum benefit with minimal theory
  • PostSharp and Castle DynamicProxy

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Author

Matthew D. Groves is a developer with over ten years of professional experience working with C#, ASP.NET, JavaScript, and PHP.

Table of Contents
    Introducing AOP
  1. Acme Car Rental
  2. Call this instead: intercepting methods
  3. Before and after: boundary aspects
  4. Get this instead: intercepting locations
  5. Unit testing aspects
  6. AOP implementation types
  7. Using AOP as an architectural tool
  8. Aspect composition: example and execution
49.99 In Stock
AOP in .NET: Practical Aspect-Oriented Programming

AOP in .NET: Practical Aspect-Oriented Programming

by Matthew D. Groves
AOP in .NET: Practical Aspect-Oriented Programming

AOP in .NET: Practical Aspect-Oriented Programming

by Matthew D. Groves

Paperback(1st Edition)

$49.99 
  • SHIP THIS ITEM
    In stock. Ships in 6-10 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Summary

AOP in .NET introduces aspect-oriented programming to .NET developers and provides practical guidance on how to get the most benefit from this technique in your everyday coding. The book's many examples concentrate on modularizing non-functional requirements that often sprawl throughout object-oriented projects. Even if you've never tried AOP before, you'll appreciate the straightforward introduction using familiar C#-based examples. AOP tools for .NET have now reached the level of practical maturity Java developers have relied on for many years, and you'll explore the leading options, PostSharp, and Castle DynamicProxy.

About the Technology

Core concerns that cut across all parts of your application, such as logging or authorization, are difficult to maintain independently. In aspect-oriented programming (AOP) you isolate these cross-cutting concerns into their own classes, disentangling them from business logic. Mature AOP tools like PostSharp and Castle DynamicProxy now offer .NET developers the level of support Java coders have relied on for years.

About this Book

AOP in .NET introduces aspect-oriented programming and provides guidance on how to get the most practical benefit from this technique. The book's many examples concentrate on modularizing non-functional requirements that often sprawl throughout object-oriented projects. You'll appreciate its straightforward introduction using familiar C#-based examples.

This book requires no prior experience with AOP. Readers should know C# or another OO language.

What's Inside
  • Clear and simple introduction to AOP
  • Maximum benefit with minimal theory
  • PostSharp and Castle DynamicProxy

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

About the Author

Matthew D. Groves is a developer with over ten years of professional experience working with C#, ASP.NET, JavaScript, and PHP.

Table of Contents
    Introducing AOP
  1. Acme Car Rental
  2. Call this instead: intercepting methods
  3. Before and after: boundary aspects
  4. Get this instead: intercepting locations
  5. Unit testing aspects
  6. AOP implementation types
  7. Using AOP as an architectural tool
  8. Aspect composition: example and execution

Product Details

ISBN-13: 9781617291142
Publisher: Manning
Publication date: 06/28/2013
Edition description: 1st Edition
Pages: 296
Product dimensions: 7.30(w) x 9.10(h) x 0.70(d)

About the Author

Matthew D. Groves is a developer with over 10 years of professional experience in education, consulting, and product development. He concentrates on web applications, using C# with ASP.NET, JavaScript, and PHP.

Table of Contents

Foreword xiii

Preface xv

Acknowledgments xvii

About this book xix

Part 1 Getting Started With AOP 1

1 Introducing AOP 3

1.1 What is AOP? 4

Features 4

Benefits 8

AOP in your daily life 13

1.2 Hello, World 14

1.3 Summary 19

2 Acme Car Rental 21

2.1 Start a new project 22

Business requirements 23

Necessary nonfunctional requirements 24

2.2 Life without AOP 24

Write the business logic 25

Testing the business logic 28

Add logging 29

Introducing defensive programming 31

Working with transactions and retries 32

Handling exceptions 35

Refactor without AOP 38

2.3 The cost of change 43

Requirements will change 43

Small versus large projects 43

Signature changes 44

Working on a learn 45

2.4 Refactor with AOP 45

Start simple and isolate the logging 45

Refactor defensive programming 47

Creating an aspect for transactions and retries 49

Put exception handling into its own class 50

2.5 Summary 52

Part 2 The Fundamentals of AOP 53

3 Call this instead: intercepting methods 55

3.1 Method interception 56

PostSharp method interception 57

Castle DynamicProxy method interception 60

3.2 Real-world example: data transactions 63

Ensuring data integrity with begin and commit 63

When transactions go bad: rollback 67

When all else fails, retry 67

3.3 Real-world example: threading 70

The basics of.NET threading 70

UI threads and worker threads 71

Declarative threading with AOP 74

3.4 Summary 77

4 A Before and after: boundary aspects 79

4.1 Boundary aspects 80

PostSharp method bounding 80

Method boundaries versus method interception 83

ASP.NET HttpModule bounding 88

4.2 Real-world example: detecting mobile users 92

Offer a link to an application 93

Don't be a pest 99

4.3 Real-world example: caching 100

ASP.NET Cache 102

An application that could benefit from caching 103

Caching a result 108

Retrieving from the cache 110

A more robust cache key 113

4.4 Summary 114

5 Get this instead: intercepting locations 115

5.1 Location interception 116

Fields and properties in .NET 116

PostSharp location interception 118

5.2 Real-world example: lazy loading 119

Lazy loading approaches in .NET 120

Implementing lazy loading with AOP 121

What about lazy-loading fields? 124

5.3 Real-world example: INotifyPropertyChanged 128

Using INotifyPropertyChanged in a desktop application 128

Problems and constraints with INotifyPiopertyChanged 132

Reducing boilerplate with AOP 134

5.4 Summary 138

6 Unit testing aspects 141

6.1 Writing tests with NUnit 142

Writing and running NUnit tests 142

Testing strategies for aspects 145

6.2 Castle DynamicProxy testing 147

Testing an interceptor 147

Injecting dependencies 149

6.3 PostSharp testing 156

Unit testing a PostSharp aspect 157

Injecting dependencies 158

Problems with PostSharp and testing 162

6.4 Summary 168

Part 3 Advanced AOP Concepts 169

7 AOP implementation types 171

7.1 How does AOP work? 172

7.2 Runtime weaving 172

Proxy pattern revisited 173

Dynamic proxies 176

7.3 Compile-time weaving 183

Postcompiling 184

Before and after 184

7.4 Runtime versus compile-time weaving 188

Pros of runtime weaving 189

Pros of compile-time weaving 189

7.5 Summary 190

8 Using AOP as an architectural tool 191

8.1 Compile-time initialization and validation 192

Initializing at compile lime 193

Validating the correct use of an aspect 195

Real-world example: Threading revisited 197

8.2 Architectural constraints 199

Enforcing architecture 200

Real-world example: NHibernate and virtual 203

8.3 Multicasting 205

At the class level 206

At the assembly level 210

8.4 Summary 211

9 Aspect composition: example and execution 213

9.1 Using multiple aspects 214

9.2 Aspect roles with PostSharp 215

PostSharp aspect roles 217

Role dependencies 217

9.3 Composing aspects with DynamicProxy 219

Ordering aspects 219

Reducing repetition with custom conventions 222

9.4 Real-world example: caching and authorization 224

Application architecture 225

PostSharp 232

Castle DynamicProxy 236

9.5 Summary 241

Appendix A Ecosystem of .NETAOP tools 243

Appendix B NuGet basics 257

Index 265

From the B&N Reads Blog

Customer Reviews