Skip to main content

Text Web Templates Considered Harmful

  • Conference paper
  • First Online:
Book cover Web Information Systems and Technologies (WEBIST 2019)

Abstract

For the last decades text-based templates have been the primary option to build dynamic web pages. Until today, no other alternative has rebutted this approach. Yet, using text-based templates has several drawbacks including: 1. blocking resolution, 2. programming languages heterogeneity, 3. limited set of templating features and 4. opinionated idioms. In this paper we show how a domain specific language (DSL) for HTML (such as HtmlFlow, Kotlinx.html or React JSX) can suppress the text-based templates limitations and outperform state-of-the-art template engines (such as JSP, Handlebars, Thymeleaf, and others) in well known benchmarks. To that end, we use the Spring Framework and the sample application PetClinic to show how a DSL for HTML provides unopinionated web templates with boundless resolving features only ruled by the host programming language (such as Java, Kotlin or JavaScript).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 64.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 84.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    wikipedia.org/Comparison_of_web_template_engines.

References

  1. Alur, D., Malks, D., Crupi, J.: Core J2EE Patterns: Best Practices and Design Strategies. Prentice Hall PTR, Upper Saddle River (2001)

    Google Scholar 

  2. Ase, D.: Kotlin DSL for HTML. Technical report (2015). https://j2html.com/

  3. Baker, H.G.: Iterators: signs of weakness in object-oriented languages. SIGPLAN OOPS Messenger 4(3), 18–25 (1993). https://doi.org/10.1145/165507.165514

    Article  Google Scholar 

  4. Binder, W., Hulaas, J., Moret, P.: Advanced Java bytecode instrumentation. In: Proceedings of the 5th International Symposium on Principles and Practice of Programming in Java, PPPJ 2007, pp. 135–144. ACM, New York (2007). https://doi.org/10.1145/1294325.1294344, http://doi.acm.org/10.1145/1294325.1294344

  5. Bösecke, M.: JMH benchmark of the most popular Java template engines. Technical report (2015). https://github.com/mbosecke/template-benchmark

  6. Breslav, A.: Kotlin Language Documentation (2016). https://kotlinlang.org/docs/kotlin-docs.pdf

  7. Brogden, B., D’Cruz, C., Gaither, M.: Cocoon 2 Programming: Web Publishing with XML and Java. Wiley, Hoboken (2006)

    Google Scholar 

  8. Carvalho, F.M.: HtmlFlow Java DSL to write typesafe HTML. Technical report (2017). https://htmlflow.org/

  9. Carvalho., F.M., Duarte., L.: Modern type-safe template engines (2018). https://dzone.com/articles/modern-type-safe-template-engines

  10. Carvalho., F.M., Duarte., L.: HoT: unleash web views with higher-order templates. In: Proceedings of the 15th International Conference on Web Information Systems and Technologies - Volume 1: WEBIST, WEBIST 2019, pp. 118–129. INSTICC, SciTePress (2019). https://doi.org/10.5220/0008167701180129

  11. Donald, K., Isvy, M., Leau, C.: Spring petclinic sample application. Technical report (2013). https://projects.spring.io/spring-petclinic/

  12. Duarte., L., Carvalho., F.M.: xmlet. Technical report (2018). https://github.com/xmlet

  13. Krasner, G.E., Pope, S.: A description of the model-view-controller user interface paradigm in the smalltalk80 system. J. Object Oriented Program. JOOP 1, 26–49 (1988)

    Google Scholar 

  14. Evans, E., Fowler, M.: Domain-driven Design: Tackling Complexity in the Heart of Software. Addison-Wesley (2004). https://books.google.pt/books?id=7dlaMs0SECsC

  15. Fernández, D.: Thymeleaf. Technical report (2011). https://www.thymeleaf.org/

  16. Fowler, M.: Patterns of Enterprise Application Architecture. Addison-Wesley Longman Publishing Co., Inc., Boston (2002)

    Google Scholar 

  17. Fowler, M.: Domain Specific Languages, 1st edn. Addison-Wesley Professional, Boston (2010)

    Google Scholar 

  18. Freeman, S., Mackinnon, T., Pryce, N., Talevi, M., Walnes, J.: Jmock library for test-driven development with mock objects. Technical report (2008). http://jmock.org

  19. Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley Longman Publishing Co., Inc., Boston (1995)

    MATH  Google Scholar 

  20. Heijlsberg, A., Torgersen, M.: The.net standard query operators (2007)

    Google Scholar 

  21. Hors, A.L., et al.: Document object model (DOM) level 3 core specification. Technical report (2004). https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/

  22. Jin, X., Wah, B.W., Cheng, X., Wang, Y.: Significance and challenges of big data research. Big Data Res. 2(2), 59–64 (2015). https://doi.org/10.1016/j.bdr.2015.01.006

    Article  Google Scholar 

  23. Johnson, R., et al.: The spring framework-reference documentation (2004). https://docs.spring.io/spring-framework/docs/3.2.x/spring-framework-reference/html/index.html

  24. Landin, P.J.: Correspondence between ALGOL 60 and church’s lambda-notation: Part I. Commun. ACM 8(2), 89–101 (1965)

    Article  MathSciNet  Google Scholar 

  25. Landin, P.J.: The next 700 programming languages. Commun. ACM 9(3), 157–166 (1966)

    Article  Google Scholar 

  26. Marx, S., Odersky, M., Buckley, A.: Jsr 14: Add generic types to the Java. Technical report, Java Community Process (2004). https://jcp.org/en/jsr/detail?id=14

  27. Mashkov, S.: Kotlin DSL for HTML. Technical report (2015). https://github.com/Kotlin/kotlinx.html

  28. Meijer, E.: Your mouse is a database. Queue 10(3), 20:20–20:33 (2012). https://doi.org/10.1145/2168796.2169076, http://doi.acm.org/10.1145/2168796.2169076

  29. Mutschler III, E.O., Stefaniak, J.P.: Method for extending the hypertext markup language (HTML) to support enterprise application data binding, 17 August 1999. US Patent 5,940,075

    Google Scholar 

  30. Parker, H.: Opinionated analysis development. PeerJ Prepr. 5, e3210v1 (2017)

    Google Scholar 

  31. Parr, T.J.: Enforcing strict model-view separation in template engines. In: Proceedings of the 13th International Conference on World Wide Web, WWW 2004, pp. 224–233. ACM, New York (2004). https://doi.org/10.1145/988672.988703. http://doi.acm.org/10.1145/988672.988703

  32. Reijn, J.: Comparing template engines for spring MVC. Technical report (2015). https://github.com/jreijn/spring-comparing-template-engines

  33. Resig, J.: Pro JavaScript Techniques. Apress, New York (2007)

    Google Scholar 

  34. Singh, I., Johnson, M., Stearns, B.: Designing Enterprise Applications with the J2EE Platform. Addison-Wesley Professional, Boston (2002)

    Google Scholar 

  35. Ted, N.: Literary Machines. Mindful Press, Sausalito (1994)

    Google Scholar 

  36. Thompson, K.: Programming techniques: regular expression search algorithm. Commun. ACM 11(6), 419–422 (1968). https://doi.org/10.1145/363347.363387

    Article  MATH  Google Scholar 

  37. Walke, J.: React Javascript library for building user interfaces. Technical report (2013). https://reactjs.org/

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Fernando Miguel Carvalho .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Carvalho, F.M., Duarte, L., Gouesse, J. (2020). Text Web Templates Considered Harmful. In: Bozzon, A., Domínguez Mayo, F.J., Filipe, J. (eds) Web Information Systems and Technologies. WEBIST 2019. Lecture Notes in Business Information Processing, vol 399. Springer, Cham. https://doi.org/10.1007/978-3-030-61750-9_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-61750-9_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-61749-3

  • Online ISBN: 978-3-030-61750-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics