naming

What are the valid characters for a Java method name?

≡放荡痞女 提交于 2019-12-04 19:34:40
问题 I read about the naming of Java variables. It says that Java variables cannot start with any numbers and special characters except for $ and _. Some valid examples: int count; int _count; int $count; And some invalid examples: int %count; int 4count; int #count; Do the same rules apply to method names? 回答1: Yes, method names and variable names are what's called "identifiers". Identifiers all share the same rules regarding accepted characters. Take a look at §3.8 from the Java Language

What are the common solutions for making clean id space in a SPA?

岁酱吖の 提交于 2019-12-04 18:03:56
问题 Situation: several developers working remotely on different section/modules of a SPA. As a result they may accidentally introduce HTML elements with the same id . What are the common ways to avoid that situation (without refusing id-usage if possible) before final assemblage? My shallow guesses: pre-arrange id for all names(a bit ridiculous but...) structure names with architecture e.g. for an app/collection/model dedicate a name like app-collection-model refuse using id s in general or use

Programmers dictionary/lexicon for non native speakers

霸气de小男生 提交于 2019-12-04 17:04:09
问题 I'm not an English speaker, and I'm not very good at English. I'm self thought. I have not worked together with others on a common codebase. I don't have any friends who program. I don't work with other programmers (at least nobody who cares about these things). I guess this might explain some of my problems in finding good unambiguous class names. I have tried to find some sort of "Programmers dictionary" containing words often used and their meanings. When reading others code I have to look

When to use exclamation mark in clojure (or lisp)?

谁说胖子不能爱 提交于 2019-12-04 15:45:39
问题 They say that use exclamation marks when naming impure functions. But I don't exactly understand the "impure" functions. Are they functions change state of their arguments (via reset!, alter, java-object-methods, ...) functions occur side-effect (for example, print, spit, ...) or both? Obviously, official clojure apis don't have bang!s on every case above. I wonder when should I put them and need your help to make my code saner. 回答1: I would say you don't need to put ! on every impure

Is using “is” to name Boolean variables bad practice?

爷,独闯天下 提交于 2019-12-04 15:07:12
问题 Is naming Booleans that start with "is" bad practice now? My manager believes that "isAnything" is outdated and poor practice. Is this true? myManager.isLame ? correct() : incorrect(); 回答1: It's used quite often in a lot of languages, but I don't know if it can be said with certainty that it's the preferred method. I think consistency and everyone on a given team using the same standards/styles is the important thing to bear in mind. 回答2: I would not use any hard and fast rules here. Although

What are good guidelines for naming PowerShell verbs?

大兔子大兔子 提交于 2019-12-04 09:09:57
I'm early on in my PowerShell learning, and I'm wondering if there are some good guidelines for verbs in Posh for cmdlets (or advanced functions, whatever they're called in CTP3). If I do a get-verb I can see the lot of them. But I'm still not sure how I should lay out my modules. Here's the example I'm running into right now. I have a little script that asks Perforce: if I were to sync, what files would change and how big are they? It outputs a summary of sizes and a mini-tree of folders for where the changes will occur (as well as how many would need resolving). Is that a query-p4sync? Or is

Java inner class with the same name as other top level class

跟風遠走 提交于 2019-12-04 08:47:29
I have question related to Java inner classes. Is there a way to access top level class A from top level class Main that define inner class A? Below is sample code demonstrating the problem: class A { // Outer Class A { System.out.println("A outer"); } } class B { // Outer Class B { System.out.println("B outer"); } } public class Main { class A { // Inner Class A { System.out.println("A inner"); } } public void newA() { class A { // Local Class A { System.out.println("A local"); } } new A(); } public static void main(String[] args) { new Main().newA(); // prints "A local" new Main().new A(); /

What is the preferred way (better style) to name a namespace in Ruby? Singular or Plural?

只愿长相守 提交于 2019-12-04 08:16:43
问题 What are for you the pros and cons of using: FooLib::Plugins FooLib::Plugins::Bar vs. FooLib::Plugin FooLib::Plugin::Bar naming conventions? And what would you use or what are you using? What is more commonly used in the comunity? 回答1: Use: module FooLib end module FooLib::Plugins end class FooLib::Plugins::Plugin; end #the base for plugins class FooLib::Plugins::Bar < FooLib::Plugins::Plugin; end class FooLib::Plugins::Bar2 < FooLib::Plugins::Plugin; end or in a different words: module

Is naming variables after their type a bad practice?

妖精的绣舞 提交于 2019-12-04 08:08:47
问题 I'm programming C++ using the underscore naming style (as opposed to camel case) which is also used by the STL and boost. However, since both types and variables/functions are named all lower case, a member variable declaration as follows will lead to compiler errors (or at least trouble): position position; A member variable named position which is of type position . I don't know how else to name it: It's generally a position , but it is also the position of the object. In camel case, this

Non-English domain naming issues in programming

血红的双手。 提交于 2019-12-04 03:33:40
Most programming code, I imagine is written in English. But I'm curious how people are handling the issue of naming herein. A lot of programming is done within some bussiness domain, usually with well established terms for certain procedures, items. I'm from Denmark for instance, and something I work a lot with has a term called "indblikskode", which sort of translates to "insight code". So, do I use the line "string indblikskode = ..." in the C# code for some web service related to this? Or do I try to use a translation, such as "insightcode"? The bussiness I'm in isn't even consistent in its