What naming convention do you prefer for internal procedure and UDF names?
Currently we go for:
Examples:
procedure internalProcedure private:
function functionExample returns integer private
procedures should be named for what they do:
deleteOrder()
printStatus()
functions should be named for what they return:
LoanInterestRate()
OrderTotal()
PollenCount()
and so on.
Robert martin wrote a whole book and runs a blog. With topics that cover this. I find his advice very good and he makes it a point to address a lot of the points and styles with DOs and DONTs.
Suggest you read the book if only just for the one section on naming. The rest of the book is great too.
procedures should be named for what they do:
deleteOrder()
printStatus()
functions should be named for what they return:
LoanInterestRate()
OrderTotal()
PollenCount()
and so on.
Gus,
Thanks! Nice and simple guideline.
About the casing, you do this on purpose?
I try to convince my fellow developers here as well that they should follow the rules Gus mentioned, but some folks simply cannot understand that I have difficulty grasping what a procedure does when it is named "orders".
I do believe that a good naming convention enforces better code quality. If you have a procedure that collects orders, recalculates discounts and then exports them to whatever, how on earth are you going to come up with a decent name for that. The answer is: you don't. You end up with a name like "orders". But in fact it tells you that your code block is way too large and that you should have split it up in at least 3 subprocedures: collectOrders, recalculateDiscounts and exportOrders.
Amen, Patrick! Amen!
You are absolutely right. I have the exact same discussions .
It's always difficult to come up with a name which covers 3000+ lines of code. LOL.
Gus' suggested convention is excellent.
Since no-one was in the mood for a flamewar :) here's a serious comment ...
This post on StackOverflow has a good set of approaches for naming logical methods and proeprties: softwareengineering.stackexchange.com/.../naming-of-bool-methods-is-vs-can-vs
Great post, Peter!
yes, good post, peter.
the important thing with any naming convention and the names created when using it is the effect its has on the mind of the /reader/. does it move him along on the path to understanding or does it lead him down the garden path? will it make him smarter or dumber?=
The Common Component Specification also has some coding conventions but I can't find a public link at the moment.and I get 404 on github.
It's written with OOABL classes in mind but I think some of it could be applied to procedural as well.
Maybe Peter has a link.