Try our conversational search powered by Generative AI!

K Khan
Aug 27, 2014
  3795
(3 votes)

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

Comments

valdis
valdis Aug 27, 2014 10:12 PM

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
K Khan Aug 28, 2014 10:47 AM

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

Justin Le
Justin Le Aug 29, 2014 08:47 AM

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

K Khan
K Khan Aug 29, 2014 09:44 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
K Khan Sep 5, 2014 03:24 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
Arild Henrichsen Sep 8, 2014 10:27 AM

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
K Khan Sep 8, 2014 10:39 AM

Inspiring ... Inspiring ...

Please login to comment.
Latest blogs
Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024

What's new in Language Manager 5.3.0

In Language Manager (LM) version 5.2.0, we added an option in appsettings.json called TranslateOrCopyContentAreaChildrenBlockForTypes . It does...

Quoc Anh Nguyen | Apr 15, 2024