FAQ Database Discussion Community


Python naming convention: indicating if function alters arguments

python,coding-style,naming-conventions,pep8
I was wondering if there is a proper Python convention to distinguish between functions that either alter their arguments in place or functions that leave their arguments in tact and return an altered copy. For example, consider two functions that apply some permutation. Function f takes a list as an...

What is the naming convention for assembles template plugins?

naming-conventions,assemble,nunjucks
I'm creating a nunjucks plug-in for Assemble v0.6.0. It seems it's using Template(I think it was previously called Engine), which also powers Verb. should I be calling the plugin "engine-nunjucks", "template-nunjucks", "assemble-plugin-nunjucks", "assemble-nunjucks"? ...

REST convention for parent insert and parent + joinId insert using same endpoint

rest,uri,naming-conventions
In context of an event management system where speakers are talking at different sessions. My entities are Speakers and Sessions Let's say the endpoint is 1) POST /speakers (to insert detail of a speaker ONLY) 2) POST /speakers (to insert detail of speaker + id of the session he's talking...

When to use _ as a variable in Python?

python,variables,coding-style,naming-conventions
I recently discovered that I could use _ as a variable. Is there a particular protocol of when to use this as a variable name? Should __ ever be used? Example from deeplearning.net with the Theano library, there is a trend to use _ when defining theano.scan() operations... values, _...

Questions regarding package names and Interfaces [closed]

java,naming-conventions
Hello everyone I would like to know your preference regarding naming java packages. As in do you prefer com.example.controllers (since it contains a group of controllers) or com.example.controller ? Also if you have an interface named Shape do you prefer to name it IShape or just Shape?...

Entity Framework : a way to override naming convention globally?

entity-framework,customization,naming-conventions
We have a project having to be linked to a heavy database infrastructure (10+ years living), on which a lot of tools are yet running in various ways. The main software has his own convention model to handle foreign keys and primary keys, unfortunatly its a little bit different than...

Naming convention for human readable version of variable

ruby,naming-conventions
I have a class that has an integer property difficulty. The value is stored as a number between 1 and 3 and is displayed as "Beginner", "Intermediate", or "Expert". I have a method that converts the integer into one of these more human readable labels, but I'm having trouble coming...

What does the Python naming convention with single/double underscore before a function mean?

python,naming-conventions,name-mangling
I am unsure how to phrase the question I am asking so feel free to change the title. Currently, I am working on an existing python codebase and came across this "style" and hope to understand the benefits for using it. for example, Class Pokemon(object): def __init__(self, name): self.name =...

Maven GroupID and ArtifactID for J2EE Utility Project

java,eclipse,maven,java-ee,naming-conventions
I have a collection of 3 existing Eclipse projects that I want to make into Maven projects and I'm having a hard time understanding the relationship between the GroupID, ArtifactID and my Java Packaging, and the different directory structure that is created for Maven vs. Java projects. I'm pretty new...

How to name a static variable that's used for holding the data?

