http://qs321.pair.com?node_id=215812


in reply to Re: Re: Re: My coding guidelines
in thread My coding guidelines

In my defence, my guidelines were aimed at novice CGI programmers with many rules dictated by unofficial conventions that are used in our shop. This list is obviously more broadly aimed and as a style guide seems ok. Abigail pointed out my list omitted API/object interface guidelines and object initializators but so does this one:)

Abigail asked WHY? on two of my points so here are my justifications for them

'15. Always retrieve database rows into hash reference not arrays'

because if you have a table with fifty columns then you get an array with fifty elemnets and it can be hard to remember what field element 27 refers to after the array has been shunted about a bit. Also you have to manually map all the elements to the field names whereas with a hash you already have the data labelled with the field names.

'17. Assign CGI parameters to hashes'

So you can pass them around easily in one variable and you don't have loads of variables and $q->params flying about.

I also refute the fact I used any buzzwords. Anyway the more guidelines the better I say, as long as people don't treat them religiously.