Document your code!

I recently worked for client who wanted their code written a particular way. Okay no problem...

So they let me take a look at a previous (but unrelated) project they had worked on. At which point, things became more complicated... The project was undocumented and the code was clever, terse, and completely un-commented...

The result being that I had to 'reverse engineer' their previous project, to get a handle on their methods. Something that, had there been a project document, wouldn't have been necessary!

So, for the sake of maintainability and sanity of the poor bugger parachuted in to help you with your code.... Please document your projects and comment your code!

Below is an example of commented and un-commented code. Imagine hundreds or thousands of lines of code without any documentation or comments!

 Code without comments

var contentService = Services.ContentService;
var eventNode = contentService.CreateContent(
eventName,1105, UmbracoConstants.DocumentTypeAlias.EventItem,0);

 

Commented code

//======== create a new classified node using doc type - EventItem ============
// Get the Umbraco Content Service
var contentService = Services.ContentService;
var eventNode = contentService.CreateContent(
eventName, // the name of the event from Soap Call
1105, // the parent id should be the id of the group node 
UmbracoConstants.DocumentTypeAlias.EventItem, // the alias of the product Document Type
0);

// We need to update properties (propertyType, content from Soap call)

 

 

About Us

WJP Media creates 'Full-Stack' websites and 'SPA' - single page web applications, which allow cont…

Full -Stack Dev

'Full-Stack' development, refers to a developer (or developers), who are just as comfortable working…

Single Page Apps

The rise of the one web page application.

There is a big increase in the rise of 'one page' web app…

Umbraco Dev

In today's online environment the ability to easily modify and update your website is crucial. Umbra…