The art of properly calling a cat, a cat; naming is often governed by various conventions. Poor naming can make code harder to read, good naming easier.

learn more… | top users | synonyms

2
votes
1answer
105 views

How should I name a mapper or manager?

Recently I was reading a book called Clean Code by Robert C. Martin. There is a chapter called Meaningful Names that started me thinking if I was doing this right. I know there isn't one good way to ...
6
votes
2answers
106 views

Android Thread and Runnable

This is my code for running a background thread. I believe it is very poor in naming and code structure. ...
3
votes
1answer
74 views

Class naming conventions

I have the following scenario: The (web-) application is built with Java/Spring. I have several REST-endpoints which deliver data prepared to be consumed by a frontend by ...
2
votes
1answer
55 views

Naming for a variable in before and after status and different type of variable

I'm not a native English speaker, so I'm unsure about this. Is it ok to name a variable and put the prefix "before" and "after"? If not, how could I give it a better name? ...
2
votes
2answers
80 views

How to name this very simple class?

I want to give a short and clear name to this class: ...
5
votes
1answer
84 views

How to name a read-only Collection property

I think good naming is an important part of maintainable and good usable code. One rule we have for that is that properties must start with a capital letter. We have an API here which can be ...
2
votes
1answer
79 views

Code reuse while keeping meaning clear and avoiding unforseen consequences

I like to reuse code as much as possible and keeps things DRY. But I'm afraid that sometimes it creates too many layers of indirection. It then becomes a chore to find where code exists that is ...
3
votes
1answer
49 views

Proper naming for filter classes

In my Android application, I have two types of filters: search filters and sorting filters. I need to read filters from view, display filter on view, save them into and from memory. I should include ...
6
votes
2answers
116 views

Class that represents searchable and sortable elements

In my application, I have a small hierarchy of related classes (partner categories - partners - partner points). The application has two representations of its content: in the form of partners ...
4
votes
2answers
63 views

Proper naming for Time class

If I have this simple class: ...
3
votes
1answer
85 views

Naming of predicate methods

Sorry for my English. I want to discuss this question. I don't agree with @200_success. He says: I would also rename evenNumber(int number) to isEven(int number). There is a convention in Java ...
6
votes
1answer
113 views

Class for typecasting an Activity to an interface

In several places, I have some code that looks like the following, the only difference is in the type of listener. ...
6
votes
2answers
120 views

Commenting in Python

I am struggling with commenting and variable naming. My teacher says my comments need to be more explanatory and explicit. He says my variable names are also sometimes confusing. I was just wondering ...
5
votes
1answer
105 views

A Program that Finds Empty Folders

I wrote a program that finds empty folders and subfolders in a directory. It's the first program I've ever written in Java, and I'd like some critique. I feel like I'm not utilizing classes in a very ...
2
votes
1answer
104 views

Naming convention in my C++ library

