Variable names / dev woes

It's the little things in development that trip you up the most. So I've got a tracked robot (more on that to come) and it has some lights in the front that we can fairly call headlights. It also has an arm with a camera and gimble and stuff on top that is fairly called the "head". And on the head of the robot there is a light that is also fairly called a headlight, though for different definition from the other headlights.

And therein lies the conundrum. Two pieces of code were developed separately and must now come together. Both have a thing that is best referred to as a headlight and both pieces of code have chosen that name, headlightPin, headlightState, headlightOnTime, etc, etc. So obviously one gets refactored before they get combined. Easy enough to do with find and replace.

But which one loses the name? I could get away with headlights and headlight, but I might end up having to post this code on the forum one day and then PaulS would see it and I'd have to change it before I could get any help anyway. I'd rather just nip it in the bud and avoid doing stupid things to begin with.

SO, which wins? The headlights? Or the light on the head? Who has a better name for one of those things?

What about headLamp for the light on the robot's head?

Or drivingLights for the "headlights" on the main body?
Or just mainLights?

Avoid @PaulS's wrath at all costs :slight_smile:

...R

Is the light on the head more like a searchlight?

Or is it a headlamp?

A "head light" is the light in the toilet on a ship. I think a "boom light" would best define the third light.

Paul

Paul_KD7HB:
A "head light" is the light in the toilet on a ship.

Then what about "mast-head light"

Or, if it is a domineering type of robot "stern light" :slight_smile:

...R

Don't use "headlight" at all, you've proven that to be ambiguous.

Torch, flash light, searchlight seem to get you in the same trouble.

Ouch, tough nut to crack..
Let me get back on that..

Neither of them needs to lose the name, but add a prefix to them. The one on the robot can be changed to robot_headlight and call the other one gimbal_headlight or whatever prefix is appropriate. Then document it at the head of the program.

Pete

"Spot lights" can be moved independent of the vehicle.

"Headlights" / "running lights" / "driving lights" / "brake lights" move with the vehicle.

Adjust the variable names accordingly.

(It sounds as though you should have made better use of object oriented techniques to encapsulate some of the names.)

Any_Old_Light_1.2.3 etc would cover it

sorry

Allan