Documentation‎ > ‎This and that...‎ > ‎

Static or dynamic?

Generally, data is supposed to be stored and contained in a database.
But in many cases it may be easier and more convenient to represent them hard-coded in the code. This is feasible only if the data never changes or very rarely changes, such as a list of countries. SopArticle is another example where this concept is illustrated.
 
The advantages:
  • the data can be type-safe referenced in the code,
  • no need to map related functions or contextual data (such as translations) to the (dynamic) data,
  • the database schema stays clean and tidy, and can be more easily maintained,
  • generally, much less code is needed (no DAO, JPA etc.).
Comments