Seite 1 von 1

Class fields naming convention and style

Verfasst: Di 27. Aug 2013, 15:19
von Michael_S
Hi All,

What Naming Convention and Style would the group recommend for Class fields?

I've been using bumpy caps / camel caps for a long time now and including the Class name. For example if I have a Class called 'Article' I would name my fields in the singular ... 'ArticleTitle', 'ArticleDescription', 'ArticleMapLat', 'ArticleMapLong'.

Would the group consider the inclusion of the Class name 'noise' or useful in certain situations?

Michael.

Re: Class fields naming convention and style

Verfasst: Di 27. Aug 2013, 15:52
von Carrear
I dont like to use prefixes. I just call my fields like "title", "content" a.s.o. When i call this fields in a listview or something like that, than i know, which class i am talking about, so there is no problem.

Pro:
In different Classes with similar fields like "title" and "content" i can create queries over all classes without calling all the different "title" fields (e.g. "ArticleTitle", "DateTitle", a.s.o.).

Re: Class fields naming convention and style

Verfasst: Di 27. Aug 2013, 16:49
von Michael_S
Hi Carrear,

I can see that the single words have advantages when working with queries but then you get into the issue of case sensitive reserved words "Title, Description, Keywords" so you would have to use lowercase words. But then you still need a way of delimiting the words as a single string would be hard to read and easy to mistype.

Michael.

Re: Class fields naming convention and style

Verfasst: Di 27. Aug 2013, 21:49
von Carrear
Yes :D I am working with german titles (titEl, Inhalt (like content) a.s.o.) so im working with short keywords that are not crashing with system keywords like meta datas :)