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

4
votes
5answers
202 views

Naming is hard: naming a Class that represents a conditional expression

I have a class with which I want to persist a conditional expression: boolean x = a [GT] i I am only concerned with boolean outcome of that comparision, 'a' ...
2
votes
2answers
74 views

DFS Undirected Graph Code

The code included below was written in response to a programming exercise that was sent to me by a company that I am applying to. The purpose of the code is explained at the following link: ...
1
vote
1answer
29 views

Naming a complex crud function

I have a function below that does the following uses a bunch of smaller CRUD operations which I call create, ...
0
votes
1answer
72 views

Recommendations for a newbie to CSS & HTML [closed]

I am getting started with web development, and been trying some HTML & CSS, and I want recommendations on my code from experts here. I want to know what standard naming conventions you use for ...
2
votes
1answer
40 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). ...
0
votes
1answer
19 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
71 views

Count Point in an area

I created this to count points in an area. This is my JavaScript code: ...
4
votes
1answer
129 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 ...
7
votes
2answers
182 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
233 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
160 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
804 views

Class for catching error and logging

I often write something like this in my code: ...
7
votes
2answers
98 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
107 views

Naming a template print method properly

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
842 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
35 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
99 views

Suggested parameter names for utility class function

During our internal code review process, my following code raised some eyebrows: ...
6
votes
1answer
214 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
170 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
128 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
966 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
103 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 ...
1
vote
2answers
95 views

How to name this very simple class?

I want to give a short and clear name to this class: ...
3
votes
1answer
144 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
103 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
59 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
142 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
77 views

Proper naming for Time class

If I have this simple class: ...
6
votes
1answer
752 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. ...
5
votes
1answer
1k 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
160 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
115 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>. ...
14
votes
4answers
987 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
186 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
1answer
371 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
391 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
112 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
52 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
70 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 ...
1
vote
2answers
2k 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
143 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: ...
0
votes
1answer
162 views
11
votes
2answers
1k views

Advice on naming convention with enum

I have an enum called NodeType. Since my public field does not want to conflict with enum, ...
2
votes
2answers
33 views

Naming a method that filters or repeats elements as needed

I'm having trouble thinking of a good name for the following extension method: ...
10
votes
6answers
513 views

Better test names [closed]

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 ...
3
votes
2answers
318 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
251 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 ...
3
votes
4answers
394 views

Is it overkill to create a Model for this?

Email<input type="text" id="email" /><br /> Re-enter Email<input type="text" id="confirm-email" /> I'm thinking that I want a model so that I ...