Object naming conventions

I see many people using a technical way of naming their objects whereas I would keep them in a business readable way as thats the way how they show up in the reporting done to the stakeholders.

  • Are there any standard guidelines? Any comments on below

Here are mine

Logical name

  • Follow the visible element name/title on the screen or the associated label text
  • Only first character uppercase (so if on screen lowercase also first character lowercase)
  • No replacement of spaces with underscores
  • No prefixing like txt, btn, edt, tbl, ..... as from the class property you know what it is
  • No replacement of !@#$%^characters just apply rule 1 and only in exceptional scenario's replace it. (First of all your programming language should be able to handle the (unicode) string)

Technical name

If for whatever reason you need a more technical name just apply an algorithm on it like

  • Replace space with nothing / empty string
  • Strip out non [a-zA-Z] characters
  • Prefix based on the class type of the element

Comments

  • Looking at Sample Web Testing Project I have the following observations and try to understand why coding conventions are suddenly appearing everywhere and no where in frontends as there is as far as I am aware no technical need.

     

    strWouldBeFunIfIWouldStartTypingAllMyForumContributionsWithPrefixingIsHopefullyNotTheRightDirectionOfGUIFrontEnds.

    Example (tough to get a table and or picture in this answer so uploaded on free img site the table example)

    https://ibb.co/bZZQoQ

     
Sign In or Register to comment.