I'm refactoring a large procedure and now I'm getting lot's of small procedures, functions with lot's of parameters passed back and forth. And as I would like to keep same/similar performance and refactoring that is maintainable, I'm trying to understand what is best approach so I don't break the code.
This is most common how these new functions look:
function ProcessA(const ProjName,ProjPath:string;
ProjID:integer;
var ProjDest:string):string;
function ProcessB(const ProjName,ProjPath:string;
const ProjID,ProjHID,ProjGID:integer;
var ProjDest:string;
out ProjDelPath:string):string;
I read lots about const, var, out parameters. Should I order them first all const, then all normal, then var and last out...
Does the order of them matter, at all?
EDIT:
To clarify why the question or if someone uses the same this, I use IDE's Refactor/Extract Method feature that does a good job, but it makes no sense of parameters it puts in place. So, when I was reordering and changing parameter names, I saw the issue with no standard order of types of parameters.
The order of the kind of parameters doesn't matter, with one exception; Default parameters (like fn(AFloat: single; AInt:integer = 0): integer;
), which means you don't have to pass anything for AInt
if you are happy with the default value. These params have to be at the end of the parameter list, and can be omitted only from the end.
You can read more about parameters here.