Naming Rule of public and private function | Elixir / Phoenix
I think the function name is based on snake case, many programmers seem to use it but just the snake case? I have another naming rule to distinguish the public function from the private.
For the public function, I just use low case alphabet and the snake case. And on the other side, I start with “_” for the private function.
Let’s imagine that If you ( I ) wanted to use the private function from other modules named ModuleB.
ModuleA._private_function()
The “_” we can see is just after “ModuleA”. I really feel creepy.
Let’s change that name along with my naming rule.
The “_private_function” actually must be changed to “private_function” by removing the first “_”, the function name itself is still strange one, though.
Hey, This really makes me a happy feeling! Not only the appearance in codes in terms of readable but also you won’t forget to change “defp” into “def”.