Foundations of Programming free ebook
http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx
Table of Contents
Goals....................................8
Simplicity..................................8
YAGNI....................................8
Last Responsible Moment............................9
Coupling...................................9
Domain Driven Design..............................11
Domain/Data Driven Design...........................11
Users, Clients and Stakeholders ..........................12
The Domain Object ..............................13
UI.....................................15
Tricks and Tips ................................16
Factory Pattern...............................16
Access Modifiers..............................17
Interfaces .................................17
Information Hiding and Encapsulation......................18
In This Chapter................................19
Persistence..................................20
The Gap..................................20
DataMapper .................................20
We have a problem.............................23
Limitations................................24
In This Chapter................................25
Dependency Injection ..............................26
Sneak Peak at Unit Testing............................27
Don’t avoid Coupling like the Plague ........................28
Constructor Injection.............................28
Frameworks................................30
A Final Improvement.............................32
In This Chapter................................33
Unit Testing..................................34
Why Wasn't I Unit Testing 3 Years Ago?.......................35
The Tools..................................36
nUnit..................................36
DRY
Explicitness and Cohesion
Unit Tests and Continuous Integration
In This Chapter
Dependency Injection
What is a Unit Test..............................38
Mocking ..................................38
More on nUnit and RhinoMocks..........................41
UI and Database Testing............................42
In This Chapter................................42
Object Relational Mappers............................43
Infamous Inline SQL vs. Stored Procedure Debate ...................43
Configuration...............................46
Relationships ...............................49
Querying .................................50
Lazy Loading................................51
Download..................................52
In This Chapter................................52
Back to Basics: Memory.............................53
Memory Allocation..............................53
The Stack.................................53
The Heap.................................54
Pointers.................................55
Memory Model in Practice............................57
Boxing..................................57
ByRef..................................58
Managed Memory Leaks ...........................61
Fragmentation ...............................61
Pinning..................................62
Setting things to null .............................63
Deterministic Finalization ............................63
In This Chapter................................63
Back to Basics: Exceptions.............................64
Handling Exceptions ..............................64
Logging..................................65
Cleaning Up ................................65
Throwing Exceptions ..............................67
Throwing Mechanics .............................67
When To Throw Exceptions ..........................68
Creating Custom Exceptions ...........................69
In This Chapter................................72
Back to Basics: Proxy This and Proxy That.......................73
Proxy Domain Pattern .............................74
Interception.................................75
In This Chapter................................77
Wrapping It Up .................................78
