Bigger Stronger Faster

  • 562 views
Uploaded 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 …

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!

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
562
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
2
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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