Re^3: Templating system choice
by Your Mother (Archbishop) on Dec 21, 2020 at 16:48 UTC
|
Template::Toolkit (TT) is the most powerful templating language in Perl; well, maybe it’s really Mason, but that is a digression. It’s not necessarily a good thing.
My POV: I love and use Template and have for 15ish years. I don’t use it for new projects. It is complex enough that it becomes a mini-language, so you’re not really doing Perl and you’re not really handing off templates to designers or non-coders that they will be able to understand and edit. It can easily make a clean MVC design into spaghetti soup by embedding all three elements in templates.
Also TT is extremely slow compared to something like Text::Xslate. Xslate has the benefit of being a more pure View. It’s got a few affordances but it doesn’t really rise to the level of mini-language. If you’re using Mojo, its templates might be a better idea than TT.
The only clear advantage I see in learning TT is that many legacy projects use it, so it might be nice to know when job hunting.
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
|
|
| [reply] |
|
|
|
|
| [reply] |
|
|
It’s an order of magnitude faster. So TT3 would have to be like 1,000 faster than TT2 to even close most of the gap. If you’re not doing 30+ dynamic requests per second it won’t matter. On a heavy traffic site, 100–10,000+ requests per second it will be the difference between constant outages and transparent service; as long as everything else, like DB, is optimized/cached.
Update: Template::Alloy already runs older TT syntax much faster and it’s what I have used in the past.
| [reply] |
|
|
The only clear advantage I see in learning TT is that many legacy projects use it, so it might be nice to know when job hunting
It's nearly 2 decades since I was job hunting. I've worked for myself for long enough to know that I don't ever want to work for anyone else again - now things are the other way around as I employ people and have to cope with those challenges instead...
I love and use Template and have for 15ish years. I don’t use it for new projects.
This seems strange to me...
If you love Template and presumably you are very familiar with it from the time you have spent using it, why would you not use it for new projects?
| [reply] |
|
|
People are lazy. I am lazy. I gravitate toward what I know as opposed to what will make my future work and maintenance easier. MVC is an excellent rule of thumb; TT makes it trivial to break. Which makes writing new code quick for those handy with it at the expense of sometimes immense, even untenable, technical debt, AKA we need a total rewrite.
Discipline is hard. Correctness is hard. It pays benefits down the road. Depending. :P There are no actual rules in design, only rules of thumb.
| [reply] |
|
|
|
|
Also TT is extremely slow compared to something like Text::Xslate. Xslate has the benefit of being a more pure View.
Having looked at the documentation for Text::Xslate I see that it is "a template engine, tuned for persistent applications". As I rarely write persistent, or at least persistent applications with enough output to warrant a template, this is probably not the one for my needs.
Also Template Toolkit seems to have more extensive and clearer documentation and examples. These cover areas beyond just HTML. Web development is just a part of my coding so I think this is where I am going to start. It has also been around long enough that several Monks have become familiar with it so I can hopefully get the guidance I need when I inevitably get stuck 😊
| [reply] |
Re^3: Templating system choice
by LanX (Saint) on Dec 23, 2020 at 00:14 UTC
|
AFAIK does Mojolicious have a default template engine, but allows to plugin any other.
I'd wet my feet with Mojo first, then you'll know better which direction you wanna swim.
| [reply] |