Coding Case Styles: Camel, Snake and CamelSnake
If you are a SWE, you should be familar with Coding case styles like Camel. If you are a python programmer, you should use lots of Snake coding style to name your variables.
Here I am going to introduce the CamelSnake name style as shown in the following example
Suppose we have a Traveling salesman problem, we have the start city, end city and cost. We wanna save a dictionary (map) with the key as (start, end) and value as cost., we will have:
- Camel: startEndCost
- Snake: start_end_cost
- CamelSnake: startEnd_cost
Personally, I feel that the third way may be more clean as it separates the different part by using underscore and for each part, a camel style is used for a clearer naming. Not sure whether this can be a good style to use.
I am starting to use the CamelSnake coding style when solving some problems, for example, in this article, I am using: startEnd_pro to name a vector of pair<pair<int, int>, int>.
Thanks for your time to read this article. Put your comments if you think the CamelSanke is a good practice or bad.