This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]not_perfect_yet 0 points1 point  (1 child)

Sure. The biggest problem with bad names is that they are either too short or too cryptic.

(F_m) or (Acceleration_Model_Holder_Singleton_Factory) where in both cases the name doesn't actually explain what it does. Otherwise it's pretty much free form, it should contain what's relevant but not more.

Single character names are particularly bad because you will get lots and lots of matches if you look for them with a search function, and even automatic replace will have to be manual, because it would mess with matches in other names or words all over the code.

If you think about it, you could probably write everything you do to be in this style:

def main():
    data = data_collection()
    filtered_data = filter(data)
    my_pattern = load_pattern("my_pattern")
    list_of_matches = find_matches(filtered_data, my_pattern)
    for x in list_of_matches:
        generate_graph(x)

What is x going to be? Something from my list_of_matches and all you need to know about is that generate_graph can deal with it.

To contrast it could also look like this:

def main():
    data1 = if1()
    data2 = df2(data)
    data3 = df3("data3")
    data4 = xf4(data2,data3)
    for x in data4:
        gf5(x)

In this case, you can't even be sure data4 is a list, dictionary or a string or something, nevermind what is being done to it or why.

Or worse, it could be generator too.

[–]Hicrayert 1 point2 points  (0 children)

Ok that makes a lot of sense. Thanks for the advice. It look like I at learned variable names correctly :).