Making Quality .NET Applications Fast and Bug Free Chris Love ProfessionalASPNET.com Twitter.com/ChrisLove FaceBook.com/Pr...
 
Code Complete  *  The Art of Unit Testing * Pragmatic Programmer
<ul><li>Built over 300 ASP.NET sites </li></ul><ul><ul><li>Required Speed to Market </li></ul></ul><ul><ul><li>Reduced Num...
<ul><li>Bigger  – Solid Application Architecture </li></ul><ul><li>Stronger  Sites – Fewer Bugs </li></ul><ul><li>Faster  ...
<ul><li>Build Orthogonal Applications </li></ul><ul><li>True Layers </li></ul><ul><li>Don’t Repeat Yourself (DRY) </li></u...
<ul><li>Eliminate Effects between Unrelated </li></ul><ul><li>Reduce Risks </li></ul><ul><li>Testing </li></ul>
<ul><li>protected void btnCalc_Click(object sender, EventArgs e) </li></ul><ul><li>{ </li></ul><ul><li>// Line after line ...
<ul><li>protected void btnCalc_Click(object sender, EventArgs e) </li></ul><ul><li>{ </li></ul><ul><li>BusinessClass.DoWor...
<ul><li>Data – SQL </li></ul><ul><li>Business – C#/VB.NET </li></ul><ul><li>UI </li></ul><ul><ul><li>HTML </li></ul></ul><...
<ul><li>public CustomEntity GetCustomEntity(int CustomEntityID, bool IsActive) </li></ul><ul><li>{ </li></ul><ul><li>SqlDa...
<ul><li>public ICustomEntity GetCustomEntity(int vCustomEntityId) </li></ul><ul><li>{ </li></ul><ul><li>CustomEntity lCust...
<ul><li>ADO.NET - DAAB </li></ul><ul><ul><li>ExecuteNonQuery </li></ul></ul><ul><ul><li>ExecuteReader </li></ul></ul><ul><...
<ul><li>public SqlDataReader ExecuteReader(string sProc, CommandType ct, SqlParameter[] arParam) </li></ul><ul><li>{ </li>...
<ul><li>Linq </li></ul><ul><ul><li>FirstOrDefault(ObjectQuery<TEntity>) </li></ul></ul><ul><ul><li>ToList(ObjectQuery<TEnt...
<ul><li>TEntity ExecuteFirstOrDefault(ObjectQuery<TEntity> objQuery){ </li></ul><ul><li>//Custom Work… </li></ul><ul><li>r...
<ul><li>Automated Testing </li></ul><ul><ul><li>Unit Testing </li></ul></ul><ul><ul><li>Integration </li></ul></ul><ul><ul...
<ul><li>No Excuses Anymore </li></ul><ul><li>It’s not that hard </li></ul><ul><li>Requires a slight  Paradigm Shift </li><...
<ul><li>Refactor Coding Methodologies </li></ul><ul><li>Small Units of Work that can be independently Tested </li></ul><ul...
<ul><li>Testing a Complete Unit of Work </li></ul><ul><li>Typically including Dependencies like Databases and the File Sys...
<ul><li>Automated Tools to Automatically Test Application </li></ul>
<ul><li>CodeRush, Refactor, R# </li></ul><ul><li>Code Generators </li></ul><ul><ul><li>Code Smith </li></ul></ul><ul><ul><...
Upcoming SlideShare
Loading in...5
×

Bigger Stronger Faster

598

Published on

Things I have learned over the years through experience of having to deliver code rapidly, with few defects and maximum functionality. I cover basic coding techniques, automated testing and sometimes I have enough time to review tools and code generation!

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
598
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Bigger Stronger Faster

  1. 1. Making Quality .NET Applications Fast and Bug Free Chris Love ProfessionalASPNET.com Twitter.com/ChrisLove FaceBook.com/ProfessionalASPNet
  2. 3. Code Complete * The Art of Unit Testing * Pragmatic Programmer
  3. 4. <ul><li>Built over 300 ASP.NET sites </li></ul><ul><ul><li>Required Speed to Market </li></ul></ul><ul><ul><li>Reduced Number of Potential Bugs </li></ul></ul><ul><ul><li>Ease to Maintain and Extend </li></ul></ul><ul><ul><li>Ability to Adjust on a Dime </li></ul></ul>
  4. 5. <ul><li>Bigger – Solid Application Architecture </li></ul><ul><li>Stronger Sites – Fewer Bugs </li></ul><ul><li>Faster – Confidently Create Code Faster </li></ul>
  5. 6. <ul><li>Build Orthogonal Applications </li></ul><ul><li>True Layers </li></ul><ul><li>Don’t Repeat Yourself (DRY) </li></ul><ul><li>Build a Knowledge Portfolio </li></ul>
  6. 7. <ul><li>Eliminate Effects between Unrelated </li></ul><ul><li>Reduce Risks </li></ul><ul><li>Testing </li></ul>
  7. 8. <ul><li>protected void btnCalc_Click(object sender, EventArgs e) </li></ul><ul><li>{ </li></ul><ul><li>// Line after line of business logic </li></ul><ul><li>// ... </li></ul><ul><li>} </li></ul>
  8. 9. <ul><li>protected void btnCalc_Click(object sender, EventArgs e) </li></ul><ul><li>{ </li></ul><ul><li>BusinessClass.DoWork(...); </li></ul><ul><li>} </li></ul>
  9. 10. <ul><li>Data – SQL </li></ul><ul><li>Business – C#/VB.NET </li></ul><ul><li>UI </li></ul><ul><ul><li>HTML </li></ul></ul><ul><ul><li>JS/AJAX </li></ul></ul><ul><ul><li>CSS </li></ul></ul><ul><li>Knowledge of Http </li></ul>
  10. 11. <ul><li>public CustomEntity GetCustomEntity(int CustomEntityID, bool IsActive) </li></ul><ul><li>{ </li></ul><ul><li>SqlDatabase sqlDb = new SqlDatabase(siteConnectionString); </li></ul><ul><li>DbCommand dbCommand = sqlDb.GetStoredProcCommand(&quot;spGetCustomEntity&quot;); </li></ul><ul><li>CustomEntity custEntity = new CustomEntity(); </li></ul><ul><li>sqlDb.AddInParameter(dbCommand, &quot;@CustomEntityID&quot;, DbType.Int32, CustomEntityID); </li></ul><ul><li>sqlDb.AddInParameter(dbCommand, &quot;@IsIncident&quot;, DbType.Boolean, IsIncident); </li></ul><ul><li>using (IDataReader dr = sqlDb.ExecuteReader(dbCommand)) </li></ul><ul><li>{ </li></ul><ul><li>while (dr.Read()) </li></ul><ul><li>{ </li></ul><ul><li>//... </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>return custEntity; </li></ul><ul><li>} </li></ul>
  11. 12. <ul><li>public ICustomEntity GetCustomEntity(int vCustomEntityId) </li></ul><ul><li>{ </li></ul><ul><li>CustomEntity lCustomEntity = null; </li></ul><ul><li>using (SafeDataReader dr = new SafeDataReader( </li></ul><ul><li>ExecuteReader(&quot;spGetCustomEntity&quot;, CommandType.StoredProcedure, &quot;@CustomEntityID&quot;, vCustomEntityId))) </li></ul><ul><li>{ </li></ul><ul><li> lCustomEntity = CustomEntityRepositoryHelper.BindCustomEntity(dr, true, this); </li></ul><ul><li>} </li></ul><ul><li>return lCustomEntity; </li></ul><ul><li>} </li></ul>
  12. 13. <ul><li>ADO.NET - DAAB </li></ul><ul><ul><li>ExecuteNonQuery </li></ul></ul><ul><ul><li>ExecuteReader </li></ul></ul><ul><ul><li>ExecuteScalar </li></ul></ul><ul><ul><li>ExecuteDataSet </li></ul></ul>
  13. 14. <ul><li>public SqlDataReader ExecuteReader(string sProc, CommandType ct, SqlParameter[] arParam) </li></ul><ul><li>{ </li></ul><ul><li>Database database = DatabaseFactory.CreateDatabase(ConnectionString); </li></ul><ul><li>DbCommand storedProcCommand = database.GetStoredProcCommand(sProc); </li></ul><ul><li>if (null != arParam) </li></ul><ul><li>{ </li></ul><ul><li>foreach (SqlParameter parameter in arParam) </li></ul><ul><li>{ </li></ul><ul><li>database.AddInParameter(storedProcCommand, parameter.ParameterName, </li></ul><ul><li>parameter.DbType, parameter.Value); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>return (SqlDataReader)database.ExecuteReader(storedProcCommand); </li></ul><ul><li>} </li></ul>
  14. 15. <ul><li>Linq </li></ul><ul><ul><li>FirstOrDefault(ObjectQuery<TEntity>) </li></ul></ul><ul><ul><li>ToList(ObjectQuery<TEntity>) </li></ul></ul><ul><ul><li>ToDictionary(ObjectQuery<TEntity>) </li></ul></ul><ul><ul><li>ToArray(ObjectQuery<TEntity>) </li></ul></ul>
  15. 16. <ul><li>TEntity ExecuteFirstOrDefault(ObjectQuery<TEntity> objQuery){ </li></ul><ul><li>//Custom Work… </li></ul><ul><li>return objQuery.FirstOrDefault(); </li></ul><ul><li>} </li></ul>
  16. 17. <ul><li>Automated Testing </li></ul><ul><ul><li>Unit Testing </li></ul></ul><ul><ul><li>Integration </li></ul></ul><ul><ul><li>Web/Acceptance Testing </li></ul></ul>
  17. 18. <ul><li>No Excuses Anymore </li></ul><ul><li>It’s not that hard </li></ul><ul><li>Requires a slight Paradigm Shift </li></ul><ul><li>Requires More Time Up Front, but Reduces Ultimate Time to Market </li></ul>
  18. 19. <ul><li>Refactor Coding Methodologies </li></ul><ul><li>Small Units of Work that can be independently Tested </li></ul><ul><li>Mocking, IoC </li></ul>
  19. 20. <ul><li>Testing a Complete Unit of Work </li></ul><ul><li>Typically including Dependencies like Databases and the File System </li></ul><ul><li>A Common Way To Ease into Automated Testing </li></ul>
  20. 21. <ul><li>Automated Tools to Automatically Test Application </li></ul>
  21. 22. <ul><li>CodeRush, Refactor, R# </li></ul><ul><li>Code Generators </li></ul><ul><ul><li>Code Smith </li></ul></ul><ul><ul><li>Code Breeze </li></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×