naming-conventions

how to deal with numbers in camelcase naming policy?

微笑、不失礼 提交于 2020-08-01 06:39:07
问题 Can anyone tell me how to rename variables like play_size_32 , play_url_24_m4a in camelcase naming policy? I am deserializing json string, but I don't know how to deal with such variable names. 回答1: playSize32, playUrl24M4a I agree that camel case is not great when dealing with numbers, you should try to avoid variables names containing them 来源: https://stackoverflow.com/questions/37496068/how-to-deal-with-numbers-in-camelcase-naming-policy

coding style checker for c (variable names, not indentation)

左心房为你撑大大i 提交于 2020-06-25 07:30:09
问题 This question asks about a coding style checker, but the focus seems to be on indentation and brace placement. GNU indent deals with indentation (which isn't a problem in this code base, amazingly enough). I'm working with a pile of code that is full of various naming schemes: camelCase, everythingruntogetherinlowercase, underscores_as_separators, SomeStructsEndWithT, etc. I'd like to be able to pick a convention and at least have an automatic check that new changes are in line with the

Best Practice for Naming the Id Attribute of Dom Elements

邮差的信 提交于 2020-06-24 06:11:06
问题 This is related to naming conventions for a DOM element's id attribute and I guess the name attribute as well. When it comes to JavaScript, from what I understand and have done is always use camel case except for the names of classes. Classes are Pascal cased. Having said that I develop in ASP.NET mainly and here's where I run into a naming issue for the id attribute. In ASP.NET if you drag and drop a new server control to a page(which I rarely do, I'm a type the markup kinda guy), the

Why does pylint object to single character variable names?

拜拜、爱过 提交于 2020-06-24 01:52:32
问题 I'm still getting used to python conventions and using pylint to make my code more pythonic, but I'm puzzled by the fact that pylint doesn't like single character variable names. I have a few loops like this: for x in x_values: my_list.append(x) and when I run pylint , I'm getting Invalid name "x" for type variable (should match [a-z_][a-z0-9_]{2,30} -- that suggests that a valid variable name must be between 3 and 31 characters long, but I've looked through the PEP8 naming conventions and I

Why does pylint object to single character variable names?

喜你入骨 提交于 2020-06-24 01:51:43
问题 I'm still getting used to python conventions and using pylint to make my code more pythonic, but I'm puzzled by the fact that pylint doesn't like single character variable names. I have a few loops like this: for x in x_values: my_list.append(x) and when I run pylint , I'm getting Invalid name "x" for type variable (should match [a-z_][a-z0-9_]{2,30} -- that suggests that a valid variable name must be between 3 and 31 characters long, but I've looked through the PEP8 naming conventions and I

Python Naming Conventions for Dictionaries/Maps/Hashes

这一生的挚爱 提交于 2020-06-09 08:08:11
问题 While other questions have tackled the broader category of sequences and modules, I ask this very specific question: "What naming convention do you use for dictionaries and why?" Some naming convention samples I have been considering: # 'value' is the data type stored in the map, while 'key' is the type of key value_for_key={key1:value1, key2,value2} value_key={key1:value1, key2,value2} v_value_k_key={key1:value1, key2,value2} Don't bother answering the 'why' with "because my work tells me to

Naming convention for components and namespaces in cmake

假如想象 提交于 2020-05-22 05:42:26
问题 In Short: Is there any preferred naming convention for cmake library targets - in particular when using namespaces? Note: Unless there is really an objective reason for it, I'm not asking about personal preferences, but whether there is either an "official" (e.g. recommended by kitware) or established (which might deviate) convention. Details: Lets say I have a library/framework foo which has the individual components bar and baz . So far, my naming convention looks like this: add_library(foo

Naming convention for components and namespaces in cmake

风流意气都作罢 提交于 2020-05-22 05:41:03
问题 In Short: Is there any preferred naming convention for cmake library targets - in particular when using namespaces? Note: Unless there is really an objective reason for it, I'm not asking about personal preferences, but whether there is either an "official" (e.g. recommended by kitware) or established (which might deviate) convention. Details: Lets say I have a library/framework foo which has the individual components bar and baz . So far, my naming convention looks like this: add_library(foo

Naming convention for components and namespaces in cmake

∥☆過路亽.° 提交于 2020-05-22 05:40:00
问题 In Short: Is there any preferred naming convention for cmake library targets - in particular when using namespaces? Note: Unless there is really an objective reason for it, I'm not asking about personal preferences, but whether there is either an "official" (e.g. recommended by kitware) or established (which might deviate) convention. Details: Lets say I have a library/framework foo which has the individual components bar and baz . So far, my naming convention looks like this: add_library(foo

Scala getters/setters - best practice?

雨燕双飞 提交于 2020-05-12 12:10:13
问题 I'm Java SE/EE developer, but beginner in Scala. In Java, when I have some private fields which should be accessible to other code, I use getX() / setX() classic style of getters/setters. However, not sure how about Scala. I noticed that in Scala, naming convention of getter/setter for field is to use the same name as the field's one. So is it OK to simply set the field public , or should I use this style of getter/setter?: private var _value = ..... def value = _value def value_= (newVal:Int