[erlang-questions] Is it a best practice to have table_name and record same?

Bengt Kleberg <>
Wed Dec 16 14:27:08 CET 2009


Greetings,

Please use a new record: -record(country_code, {country, code}).
It helps the readability of your code.


bengt

On Wed, 2009-12-16 at 18:25 +0600, MAthuvathanan Mou. wrote:
> Hi all,
> 
> I have record with two parameters like
> 
> -record(user, {name, password}).
> 
> I am using above record for a user table.
> 
> I need to create another table country_code with country and code.
> 
> Is it all correct to re-use above record for country_code as well or else do
> I have to create another record like
> 
> -record(country_code, {country, code}).
> 
> Or else, should I create a common record with two parmeters like
> 
> -record(two_params, {first, second}).
> 
> Which one is good practice?
> 
> Thanks
> 



More information about the erlang-questions mailing list