I am implementing a library in C/C++11 and I have chosen to follow Google C++ Style Guide as I also use this Style Guide in my code. As such all classes and types (including ...
0
votes
1answer
64 views

Help me choose a more appropriate name or make this class inherit from another class [closed]

I need to rename the next class or have it inherit from ArrayAdapter<String>. ...
15
votes
3answers
664 views

Commenting in Python and general semantics

I am struggling with commenting and variable naming. My teacher says my comments need to be more explanatory and explicit. He says my variable names are also sometimes confusing. I was just wondering ...
1
vote
2answers
123 views

Android class in Tic-Tac-Toe

CellDrawableProvider is an Android class used in the game Tic-Tac-Toe. It provides drawables for cells of game board (drawables for figures X and O, and "Fire" if ...
2
votes
2answers
63 views

Help me choose a more appropriate name

The game involves two players. To identify each of them, I use an enumeration containing two possible values ​​- PLAYER_1 and ...
2
votes
1answer
148 views

Method names for encapsulated unit testing logic. Which convention is better?

I have some C# unit tests which each basically perform the same steps but supply different arguments to the unit under test. I wanted to encapsulate the logic inside some "helper methods" but found ...
6
votes
2answers
224 views

Simple anagram game with names of colors

This is a very simple anagram game that plays only with names of colors. I tried to focus on code design. I also wanted it to support further updates. But, my ...
0
votes
1answer
50 views

Foreach loop naming conventions [closed]

Is it considered bad practice to name the item with the singular version of the name of the iterated collection? In dynamically typed languages it would be easy to use the collection variable by ...
1
vote
2answers
99 views

Naming convention for a method with double get

The following are an example of methods supported by a proprietary device: Monitor ControlTemp PutPeakInfo GetPeakInfo I have a class that builds the packets for the above corresponding methods: ...
1
vote
1answer
27 views

Naming of method that returns a viewmodel

In my ASP.NET MVC code, I like to use controller service classes for my controllers. These service classes contain methods for retrieving viewmodel objects. Here is an example controller snippet: ...
1
vote
1answer
62 views

Is this class name for my commenting system confusing?

In my project (which is a discussion system) there are approved and unapproved comments. There's a class that tells if unapproved comments should be shown. But I cannot think of a good name for this ...
0
votes
2answers
599 views

Printing out all the subsets of a set. Am I unnecessarily creating new objects?

1) I am concerned about the creating too many objects in my code. 2) Am I using duplicate code? Can I cut down on the number of lines of code? Note: I only want to use recursion to solve this. ...
5
votes
1answer
134 views

Recommended Naming for function that tests and mutates

I am a huge proponent of self-documenting code (when at all possible). I prefer to have code be self evident by the very nature of the names of the variables, methods, etc.. For instance: ...
5
votes
5answers
293 views

Is this an acceptable method name?

GetCollectionWhereKeyStartsWith(string key) The intent of the method is to retrieve a sub-collecteion from a name value collection where the key starts with the ...
-1
votes
2answers
235 views

What is a good name for bidirectional dictionary structure? [closed]

I'm writing a generic bidirectional dictionary which will be a part of a (somewhat) public API. This is how the dictionary works: It will hold key-key pairs where ...
0
votes
2answers
108 views

How to name this function?

The sample code is like this: ...
0
votes
1answer
83 views

Best method name for name exist check [closed]

There is a method that checks if a name already exists : bool Foo(string name) { return Names.Contains(name) } What would be the best name for this method?
1
vote
0answers
95 views
2
votes
2answers
112 views

Suggest name for the method

I have an Interpreter class that has a method named loop. This method takes two inputs, a ...
2
votes
2answers
78 views

Naming of overloaded methods - singular or plural? [closed]

This question is about your opinions and/or existing conventions. Let's say I have an object Basket that store various items in some private property (...
11
votes
2answers
527 views

Advice on naming convention with enum

I have an enum called NodeType. Since my public field does not want to conflict with enum, ...
3
votes
1answer
351 views

Rails: Cleaning parameters before passing them to a model

I'm writing an API and want to be able to pass in the attributes of a model without prefixing them with the name of the model. I wrote this little extension to ActiveRecord in order to make it happen: ...
9
votes
6answers
449 views

Better test names

I have some simple tests written, however, the names are not good...I think, any suggestions on better names? I'm not really sure how these tests should be named. I'm looking for a format or pattern ...
1
vote
2answers
99 views

FooTest or FooTests? [closed]

Can't make up my mind. For a class Foo, should its test class be called FooTest or FooTests? ...
4
votes
2answers
248 views

Name Proper Casing code example

I deal with hundreds and hundreds of names each week. These names (along with other pedigree information) are stored in a database. Typically, I get these names in all sorts of formats, mainly proper ...
3
votes
3answers
232 views

Is “int2rgb” an OK method name?

All colors can be represented by an int, and often you want to get the individual red, green and blue values from that int. I ...