Foundations of Programming - Karl Seguin
Foundations of Programming - Karl Seguin
Foundations of Programming - Karl Seguin
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Foundations</strong> <strong>of</strong> <strong>Programming</strong><br />
What is a Unit Test ........................................................................................................................38<br />
Mocking .......................................................................................................................................38<br />
More on nUnit and RhinoMocks.....................................................................................................41<br />
UI and Database Testing ................................................................................................................42<br />
In This Chapter..............................................................................................................................42<br />
Object Relational Mappers ................................................................................................................43<br />
Infamous Inline SQL vs. Stored Procedure Debate ...........................................................................43<br />
NHibernate ...................................................................................................................................46<br />
Configuration............................................................................................................................46<br />
Relationships ............................................................................................................................49<br />
Querying ..................................................................................................................................50<br />
Lazy Loading .............................................................................................................................51<br />
Download .....................................................................................................................................52<br />
In This Chapter..............................................................................................................................52<br />
Back to Basics: Memory ....................................................................................................................53<br />
Memory Allocation........................................................................................................................53<br />
The Stack ..................................................................................................................................53<br />
The Heap ..................................................................................................................................54<br />
Pointers ....................................................................................................................................55<br />
Memory Model in Practice.............................................................................................................57<br />
Boxing ......................................................................................................................................57<br />
ByRef........................................................................................................................................58<br />
Managed Memory Leaks ...........................................................................................................61<br />
Fragmentation ..........................................................................................................................61<br />
Pinning .....................................................................................................................................62<br />
Setting things to null .................................................................................................................63<br />
Deterministic Finalization ..............................................................................................................63<br />
In This Chapter..............................................................................................................................63<br />
Back to Basics: Exceptions .................................................................................................................64<br />
Handling Exceptions ......................................................................................................................64<br />
Logging.....................................................................................................................................65<br />
Cleaning Up ..............................................................................................................................65<br />
Throwing Exceptions .....................................................................................................................67<br />
Throwing Mechanics .................................................................................................................67<br />
When To Throw Exceptions .......................................................................................................68<br />
Creating Custom Exceptions ..........................................................................................................69<br />
In This Chapter..............................................................................................................................72<br />
Back to Basics: Proxy This and Proxy That...........................................................................................73<br />
Proxy Domain Pattern ...................................................................................................................74<br />
Interception..................................................................................................................................75<br />
In This Chapter..............................................................................................................................77<br />
Wrapping It Up .................................................................................................................................78<br />
<strong>Foundations</strong> <strong>of</strong> <strong>Programming</strong> Copyright © <strong>Karl</strong> <strong>Seguin</strong> www.codebetter.com<br />
5