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

0
votes
0answers
14 views

Coding on interfaces/superclasses not implementations

From pretty much any book I've read it always said to code on interfaces/superclasses and rarely on implementations, today though that advice made a bit confused about how I should format my code. ...
1
vote
0answers
20 views

Using the Template Design Pattern to reduce code duplication between two algorithms

I have made a Skyline query solver which for now can solve the query with two different algorithms. The first is Block-nested loop (BNL) and the second is Sort filter skyline (SFS). The two are ...
2
votes
1answer
76 views

Naming factories

Given the code below, I'm curious to know if you'd have better naming suggestions for types: VegetablePresentersFactory VegetablePresenterFactory It bothers me a bit that their names only differ ...
2
votes
1answer
37 views

Naming a function and its parameters for adjusting a queue

I have a function that takes all items in a queue and increments their order (used to allow insertion earlier in the queue). ...
3
votes
1answer
200 views

Best to name c# enums?

I have a simple enum, but I'm not sure how best to name/use it. ...
1
vote
1answer
14 views

Name to substitute setDimensionAndLocation

I'd like to have a function name that is brief but comprehensive, nothing like setDimLoc() or setDL() because they sound funny. ...
3
votes
1answer
50 views

Count Point in an area

I created this to count points in an area. This is my JavaScript code: ...
4
votes
1answer
71 views

Check if downloading image from Internet is already started and if isn't then start downloading and set flag “downloading started”

In the method getView() in my implementation of ArrayAdapter I have to download image from Internet using the image's url and ...
5
votes
2answers
148 views

My Authentication Service

This is the AuthenticationService I made based on Barry Jaspan's design, which is way better than the code of which I asked in a question a couple of months ago. I ...
4
votes
4answers
203 views

Class to simplify skipping some actions on the first loop iteration

Often I have to skip some actions on the first (or last) loop iteration. Now I need to append some arguments to an url and separate the arguments by the & ...
13
votes
1answer
147 views

How can I better name my tests?

I am relatively new to TDD and am trying to adopt better names for my tests. I wrote the following tests abruptly and have since refactored them to the best of my ability, but despite my best ...
5
votes
3answers
770 views

Class for catching error and logging

I often write something like this in my code: ...
7
votes
2answers
87 views

EditController and ModelConverter - Does this make my ass look fat?

Description I am using a combination of the following two classes to achieve a quite simple task. I have Users in my application. These Users can be assigned Roles. And these Roles need to be ...
4
votes
4answers
95 views

How to name template method properly so it makes better sense?

Some might not think it's worth asking but I consider good function names quite important. I am not sure what should be the overridable function name in what I think is template design pattern. I am ...
11
votes
3answers
791 views

Does everyone still love Fibonacci?

I'm following up on this question. I made a few decisions about my model and implemented recommendations accordingly. TL;DR the link Uses a loop algorithm to return a Fibonacci number \$Fn\$ of ...
1
vote
1answer
32 views

How to name this function which chains a number of callables into single function?

How would you name this function (I gave in a name pipe in the example) which constructs combines a chain of functions with a single attribute into a single ...
3
votes
2answers
81 views

Suggested parameter names for utility class function

During our internal code review process, my following code raised some eyebrows: ...
6
votes
1answer
141 views

Retry logic for delegates

I created this class which supposed to take a method and try to execute it. If it fails lets say 10 times, it will throw the original exception thrown by the delegate. Do you guys have any ideas for ...
6
votes
1answer
164 views

What is the proper naming of classes and method when designing API for calculation library?

I'm working on library which will provide easier writing and calculation in Java using fluent API. Library I have implemented with basic functionalities and now I am working to improve API. I ...
3
votes
1answer
127 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
547 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
93 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
58 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
88 views

How to name this very simple class?

I want to give a short and clear name to this class: ...
5
votes
1answer
112 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
94 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
58 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
134 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
74 views

Proper naming for Time class

If I have this simple class: ...
2
votes
1answer
108 views

Naming of predicate methods [closed]

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
395 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. ...
8
votes
2answers
216 views

Commenting and naming variables 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
502 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
141 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
95 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
4answers
823 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
158 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 ...
1
vote
2answers
67 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
222 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
303 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 ...
1
vote
2answers
108 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: ...
2
votes
1answer
49 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
68 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
1k views

Printing out all the subsets of a set - am I unnecessarily creating new objects?

I am concerned about creating too many objects in my code. 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. Any ...
5
votes
1answer
141 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
304 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
vote
1answer
151 views
2
votes
2answers
113 views

Suggest name for the method

I have an Interpreter class that has a method named loop. This method takes two inputs, a ...
3
votes
2answers
124 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
951 views

Advice on naming convention with enum

I have an enum called NodeType. Since my public field does not want to conflict with enum, ...