22
Views
4
Comments
Solved
Attributes - Which is better First_Name or FirstName
Question

I have a basic question, what is the best methodology to use when naming attributes in entities?


First_Name or FirstName ?


Thanks,

Otis

mvp_badge
MVP
Rank: #19
Solution

Hi Otis,

By using naming conventions you make code more easy to understand by fellow developers that maybe need to read or change your code.

The OutSystems naming convention uses CamelCase.

So I suggest you use FirstName instead of First_Name.

There is another benefit, the length of names are limited in OutSystems. So with CamelCase you have more positions available for a meaningful name as you do not loose positions on one or more underscores.

Regards,

Daniel

mvp_badge
MVP
Rank: #128

Hi,


As per my understanding we should use FirstName as a attribute in DB.


Thanks.

mvp_badge
MVP
Rank: #19
Solution

Hi Otis,

By using naming conventions you make code more easy to understand by fellow developers that maybe need to read or change your code.

The OutSystems naming convention uses CamelCase.

So I suggest you use FirstName instead of First_Name.

There is another benefit, the length of names are limited in OutSystems. So with CamelCase you have more positions available for a meaningful name as you do not loose positions on one or more underscores.

Regards,

Daniel

Hi Otis,

There are multiple factors that you can consider to come up with what best suits your application, below are some pointers.

1. The standard naming convention used in your or customer's organisation. Usually every organisations has its own standards defined.

2. Readability - With Camel case too one can easily distinguish words from each other, however with underscores in between makes it more readable.

3. Max Length Restriciton - This could still be overcome using abbreviations which are typically defined at project or organisation level. Further you have description attribute which could be used to add more information for each entity or its attribute.

To conclude, first follow the standards defined within your or customer's organisation, and if there are none then go with what suits your project as well as your team the best. However, ensure that you follow one or the other approach consistently. 


Hope this helps!

Junaid

mvp_badge
MVP
Rank: #74

Hi Otis,

In addition, check out the Platform Best Practices with regard to Naming Conventions.

Regards,

Nordin