Constants vs Database

Certified Lead Developer

Hi all,

I am developing an application that contains a questionnaire with around 20 questions. There are also around 10 sections to display help. 

Both questions and help can be updated by the users. 

I dont know if I should create 30 constants or store the data in the DB.

For performance reasons I think is better to use constants but for memory management and scalability I think the DB makes more sense.

Is there any recommendation about this?

  Discussion posts and replies are publicly visible

Parents
  • If questions will be editable in any respect, including changes to existing questions and/or addition or removal of questions, the clear winner is the DB based solution, since managing that via constants would be either difficult or impossible.  Doing this in its own DB table also lets you easily store and use other metadata with each question, like if you want to get tricky with multiple question types, answer styles, etc.

Reply
  • If questions will be editable in any respect, including changes to existing questions and/or addition or removal of questions, the clear winner is the DB based solution, since managing that via constants would be either difficult or impossible.  Doing this in its own DB table also lets you easily store and use other metadata with each question, like if you want to get tricky with multiple question types, answer styles, etc.

Children
No Data