Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 884527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:45:51+00:00 2026-05-15T12:45:51+00:00

Everyone who’s done any web application development in Scala knows that you can use

  • 0

Everyone who’s done any web application development in Scala knows that you can use any existing Java web framework, or you can use Lift. Something that all of these frameworks have in common is that they all require two or more files to generate a page: an HTML template of some kind, and one or more classes to provide associated logic. Even if you’re writing a JSP-only app, you’re probably still making use of lots of custom tags.

And this brings me to something I’ve noticed: the template files often bear little resemblance to HTML. Wicket template files are pretty much HTML because in Wicket, components bind themselves to HTML tags in the template. But in all the frameworks that are based on custom tags, the templates are generally full of custom tags and are not renderable in a browser on their own.

Scala supports embedding arbitrary XML directly into the program source. Here is a Scala function that make an unnumbered list from a collection:

def listify[T](items: Iterable[T], liBody: T => NodeSeq) = <ul>{
  items.flatMap(i => <li>{liBody(i)}</li>)
}</ul>

Now if I have that, I’ve already abandoned architectural purity because I have ul and li tags in the “controller,” or “business logic,” or “backing object,” or whatever you call it, and not in the template. Yet this is a pretty clear and straightforward way of creating a list. Doing it any other way requires substituting some run-time tag-binding framework in place of Scala’s own built-in features.

So I’m wondering, why not just go the other way and get rid of the templates? If Scala is useful for creating an unnumbered list, then why can’t it also create whatever contains the unnumbered list? And all the way up the page back to the html tag.

The question I’m asking is: given a language that already includes powerful support for XML, are there significant benefits to using template files and transforming them into actual HTML at run time, or is it better to just consider template files as artifacts carried over from languages without built-in XML support and abandon them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:45:52+00:00Added an answer on May 15, 2026 at 12:45 pm

    I think the main reason is for tooling support. It is easier to support tooling when part of the project is strictly XML (the template files). It is far trickier (though not impossible), to manipulate code from a design tool.

    Also, in most production environments, the abstraction of business logic from the “view” (using whatever paradigm you like best, MVC, MVP, etc..) is critical. Any project large enough would likely be too unwieldy to go without it. Remember that in production environments, there are often more than one programmer, and sometimes new programmers join the team or existing ones move, so it’s not really optional. Most of the efforts of web framework designers are invested in this use case, so functionality which breaks this abstraction is less of a priority.

    However, I could see where an internal scala DSL for web development might be useful for small projects. It would certainly not be unwise to invest your time in creating a light-weight framework for such use, if you would find it useful. Chances are, if you created it and found it useful, others might too.

    Suggested resources:

    • Programming Scala, Chapter 10: Herding XML in Scala
    • Programming Scala, Chapter 11: Domain-Specific Languages in Scala
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Everyone (at least everyone who uses a compiled language) has faced compilation errors but
Everyone I work with is obsessed with the data-centric approach to enterprise development and
Everyone managing open-source-software runs into the problem, that with the time the process of
Everyone in my office uses Macs and therefore most use Safari. We have a
I know everyone who reads the question will think Firebug! right away. Maybe some
Update: Thanks for everyone who helped out - the answer to this one lay
For some reason everyone who upgrades their Flash Player to the latest version (10,0,32,18)
These days everyone who worked in mobile software talks about Android and iPhone. I
Thanks to everyone who helped me with my last question. This is a similar
Thank you to everyone who tries to help! I have 2 case select statements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.