I've been working on a Mathematica package (call it QuantumDot) that has become huge. Right now, all the back-end helper functions are in context QuantumDot`Private, and the WHOLE code is in one gigantic .m file.
I'd like to reorganize it so that QuantumDot has multiple sub-contexts corresponding, roughly, to each front-end function. I want to put all the back-end helper functions into these sub-contexts.
For example:
(*These are the main functions accessible to the user*)
QuantumDot`
MainFunction[x,y,z]
ComplexRoutine[x,y]
(*These are the backend helper functions*)
QuantumDot`MainFunction`
internalFunction[a,b,c]
addAndSubtract[a,b,c]
distribute[a,b,c]
...
QuantumDot`ComplexRoutine`
step1function[a,b,c]
step2function[a,b,c]
reducer[a,b,c]
...
I can achieve this by replacing in my existing code Begin["`Private`"] with Begin["`MainFunction`"], Begin["`ComplexRoutine `"],... as necessary.
BeginPackage["QuantumDot`"];
MainFunction::usage = "MainFunction[x,y,z] is a front-end function for users";
Begin["`MainFunction`"]; (* was Begin["`Private`"]; *)
internalFunction[a_,b_,c_] := a^2 - b^2 - c^2;
addAndSubtract[a_,b_,c_] := a + b - c;
distribute[a,b,c] := a(b+c)//Expand;
MainFunction[x_,y_,z_]:=internalFunction[x,y,z]+addAndSubtract[x,y,z](*...*);
End[];
Begin["`ComplexRoutine`"];
(*...*)
End[];
EndPackage[];
The problem is that the autocomplete picks up the back-end functions. (Apparently, there was something special with the "Private" context).
What can I do to prevent the autocompletion feature from displaying these internal functions?
I then intend to split my package into multiple
.mfiles according to the main functions of the package. Is this a reasonable way to proceed?

QuantumDot`Private`MainFunction`andQuantumDot`MainFunction`Private`are both valid contexts (called usingBegin["`MainFunction`Private`"]and its reverse), and neither of them gets displayed on autocomplete. That enables you to have further organization inside of Private contexts and still shield those symbols from eyes that shouldn't see them. – Emilio Pisanty May 23 '16 at 16:16