When writing a Mathematica package Foo, with functions f1, f2 and f3, one can use the template:
BeginPackage["Foo`"];
f1::usage = "f1[] ....";
f2::usage = "f2[] ....";
Begin["`Private`"];
f1[]:= code for f1
f2[]:= code for f2
f3[]:= code for f3 (not visible as only in the private context)
End[];
EndPackage[];
What I do not like is when your package is growing, there can be a long "distance" (not fitting in your text editor) between "f1::usage" and the actual f1 code. This is error prone concerning coherence between doc and code. So I would like to group common stuff together.
My question is:
Is it possible and is it a good practice (without side effect) to group things like below?
BeginPackage["Foo`"];
Begin["`Private`"];
Foo`f1::usage = "f1[] ....";
Foo`f1[]:= code for f1
...
Foo`f2::usage = "f2[] ....";
Foo`f2[]:= code for f2
...
f3[]:= code for f3 (private as before)
End[]
EndPackage[];