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.
Class fields naming convention and style
- Carrear
- webEdition Partner
- Beiträge: 646
- Registriert: Do 17. Jan 2013, 03:02
- Wohnort: Hannover
- Kontaktdaten:
Re: Class fields naming convention and style
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.).
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.).
-
- Senior Member
- Beiträge: 160
- Registriert: Mi 4. Feb 2004, 02:39
- Wohnort: London / UK
- Kontaktdaten:
Re: Class fields naming convention and style
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.
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.
- Carrear
- webEdition Partner
- Beiträge: 646
- Registriert: Do 17. Jan 2013, 03:02
- Wohnort: Hannover
- Kontaktdaten:
Re: Class fields naming convention and style
Yes 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
Wer ist online?
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast