Questions tagged [naming]

Give meaning and explanation with the fewest number of characters in a form that is most accepted by your team or community at large.

Filter by
Sorted by
Tagged with
0
votes
2answers
760 views

C# namespace and class naming

I have a small issue with namespace and class naming. Here is a practical example: ResourceLayer.cs - Public component that holds the manager and the map provider, implements an interface ...
2
votes
0answers
76 views

What sort of object represents a table row from a joined table query? [closed]

I have a conceptual problem here. When i query my database, i often do so with joins. So a result set row might look like +------------+--------------+------------+-------+----------+----------+------...
13
votes
6answers
16k views

What naming Convention to Use for C# Function Parameters

There are situations when a name passed in Parameter will be Cast into a new type, but the name of the Passed object should remain similar. For the case of Class Attributes, we can use this operator, ...
3
votes
3answers
141 views

Should I implement a obfuscated spec literally?

I'm tasked with implementing a spec for a simple simulated shopping system. The spec however uses strange abreviations everywhere (it has a 2 page long table of nonsense abreviations). For example the ...
0
votes
1answer
105 views

break down test class into multiple file naming convention

I have a test class with about 25 tests that are testing the different aspect of it. I wonder Should I break it down into smaller classes? If so, then what is the best naming/packaging convention? ...
1
vote
1answer
188 views

Name a predicate function that takes multiple objects [closed]

I have the following JavaScript code: function tokensOnSameLine(node1, node2) { return node1.line == node2.line; } What would the preferred name for this function be? I've considered the ...
2
votes
4answers
2k views

Best practice for RESTful API calls with variations

How do I name API endpoints that serve the same entity in different ways and still adhere to the RESTful API guidelines? Let's consider I'd like to get a customer with ALL his details. I just expose ...
3
votes
3answers
1k views

namespaces and header guards with naming conflicts

C++ has namespaces to prevent collisions of things with the same name. Header guards serve a different purpose. They prevent includeing the same header twice. However, they can suffer from the same ...
2
votes
1answer
619 views

ASP.NET MVC Middle tier object naming

As a corporate developer who works alone I find myself creating and writing a lot of websites that consist of screens that are basically wrappers for a DB table. So for instance on a screen that ...
43
votes
15answers
13k views

Is it bad practice to name an unused variable with a single underscore?

Often when the syntax of the language requires me to name a variable that is never used, I'll name it _. In my mind, this reduces clutter and lets me focus on the meaningful variables in the code. I ...
1
vote
3answers
321 views

Is it a good idea to have a method that starts with get without being an accessor?

Let's say you implement an interface like: public interface Example { InputStream getThatContent(); } In this case there is no property, and the implementation may also have side effects (it can ...
2
votes
1answer
73 views

In what namespace would I place “Doers”

This might sound weird and probably is, but I am struggling to find a good place where to place what I will just call "Doers" for lack of a better name. Basically, my project currently has these ...
1
vote
2answers
282 views

How to name variables that clash with functions?

As an example, in Python I have a lowest_prime_factor function which does it exactly what it says it does. Then, in another function, I need to call this function and store it. In another language ...
0
votes
1answer
33 views

Should I create a function that filters and returns a mutated copy of the filtered values?

Say I have a function whose input is an array of fruit objects, and returns a list of *cloned) apples from that list, with each cloned apple mutated with an additional property visible on it. Would a ...
1
vote
3answers
930 views

Version-postfixed class name for REST api

I'm working on a Spring-based REST api that has v1 and v2 variants: /api/v1/dates /api/v2/dates Correspondingly, there are v1 and v2 packages in the code base: com.company.api.v1 com.company.api.v2 ...
9
votes
1answer
7k views

Naming convention for test packages

We're actually naming our test packages just like their to-test counterparts. So we end up with this structure: src/main/java com.hello.world helloWorld.java src/test/java com.hello....
21
votes
2answers
35k views

Naming convention: Final fields (not static)

Today I had a discussion with a co-worker about the naming of final fields in Java classes. In his opionion final fields should also be considered constants since their values won't change after the ...
13
votes
5answers
2k views

How to organize localization string resources?

We're developing a large application, consisting of many small packages. Each package has its own set of resource files for localization. What's the best approach to organizing and naming the ...
1
vote
2answers
2k views

What should be the ideal length of a variable name in Java? [closed]

I try to find out not according to semantics but weight. I mean, should I take care when set a long name to a variable?
-1
votes
1answer
145 views

What is the naming convention for this type of object [closed]

I have frequent "access" classes that implement interfaces / abstract classes. These classes all have different classes/ dlls to execute the implemented method. What naming convent is commonly ...
1
vote
3answers
2k views

Should class names reflect namespace name?

Is it generally considered good practise for a class name to reflect the namespace name it exists under, or should the namespace name implicitly be considered part of the class name? For example, ...
0
votes
0answers
34 views

Name of the operation where whole table is put in array format

Consider this data struture: key1 : value1 key2 : value2 key3 : value3 I have an operation that put this data in array format: key1, value1, key2, value2, key3, value3 Which would the the name of ...
19
votes
3answers
4k views

The suffix Exception on exceptions in java

Specifying a suffix of Exception on exception classes feels like a code smell to me (Redundant information - the rest of the name implies an error state and it inherits from Exception). However, it ...
-4
votes
3answers
1k views

Why different languages have different syntax? [duplicate]

Different programming language always/most of the time use different syntax. For example take PHP, Java and Python. In Php & Java semicolons are compulsory at the end of the line, yet Python ...
7
votes
4answers
3k views

Naming conventions and organization of packages

I've been programming in Java, C#, Python and AS3 most of the time and in all of these languages there are packages (or something like that). The problem I found is with the naming convention, or even ...
0
votes
1answer
142 views

How to name this class? Is it a pattern?

