Views: 2289
Number of votes: 3
Average rating:

Code Standards and Software Quality

To maintain quality of software is a big concern when working with the big teams having different level of expertise or with offshore teams. There are many tools and techniques are available in software industry. I am very interested in knowing that what other Technology Masters are doing to maintain code standards and quality of the software.

StyleCop:

StyleCop provides value by enforcing a common set of style rules for C# code. StyleCop will continue to ship with a single, consistent set of rules, with minimal rule configuration allowed. Developers can implement their own rules if they so choose. StyleCop ships with the ability to seamlessly integrate with Visual Studio, MSBuild, TFS, etc. Developers are free to implement custom code to integrate StyleCop into other development and tooling environments also. StyleCop is free. You can download Here. It feels boring while working with the StyleCop, as you may have to fix 20-30 issues for no reason but soon you will use to and will start writing the code to match standards. It checks spellings also in summary.

Static Code Analysis:

There are a lot of commercial and free static code analysers are available in market. Is it important to you or not is a separate discussion. If you are using Visual Studio Premium, It comes with a built-in Code analyser, that can be turned on from Project properties and You can set any rule set that suits to you. While working with the EPiServer products upgrades can cause some issues e.g. we upgraded a Site to latest EPiServer Commerce and EPiServer Find versions and it started giving us code analysis issues because EPiServer Commerce dlls were compiled with a different version of EPiServer.CMS.Core and EPiServer Find CMS Integration dlls were compiled with EPiServer.CMS.Core. we have to overrule the rule to fix this Code analysis issue. It is simple to overrule in project file true ExtendedCorrectnessRules.ruleset true /assemblycomparemode:StrongNameIgnoringVersion

Code Reviews:

Review each and every piece of code after completion of Backlog Item by a Technical Lead or a Senior Developer.

Aug 27, 2014

valdis
(By valdis, 8/28/2014 12:12:41 AM)

Run code duplicate analysis from VS.
Enforce code formatting rules (layout, member names, etc).
Enforce unit-test coverage.
Spell checker for VS and for R# (each checks different areas in code) to avoid misspelled API.
On code reviews - it's great if tech lead can review every single PBI. Do it more regularly and follow-up with developer to reduce future frequency of such reviews.
Use common sense :)

K Khan
(By K Khan , 8/28/2014 12:47:53 PM)

Valdis Thanks for this addition, We usually use a template class file to enforce layouts
http://msdn.microsoft.com/en-gb/library/ms247121.aspx

Dzung Le
(By Dzung Le, 8/29/2014 10:47:24 AM)

Continuous integration or gated check-in will also help to reduce chance of breaking the build.

K Khan
(By K Khan , 8/29/2014 11:44:27 AM)

Thanks Dzung, on topic of CI/CD, I think EPiServer needs to do bit better (Some other CMS can web deploy itself.)

On start of project set your clear goals regarding Continuous Integration and Deployment.
e.g.
The build process should be totally automated.
The build process should result in a release package.
CI server should run all unit tests, code analysis and test code coverage every time the build is run.
How it will be notified to team and action required in result of failure. (can effects plans of project managers)
The deployment process can/should be totally automatic (Plan for QA,Staging.Live enviornments)
Rollback should also be fully automated.
It should always be possible to rollback an update (including DB, Settings including IIS Settings and files, etc.).

There are few good posts on this topic
http://world.episerver.com/Blogs/Anton-Kallenberg/Tags/Continuous-integration/

K Khan
(By K Khan , 9/5/2014 5:24:48 PM)

For reference : http://www.epinova.no/blog/arild-henrichsen/dates/2014/9/basic-xcopy-deployment-of-episerver-cms-75-to-a-windows-server-2012/
Thanks arlid for this guide.

Arild Henrichsen
(By Arild Henrichsen, 9/8/2014 12:27:58 PM)

You're welcome, Khurram :-)

In addition to what's mentioned above, at Epinova we have a pretty comprehensive QA system which is used both during development and during project reviews before launching a site.

The Epinova QA system for EPiServer projects (before CMS 7 came out) is described in detail here:
http://www.epinova.no/blog/Thomas-Leela/dates/2012/12/epinova-qa-checklist-for-episerver-cms-6-projects/
(That checklist is for back-end - we also have a similar checklist for front-end.)

Our QA system includes a big checklist of DOs and DON'Ts. A checklist like this is only useful if developers have it in their mindset throughout the entire development phase. It is NOT a quickfix at the end of a project.

Also, we have a lot of automated code tests which use the External Tools feature in Visual Studio. These find errors and inconsistencies that would be difficult and time-consuming to spot manually.
See the "Automated Visual Studio tools and CI tests" section in the link above.

K Khan
(By K Khan , 9/8/2014 12:39:31 PM)

Inspiring ... Inspiring ...

Please login to comment.