bigger stronger faster
DESCRIPTION
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!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
- StrongerSites Fewer Bugs
- Faster Confidently Create Code Faster
6.
- Build Orthogonal Applications
- True Layers
- Dont 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)
-
- ToList(ObjectQuery)
-
- ToDictionary(ObjectQuery)
-
- ToArray(ObjectQuery)
16.
- TEntity ExecuteFirstOrDefault(ObjectQuery objQuery){
- //Custom Work
- return objQuery.FirstOrDefault();
- }
17.
- Automated Testing
-
- Unit Testing
-
- Integration
-
- Web/Acceptance Testing
18.
- No Excuses Anymore
- Its not that hard
- Requires a slightParadigm 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