php,naming-conventions,naming
I have this class : class categories { private static $previousCategories; public static function hold_previous_categories($bussId) { $query = " SELECT categories .... where businessId = $bussId "; //run query -> fetch result and save categories at the static variables static::$previousCategories = $result; } } I will call hold_previous_categories at first...

What goes inside “trunk” folder in SVN?

svn,version-control,naming-conventions
This is a very basic and kind of meaningless question, but nevertheless: Should I put the contents of my solution directly into the trunk directory, or in trunk/Solution? I've done a search but could not find what is the accepted "convention" for this....

Why is “Init” in std::ios_base::Init uppercase?

c++,design,naming-conventions,iostream,c++-standard-library
All the names in the standard C++ library are lowercase except std::ios_base::Init. Why is this?

When to use leading underscore in variable names in Go

go,naming-conventions
Is there any special purpose of leading _ in a variable's name? Example: func (_m *MockTracker)... from here. ...

Naming conventions in MVC5

c#,asp.net-mvc,model-view-controller,naming-conventions,partial-views
So I'm working on my first true MVC website development (before now I've been using a template which was already developed). There we had a controller for controls (forms etc.) and then another controller just to deal with all HttpPost actions etc. Because of this is meant I could have...

VBA Module naming conventions

vba,excel-vba,naming-conventions
A quick question about Naming of VBA modules. I've posted this in a few related posts but they are old and evidently unobserved at this point and have gotten no responses. So I ask it here. When naming a module in VBA it defaults to the name "Module#". I usually...

What is a 'thunk'? (in the context of re-entrant sort functions, eg: qsort_r)

c,naming-conventions
Having already checked What is a 'thunk'?, I'm still not sure why the extra argument passed to the re-entrant qsort_r would be called thunk. Eg: (BSD style qsort_r) void qsort_r(void *base_, size_t nmemb, size_t size, void *thunk, int (*compar)(void *, const void *, const void *)); To be clear, I...

The differences between BEM and SUIT CSS naming conventions [closed]

css,naming-conventions,bem,suit-css
What's the main differences between BEM and SUIT CSS naming conventions? Ignoring personal preferences, what are the main differences and why might one choose one over the other? Is one better suited for certain types of projects the other, for example?...

Class with long name

java,android,exception,naming-conventions
Name of Exception class in Java must have Exception suffix also describe its throwing situation. Now I have two exception classes in about primary external storage in Android: /** * Thrown when Application tries to access primary external storage and it is not * available for write.This only depends on...

What does an underscore “_” mean in Swift?

swift,module,naming-conventions,header-files,naming
I just found this while browsing through the Swift module headers: protocol _ObjectiveCBridgeable { Similarly: protocol _SequenceType { Coming from an Objective-C background, this seems highly unconventional to me. The underscore _ usually implies that the concerned entity is private, and is often hidden in terms of header visibility. Why...

Best Powershell verb to indicate Validation?

powershell,naming-conventions
I often have a method that validates a particular value. In powershell, the convention is to use a verb within the 'get-verb' list, but I am puzzled on which one would be best for this usage. Alternatively, if my design architecture should change to avoid validation through a method in...

C++ Naming Conventions

c++,naming-conventions,capitalization
I was wondering about the naming conventions in C++, specifically where and what gets capitalized. I guess what I'm asking is (having come from languages like Java and C#) why are things like std::vector and std::string are not capitalized? As a follow up, if I was typedefing a std::string to...

Why do c++ libraries often define their own primitive types?

c++,types,naming-conventions
I have started using OpenCL library lately and I've noticed that they are using their own integer types, like cl_int and cl_uint instead of int and unsigned int. Why is that? Why don't they use the types that are by default in the language? Is it a good practice or...

Is the 'IT.java' filename Suffix (instead of 'Test.java') for JUnit Integration Tests a convention? [closed]

java,unit-testing,junit,naming-conventions,convention
I was used to naming my JUnit Integration tests with a *Test.java on the end eg DatabaseConnectionTest.java and placing them in their own integration test directory: eg test/integration/com... On joining a new project I was directed No, all the Tests go in the one directory, and we distinguish the Unit...

Laravel Migrations Naming Convention

php,laravel,naming-conventions,database-migration
Is there a naming convention or guide that one should follow while naming Laravel migrations or should the name only be descriptive enough ? Also, suppose you are adding 12 columns to modify a table then in such a case the migration name would be too long if made descriptive...

Naming conflict between field values and local scope in Haskell

haskell,coding-style,naming-conventions
This is a coding style question rather then a technical one. I have frequently encountered a problem where I use haskell's (less then optimal) record syntax (or lenses, the problem ends up the same) to create a data type. I end up with field accessor functions named after my fields....

updateObject or changeObject, removeObject or deleteObject?

java,naming-conventions
I'm off starting another project and I'm creating functions to add, update and remove objects. I tend to doubt myself when it comes to naming the update and remove function, because sometimes i name them: updateObject and removeObject but when i'm in a different mood on a different project i...

Interface, abstract class, and the implementation

java,interface,naming-conventions,abstract-class,java-api
In java I often find myself implementing the List interface instead of, for example, extending the AbstractList class. This is rather common in the Java API (and in many third-party libraries I've looked at), that there exists an interface and an abstract class for that interface. Why is this? Why...

Why is JSON all uppercase

javascript,json,naming-conventions
I am aware that functions are conventionally expressed in camel case ie function myFunctionName(){ return false; } and constructors with the first letter capitalized ie function Person(name){ this.name = name; } But why is the JSON spelt in all capitals like in the function: JSON.stringify(someValue); I know it may be...

How to insert “and” word in the functions and variables names? [closed]

naming-conventions,naming
I have a dictionary that holds BusinessCategories and the cityId : is businessCategoriesAndCities a good name, or should I remove the 'and' word? I also have a function that update the state of the old and the new categories. How should I name this function? updateOldAndNewCategories ?...

Local and external variable naming conventions in C

c,naming-conventions
I am conventionally a Java programmer learning to program in C. Now in the Chapter 2 of the book by Kernighan and Ritchie, this is what is written. At least the first 31 characters of an internal name are significant. For function names and external variables, the number may be...

Java conventions for accessible data. (Public accessors & Getters/Naming)

java,naming-conventions,getter-setter
Through the Java API you see numerous occurrences of conflicting naming and practices which are really confusing to me. For example: The String class has a private variable (Integer) by the name of count which keeps track of the size of the string, however this is returned by a getter...

SQL Naming Convention for ID that joins two tables

sql,design,naming-conventions
Im using camel casing for my column names and im trying not to use just ID for the primary key of my tables. So it seems stait forawrd for some tables like. Profile Table I call the primary key profileID but what about a table that joins two tables together....

Java boolean setter with “has” prefix according to naming convention

java,naming-conventions
Simple question but I can't understand. Example with is prefix: private boolean active; public boolean isActive(){...};//getter public boolean setActive(boolean b){...};//setter But I don't understand how to do setter with has prefix private boolean hasChildren; public boolean hasChildren(){...};//getter public boolean ?(boolean b){...}//setter ...

Java split string naming conventions [closed]

java,naming-conventions
If I split a String permIp, Is there a specific naming convention that is considered to be correct that I should follow for the String[] that I create, such as permIps, permIpSplit or splitPermIp? Or is this a matter of personal preference?

Error: Not found: Value S (Scala)

arrays,scala,naming-conventions,declaration
val Array(k,s) = readLine.split(" ").map(_.toInt) This code works fine. But not this: val Array(k,S) = readLine.split(" ").map(_.toInt) Capitalizing "s" here gives me an error: error: not found: value S What is going on?...

Why is java.lang.String capitalized the way it is?

java,string,oop,naming-conventions
Why is the String class capitalized but java and lang are lowercase, another example would be System.out.println, println is a method so lowercase is expected, but why is out lowercase? Am I missing something or does someone not follow their own rules?

Why do Clojure devs use “xs” for function args?

parameters,clojure,naming-conventions
In most languages there are conventions around arguments. Such as in nested loops you might use i at the top level, then j, then k. But in Clojure I don't know what the convention is. I've seen, more often than not, the use of xs in function arguments; so why...

How to interpret PSR-1 rule about method naming in the case of PHP constructors

php,naming-conventions,psr-1
I'm trying to take into consideration the PSR-0 and PSR-1 recommendations made by my IDE (Netbeans here). PSR-1 says both: Class names MUST be declared in StudlyCaps. and : Method names MUST be declared in camelCase. That's of course very fine, but how are we supposed to comply in the...

Core Data Relationship Naming Convention

ios,core-data,naming-conventions
iOS noob checking in. I've been learning awesome Core Data framework and wondered if there is any naming convention for Core Data relationship names. It's not so clear since in usual SQL databases, you don't explicitly define names for relationships although I understand that Core Data isn't really a conventional...

What is the name of this naming convention? “this-is-an-identifier”

naming-conventions
Parts of a composed name are separated by "-" and all the letter are lower case. I know that thisIsAIdentifier is camel case, but don't the name of this one ;)

Does variables/functions/procedures/etc name affect performance in PL/SQL?

sql,oracle,plsql,naming-conventions,sql-standards
I'm almost a newbie coming from the "Java's World" to the "PL/SQL World", working with "legacy" stored procedures, and I have a question. Best practices for Java naming includes tips such as "the names of variables, methods, classes, etc should be meaningful and auto-documented" (I read on the Clean Coder...

Java “get{Object}” method naming convention [closed]

java,android,coding-style,naming-conventions
Which of the following is compliant with Java guidelines? Observable<List<Account>> getAccounts(String userId); Observable<List<Account>> getAccountsForUser(String userId); I don't want to start a debate, I'm looking for a document that is stating the guidelines. I don't think it matters, but I'm using the previous snippet of code inside an Android project....

some more help for naming conventions plural vs singular

node.js,rest,resources,uri,naming-conventions
There are answers out there but my question is different as I'm trying to find out a uri when I've detail on a product or when I've to return detail on a product plus it's customers. I need a standard solution for following 4 api calls. I need a standard...

How to name a Java package as a student

java,naming-conventions,packages
I'm trying to get in the practice of using packages for my HW assignments and my personal projects. As a student of a university would it be proper for me to use edu.university_name.my_name.package_name? As for personal projects it seems a lot of people are recommending that one should use their...

Access Variable Dynamically

ios,objective-c,nsstring,naming-conventions,dynamic-variables
I have many buttons named like this: @property (weak, nonatomic) IBOutlet UIButton *Round1Num1; @property (weak, nonatomic) IBOutlet UIButton *Round1Num2; @property (weak, nonatomic) IBOutlet UIButton *Round1Num3; @property (weak, nonatomic) IBOutlet UIButton *Round1Num4; @property (weak, nonatomic) IBOutlet UIButton *Round2Num1; @property (weak, nonatomic) IBOutlet UIButton *Round2Num2; @property (weak, nonatomic) IBOutlet UIButton *Round2Num3; @property...

good variable name: the number of process to go [closed]

variables,naming-conventions,naming
I'd like to know a good name of a variable although I'm not sure this kind of question is in scope of SO. I have a variable which holds the number of processes to go. What is a good name for x in below code? int x = getTheNumberOfProcess(); while(x...

Foreign key naming conventions, ModuleID vs ModuleId [closed]

foreign-keys,naming-conventions
When we use foreign keys in table Should we name them ModuleID or ModuleId? Due to foreign keys naming conventions....

Python inst/klass instead of self?

python,class,naming-conventions,instance
Sometimes self can denote the instance of the class and sometimes the class itself. So why don't we use inst and klass instead of self? Wouldn't that make things easier? How things are now class A: @classmethod def do(self): # self refers to class .. class B: def do(self): #...

iOS MVC Model Naming Convention

ios,model-view-controller,naming-conventions
Is there a standard convention for naming Model classes? I looked at Apple's conventions, but I really couldn't find an answer, if there is one. Views are usually prefixed with UI and/or contain view in the name; controllers usually post-fix "controller," but I'm not sure how to name my model...