I need to create a class which will have the following structure: public class MyClass { ArrayList<File> myList = new ArrayList<>(); public void addFile(File f) { myList....
2
votes
1answer
453 views

What is the opposite of UI?

I'm trying to find a good name for a library where I can put in all non-UI related code that I want to share between iOS apps (networking, filesystem, logic, algorithms, data structures). Names that I ...
4
votes
3answers
7k views

Same class and namespace name

I have a problem how to go about naming my namespaces and classes. I already figured they shouldn't both have the same name, as it causes all kinds of problems. Most notable problem for me is that I ...
0
votes
1answer
45 views

name of probability + (pseudo)random functions

What is a group/family of functions that is random but some number(s) are more likely to come? For example, calling each of this fake functions 10 times give: random2: 2,3,2,4,2,6,7,2,2,2 random4: 4,...
2
votes
2answers
92 views

When should the naming of data structures be more abstract or literal?

Say that I create an ordered set structure, and I choose to implement it as a binary tree. I name my structure OrderedSet because I feel its underlying implementation isn’t necessarily important to ...
4
votes
2answers
206 views

Common loop variable names for indexes in 4D and above

I am curious if there are common loop index variables (of single character or not) for dealing with 4 dimensions and above? I was helping another student working through CS50x who was just learning ...
4
votes
2answers
236 views

Name for a Chainable ForEach [closed]

Linq has a method Select, which takes a Func<TIn, TOut> and maps it over an iterable. I'm trying to come up with a good name for a method that takes an Action <TIn>, transforms it to ...
2
votes
1answer
142 views

Term for the opposite of the functional Compose operator

In functional programming, given a function f and a function g we can define a function . (compose): let (.) f g = fun x -> g (f x) Is there a term for the function which applies arguments in the ...
2
votes
1answer
76 views

Phrase for “timestamp”-like value that increments every time there is a state change?

Is there a phrase in common use for a counter that is incremented every time the state of an object changes? It's not quite a timestamp and it's not quite a revision but maybe there is a common name ...
-8
votes
1answer
1k views

Class library naming conventions [closed]

Typically in a C# program, the entry point is in Program.cs. However, if you are creating a rather generic class library, with no Main() method, such as TCPClient.dll what is the appropriate base ...
0
votes
2answers
171 views

Is there a name for “leak” of CPU usage? [closed]

A counterpart to memory leak, but involving CPU time instead - the program's CPU usage slowly climbing to 100% and then the whole system slowing down - without memory footprint changing. An example ...
5
votes
3answers
620 views

How do I effectively address code-review feedback about class and method names without a suggestion for a better or alternate name?

Part of code review feedback is suggesting better names for methods and classes. How can I address feedback about class and method names which does not suggest an alternative? For example, I might ...
69
votes
7answers
36k views

Should interface names begin with an “I” prefix?

I have been reading "Clean Code" by Robert Martin to hopefully, become a better programmer. While none of it so far has been really ground breaking it has made me think differently about the way I ...
2
votes
1answer
905 views

Best practices for scientific variable naming?

What are some of the conventions you use when naming variables in mathematical/scientific code? I'm looking to establish a set of conventions for an upcoming project. So here's an example formula to ...
-1
votes
1answer
65 views

How to name functions which continue a process after an asynchronous step

Say that you have an web application which prints pages in a document. Suppose that after validating the page range, the application does the following: If a billing option is turned on, it first ...
7
votes
1answer
2k views

Why would you want different identifiers for a typedef and its associated struct tag?

Ignoring (with difficulty) Occam's Razor which would seem to put this quickly to rest, what advantage would this have: typedef struct s_header { struct s_header *next; //... } Header; over ...
1
vote
4answers
308 views

Naming: objectAction or actionObject? [closed]

The question, Stored procedure Naming conventions?, and Joel's excellent Making Wrong Code Look Wrong article come closest to addressing my question, but I'm looking for a more general set of criteria ...
5
votes
3answers
474 views

“Smart create” method naming

Every class of a model in my application has a create method. The framework gives me the default implementation of create which is “create in the DB”. Sometimes I need to perform some extra actions ...
17
votes
9answers
9k views

Data structure for accessing units of measure

TL;DR - I'm trying to design an optimal data structure to define units within a unit of measure. A Unit of measure is essentially a value (or quantity) associated with a unit. SI Units have seven ...
1
vote
2answers
190 views

How are non-folder files called? [closed]

Maybe it looks like a weird question, but what term should be attributed inside the code for files that are not folders to differentiate them from folders? If I need write 2 functions isFolder() and ...
10
votes
5answers
770 views

How to refer to ByRef and ByVal in a dropdown label? [closed]

The MSDN page on ByRef and ByVal keywords isn't very helpful; unless I somehow skipped it, they're simply being referred to as "keywords" everywhere. One of the main contributors of the Rubberduck ...
4
votes
3answers
24k views

Why am I seeing more boolean naming conventions where “is” is used as the first word in the variable (eg, IsUserAdmin vs UserIsAdmin)? [closed]

I think everyone will agree that the following boolean variable/property names are standard: UserIsAdmin OrdersAreClosed The important thing to note about boolean expressions is that they are stated ...
45
votes
12answers
5k views

Intentional misspellings to avoid reserved words

I often see code that include intentional misspellings of common words that for better or worse have become reserved words: klass or clazz for class: Class clazz = ThisClass.class kount for count in ...
0
votes
1answer
226 views

Super classes that represent a wordly hierarchy: naming conventions [closed]

I'm unsure whether this post is allowed, considering it may be subjective. However, I have seen many posts concerning naming conventions (on programmers, as well as on StackOverflow - where I'm a more ...
3
votes
1answer
719 views

Why do you reduce multiple inheritance to the diamond problem?

Whenever I read something like this: Many programmers exhibit a slight, involuntary shudder whenever multiple inheritance is mentioned. Ask them to identify the source of their unease and they ...