SKIP THE SHIPPING
Use code NOSHIP during checkout to save 40% on eligible eBooks, now through January 5. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This eBook includes the following formats, accessible from your Account page after purchase:
EPUB The open industry format known for its reflowable content and usability on supported mobile devices.
PDF The popular standard, used most often with the free Acrobat® Reader® software.
This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
Master powerful new approaches to web architecture, design, and user experience
This book presents a pragmatic, problem-driven, user-focused approach to planning, designing, and building dynamic web solutions. You’ll learn how to gain maximum value from Domain-Driven Design (DDD), define optimal supporting architecture, and succeed with modern UX-first design approaches. The author guides you through choosing and implementing specific technologies and addresses key user-experience topics, including mobile-friendly and responsive design. You’ll learn how to gain more value from existing Microsoft technologies such as ASP.NET MVC and SignalR by using them alongside other technologies such as Bootstrap, AJAX, JSON, and JQuery. By using these techniques and understanding the new ASP.NET Core 1.0, you can quickly build advanced web solutions that solve today’s problems and deliver an outstanding user experience.
Microsoft MVP Dino Esposito shows you how to:
Introduction xvii
PART I: UNDERSTANDING THE DOMAIN
Chapter 1: Conducting a thorough domain analysis 3
Domain-driven design to the rescue 4
Introducing design driven by the domain 4
Clearing up common misconceptions about DDD 4
Introducing the ubiquitous language 6
Creating a vocabulary of domain-specific terms 6
Keeping business and code in sync 8
Introducing the bounded context 10
Discovering bounded contexts 10
Implementing bounded contexts 12
Introducing context mapping 15
Examining relationships between bounded contexts 15
Introducing event storming 17
Having unlimited modeling space 17
Finding events in the domain 17
Leading the discussion 18
Summary 18
Chapter 2: Selecting the supporting architecture 19
It’s all about business logic 19
Examining the application logic 20
Examining the domain logic 21
Exploring patterns for the business logic 22
Using a single model 24
Exploring the elements of an object-oriented domain model 24
Putting business rules inside 26
Discovering aggregates 28
Exploring the role of domain services 30
Implementing command and query separation 32
Working with the Command and Query Separation principle 33
Implementing CQRS 36
Introducing message-based formulation 39
Ad-hoc infrastructure 39
Introducing event sourcing 43
Summary 46
Chapter 3: UX-driven design 47
Why a top-down approach is better than a bottom-up one 48
Foundation of the bottom-up approach 48
Planning with a top-down approach 50
Looking at user experience from an architectural perspective 52
UX is not UI 52
Explaining UXDD in three steps 55
Why UXDD is beneficial to nearly everybody 59
Summary 62
Chapter 4: Architectural options for a web solution 63
Assessing the available web solutions 64
Deciding on the best framework 64
Laying out a solution 65
Examining the role of ASP.NET Core 1.0 66
Considering ASP.NET as the starting point 66
Examining the architectural dependencies in ASP.NET Core 1.0 68
Exploring the reasons to choose ASP.NET Core 1.0 69
Determining if you should use ASP.NET Web Forms 72
Examining a common scenario 72
ASP.NET Web Forms at a glance 73
What’s still good with Web Forms 73
Why you should move away from Web Forms 74
Determining if you should use ASP.NET MVC 76
ASP.NET MVC at a glance 76
What’s good with ASP.NET MVC 77
Weak points of ASP.NET MVC 78
Examining the role of ASP.NET Web API 79
Moving from WCF to Web API 79
Comparing ASP.NET Web API and ASP.NET MVC 80
Talking about REST 82
Using Web API in ASP.NET Core 1.0 82
Single-page applications 83
Setting up a SPA 84
Hybrid SPA 84
Weak points of a SPA 85
Summary 85
Chapter 5: The layered architecture 87
Beyond classic three-tier systems 87
Working with a three-tier architecture today 88
Fifty shades of gray areas 89
The presentation layer 90
The user experience 90
The input model 91
The view model 92
The application layer 92
Entry point in the system’s back end 93
Orchestration of business processes 94
The domain layer 95
The mythical domain model 95
The equally mythical concept of domain services 96
A more pragmatic view of domain modeling 96
The infrastructure layer 97
Current state storage 97
Event stores 98
Caching layers 99
External services 99
Summary 100
PART II: DEVELOPMENT
Chapter 6: ASP.NET state of the art 103
Web flavors 103
The web could have been different 104
Classic web is the winner 104
ASP.NET is feature-complete 105
No more to add is no more to add 105
Is it full potential or software obsolescence? 106
ASP.NET Core 1.0 has no new functions 106
It’s about the new runtime 106
It’s about the business model 107
It’s about the development model 107
What is the state of ASP.NET? 108
Chapter 7: Whys, wherefores, and technical aspects of ASP.NET Core 1.0 109
The background of ASP.NET Core 110
The cost of a large memory footprint 110
Reconsidering the cloud as the silver bullet 111
Making the case for the necessity of a different programming model 111
The impact on everyday work 112
The ASP.NET Core runtime at a glance 113
The DNX host 113
Hosting web applications in DNX 115
ASP.NET Core HTTP pipeline 116
ASP.NET Core for ASP.NET developers 118
Creating a new project 118
Application startup 122
Application settings 126
Authentication 128
Other aspects of web programming 129
Summary 132
Chapter 8: Core of ASP.NET MVC 133
Routing incoming requests 134
Simulating the ASP.NET MVC runtime 134
Exploring the URL routing HTTP module 137
Using application routes 138
Exploring the controller class 145
Looking at aspects of a controller 145
Writing controller classes 147
Processing input data 152
Manual parameter binding 152
Model binding 153
Producing action results 158
Wrapping results 158
Returning HTML markup 160
Returning JSON content 167
Summary 169
Chapter 9: Core of Bootstrap 171
Bootstrap at a glance 171
LESS and the foundation of Bootstrap 172
Setting up Bootstrap 174
Putting Bootstrap into perspective 175
Responsive layouts 176
The grid system 176
Screen-based rendering 178
Taxonomy of today’s web elements 183
Restyling basic HTML elements 183
Restyling list HTML elements 193
A look at more advanced components 196
Bootstrap extensions 202
Autocompletion 202
Date picking 209
Custom components 211
Summary 215
Chapter 10: Organizing the ASP.NET MVC project 217
Planning the project solution 217
Mapping projects to the Layered Architecture pattern 218
Application startup 220
Examining application services 225
Adding in other assets 227
Creating presentation layouts 228
Serving resources more effectively 231
Working with Bundling 231
Using minification 236
Examining other aspects 238
Exploring error handling 238
Configuring user authentication 241
Summary 246
Chapter 11: Presenting data 247
Structuring an HTML view 247
Exploring the view model 247
Examining the page layout 250
Presenting the elements of a view 254
Displaying a list of data items 258
Creating a grid view 258
Adding paging capabilities 263
Adding scrolling capabilities to page elements 268
Adding a detail view 271
Popover views 271
Drill-down views 274
Summary 277
Chapter 12: Editing data 279
A common form for the login page 279
Presenting the form 279
Processing posted data 281
Input forms 284
The Post-Redirect-Get pattern 284
Form validation 286
Modal input forms 296
Quick tips for improving the user experience 304
Using date pickers is great, but... 305
Using autocompletion instead of long drop-down lists 307
Miscellaneous tips for large input forms 310
Summary 311
Chapter 13: Persistence and modeling 313
Examining the different flavors of a model 313
The persistence model 314
The domain model 315
The input model 317
The view model 318
Designing a persistence layer 319
Using an implicit and legacy data model 320
Using Entity Framework 322
The Repository pattern 326
Polyglot persistence 328
Polyglot persistence by example 329
Costs of polyglot persistence 330
Summary 332
PART III: USER EXPERIENCE
Chapter 14: Creating more interactive views 335
Exposing JSON content 336
Creating JSON endpoints 336
Negotiating content 339
Solving the cross-origin puzzle 340
Designing a Web API 344
Purpose of the ASP.NET Web API 344
Web API in the context of ASP.NET MVC 345
Securing a standalone Web API 346
Pulling content 349
The Ajax core 349
The jQuery tools 351
Binding data to the current DOM 354
Pushing content to the client 357
ASP.NET SignalR at a glance 358
Monitoring remote tasks 359
Other scenarios for ASP.NET SignalR 362
Summary 363
Chapter 15: Pros and cons of responsive design 365
Foundation of Responsive Web Design 365
A brief history of RWD 366
CSS media queries 366
RWD and device independence 371
Adapting RWD to non-desktop devices 373
Dealing with images 374
Dealing with fonts 376
Dealing with orientation 378
Summary 379
Chapter 16: Making websites mobile-friendly 381
Adapting views to the actual device 381
The best of HTML5 for mobile scenarios 382
Feature detection 384
Client-side device detection 386
A look into the future 389
Device-friendly images 390
The ImageEngine platform 390
Resizing images automatically 391
Serving device-friendly views 392
What’s the best way to offer mobile content? 392
Server-side detection 394
Summary 399
Index 401