Search code examples
refactoringnaming-conventionsnamingbusiness-logic

Refactoring Business Rule, Function Naming, Width, Height, Position X & Y


I am refactoring some business rule functions to provide a more generic version of the function.

The functions I am refactoring are:

DetermineWindowWidth
DetermineWindowHeight
DetermineWindowPositionX
DetermineWindowPositionY

All of them do string parsing, as it is a string parsing business rules engine.

My question is what would be a good name for the newly refactored function? Obviously I want to shy away from a function name like:

DetermineWindowWidthHeightPositionXPositionY

I mean that would work, but it seems unnecessarily long when it could be something like: DetermineWindowMoniker or something to that effect.

Function objective: Parse an input string like 1280x1024 or 200,100 and return either the first or second number. The use case is for data-driving test automation of a web browser window, but this should be irrelevant to the answer.

Question objective: I have the code to do this, so my question is not about code, but just the function name. Any ideas?


Solution

  • It seems this question-answer provides a good starting point to answer this question: Appropriate name for container of position, size, angle

    A search on www.thesaurus.com for "Property" gives some interesting possible answers that provide enough meaningful context to the usage:

    Aspect
    Character
    Characteristic
    Trait
    Virtue
    Property
    Quality
    Attribute
    Differentia
    Frame
    Constituent
    

    I think ConstituentProperty is probably the most apt.