Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

naming conventions for constants and their units

Should the names of my constants incorporate the units that it represents, or is this better handled by a short comment? Sometimes the constant names can become lengthy. For example, I can choose between:

// Seconds spent displaying logo
public static final float LOGO_DISPLAY_TIMER = 1.5f;

and

public static final float LOGO_DISPLAY_TIMER_IN_SECONDS = 1.5f;

I've been reading Clean code, which places great emphasis on accurate naming conventions, but I wasn't sure about this specific case.

like image 337
Cabbage soup Avatar asked Oct 20 '22 12:10

Cabbage soup


1 Answers

In my opinion - If there are no code conventions from your company or sth. like that, take what you like and feel comfortable. The main point is that you are consistent and use every time the same style.

like image 185
Andre Hofmeister Avatar answered Oct 23 '22 03:10

Andre Hofmeister