Websites on the web can consist of three layers:

  • presentation layer - user interface
  • logic layer
  • database

If a website only has the presentation layer it is a static website, otherwise it is a dynamic_ website.

Differences

Main characteristic of the static websites is that they always display identical pages and content for all people who access it, due to lack of any logic layer. They are pre-built and present unchanging information.

Dynamic website can take an input and perform operations like querying a database, so their output changes. They need to implement logic and/or database layers but allow for more interactive and personalized experience.

Trade-offs

Advantages of Static Websites

  • Speed - due to being prebuilt static websites are very fast without requiring a lot of data transfer
  • Ease of development - static websites are simpler and involve fewer components, which makes them easier to create and maintain
  • Security - due to lack of logic and database connection, no personal information can be endangered

Advantages of Dynamic Websites

  • Flexibility - due to implementing it’s own logic, a dynamic website offers more possibilities for manipulating data
  • Content generation - content on dynamic websites may be fetched from database or generated
  • Personalization - dynamic websites may provide personalized experience based on user input or other data