Click here to Skip to main content
15,887,746 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Names Pin
User 991608022-Apr-21 4:36
professionalUser 991608022-Apr-21 4:36 
GeneralRe: Names Pin
grralph122-Apr-21 5:25
grralph122-Apr-21 5:25 
GeneralRe: Names Pin
honey the codewitch22-Apr-21 5:44
mvahoney the codewitch22-Apr-21 5:44 
GeneralRe: Names Pin
grralph122-Apr-21 14:05
grralph122-Apr-21 14:05 
GeneralRe: Names Pin
Mike Winiberg22-Apr-21 21:21
professionalMike Winiberg22-Apr-21 21:21 
GeneralRe: Names Pin
grralph122-Apr-21 23:56
grralph122-Apr-21 23:56 
GeneralRe: Names Pin
honey the codewitch23-Apr-21 2:01
mvahoney the codewitch23-Apr-21 2:01 
GeneralRe: Names Pin
Stefan_Lang2-May-21 3:02
Stefan_Lang2-May-21 3:02 
I think that the single responsibility principle (from SOLID) is directly linked to names: if you make sure that your function or class or even variable just fulfills a single purpose, then you should also be able to name it appropriately, using that purpose. Or, the other way round: if you find that parts of a name you're looking at describe different purposes, then there is likely a copnflict with the single responsibility principle!

In other words, clean code leads to good, and reasonably short names.

But let's look at your examples:
doubleCalculateOffsetForWaveFunction(intScaleFactorForWaveFunction,floatWaveFunctionSeedValue)
doubleCalculateOffsetForInverseWaveFunction(intScaleFactorForWaveFunction,floatWaveFunctionSeedValue)

In these names, the type information does absolutely nothing to explain the purpose, so these parts must go. Next, the function names describe what the result is used for (the (inverse) wave function). This info should go into the argument list, not the name. That will also make the calculateOffset functionality easier to refactor: if there's anything you need to fix or change in the offset calculation, having just one function to look at is always preferable to having >1 functions!

As for naming style, I consider '_' separators to be more readable than any other style, but TBH I couldn't care less, so let's stick with what you had. With my comments above, you get just one function instead of two:
calculateOffset(scaleFactor, seedValue, functionType)


Since the function type goes into the argument list anyway, I've dropped it from the argument names. I'd also drop the meaningless suffix 'Value', but it's already a lot more readable. And all that without losing any information!
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

GeneralRe: Names Pin
Mike Winiberg2-May-21 5:32
professionalMike Winiberg2-May-21 5:32 
GeneralRe: Names Pin
Stefan_Lang4-May-21 1:41
Stefan_Lang4-May-21 1:41 
GeneralRe: Names Pin
Mike Winiberg4-May-21 5:12
professionalMike Winiberg4-May-21 5:12 
GeneralRe: Names Pin
Stefan_Lang4-May-21 8:48
Stefan_Lang4-May-21 8:48 
GeneralRe: Names Pin
Mike Winiberg4-May-21 10:38
professionalMike Winiberg4-May-21 10:38 
GeneralRe: Names Pin
Mike Winiberg4-May-21 11:11
professionalMike Winiberg4-May-21 11:11 
GeneralRe: Names Pin
Sander Rossel22-Apr-21 9:24
professionalSander Rossel22-Apr-21 9:24 
GeneralRe: Names Pin
grralph122-Apr-21 14:04
grralph122-Apr-21 14:04 
GeneralRe: Names Pin
Wizard of Sleeves22-Apr-21 20:52
Wizard of Sleeves22-Apr-21 20:52 
GeneralRe: Names Pin
grralph123-Apr-21 0:28
grralph123-Apr-21 0:28 
GeneralRe: Names Pin
Stefan_Lang2-May-21 3:17
Stefan_Lang2-May-21 3:17 
GeneralRe: Names Pin
Daniel Will22-Apr-21 21:22
Daniel Will22-Apr-21 21:22 
GeneralRe: Names Pin
grralph122-Apr-21 23:59
grralph122-Apr-21 23:59 
GeneralRe: Names Pin
Member 1068017923-Apr-21 2:56
Member 1068017923-Apr-21 2:56 
GeneralRe: Names Pin
Rusty Bullet23-Apr-21 3:09
Rusty Bullet23-Apr-21 3:09 
GeneralRe: Names Pin
BernardIE531723-Apr-21 5:00
BernardIE531723-Apr-21 5:00 
GeneralRe: Names Pin
grralph123-Apr-21 22:36
grralph123-Apr-21 22:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.