Alternative templating schemes

just to be clear:

I use tags in less than 1% of the components that I write – in most
cases it’s just that one component that does the rendering.

that doesn’t mean, however, that it is not an important feature of the
language.

the bottom line, as far as I’m concerned, is that “tag islands” in
script would be a great feature.On 2/12/2015 5:49 PM, Igal @ Lucee.org wrote:

Option 2)
Don’t have a UIRenderer component but have tag-based custom tags for rendering your widget (lists) or pagination etc. THAT is what tag-based custom tags are really good at and useful for. Then on your page it’d actually uses the custom tags which probably fits nicely into whatever layout templating or page wrapper setup you prefer.

Personally, I think option 2 is much to be preferred as it separates rendering (tag based in custom tags or templates) from business logic (script based in components) very nicely.
right. that’s the way I used to do it before components were introduced
into the language. but

  1. it proved to be much slower to begin with.

  2. by using functions I can use cachedWithin, so for example, if I pass
    a widgetId and the function has to do a lookup to get more details (like
    name, price, etc), this can all be cached by Lucee internally, which
    makes it even more performant.

  3. it keeps all of my rendering code in a single file, so it’s much
    easier to find the piece I’m looking for when I need to do so.

On 2/12/2015 5:39 PM, Kai Koenig wrote:

  1. the main difference between you (plural) and I is that you try to push me to do things your way, while I prefer to keep my options open
    I would strongly debate that, but that’s a different discussion.
  1. Kai – the fact that you don’t understand something doesn’t make it bullsht. I’ve always treated you with respect – it’d be nice if you’d try to do the same
    Just to make things clear - the bullish
    t comment was not targeting you in particular but anyone in this discussion trying to convince me of breaking away from common-sense separation of concerns architectural principles without providing a use case why their proposed solution is better.

Now you HAVE supplied such a case (see below) and we can discuss your argument. That has nothing to do with not understanding something at all.

  1. I will try to show an example of what I mean, hopefully the oversimplification will not make it miss the point
    a) I don’t see how the approach below differs from what Abram’s said:

"So, what would stop you from just including a cfm file with your UI stuff if you want it inside a cfc? To me that is the cleaner approach.”

To me, that’d be a much clearer approach, too, instead of sticking markup into a component. If you really wanted to have a UIRenderer component.

b) Let’s assume you did NOT have tags in components, how would this requirement be solved nicely?

Option 1)
Script component including a tag/markup file. That’s essentially the CFML-based version of a mixin (well, -ish) and I don’t think there’s anything wrong with that.

Option 2)
Don’t have a UIRenderer component but have tag-based custom tags for rendering your widget (lists) or pagination etc. THAT is what tag-based custom tags are really good at and useful for. Then on your page it’d actually uses the custom tags which probably fits nicely into whatever layout templating or page wrapper setup you prefer.

Personally, I think option 2 is much to be preferred as it separates rendering (tag based in custom tags or templates) from business logic (script based in components) very nicely.

Cheers
Kai

So, what would stop you from just including a cfm file with your UI
stuff if you want it inside a cfc? To me that is the cleaner approach.

this is like asking “why do we need functions or custom tags in the
language when we can just write the function’s body into a snippet and use
cfinclude…”

No Igal, actually your position is more like that. Rolling disparate
pieces of code into one location, instead of separating it out.

there are times when you want to include a snippet/template, there are
times when you want to use custom tags, and there are times when you want
to use functions.

Well indeed. However you’re eschewing all of those options, instead
claiming that one might as well mix the tags and code into the same piece
of code. Abram’s merely suggesting the minimum level of abstraction.On 13 February 2015 at 00:32, Igal @ Lucee.org <@Igal> wrote:


Adam

one comment to this, we are only speaking about have extrernal files to
produce html.

What is nothing else than information formatted in a specific way (html)
for a specific purpose (show in browser).
So we provide an interface for a specific client, but that is for sure not
the only interface we provide, we can and do provide interfaces for all
kind of client text and binary based, so does this mean that i have to do
everything I write to the response stream of a client in an external
template or only html?
Take this example:
component {
function produceMarkdown(string title, string text){
echo(“##”&title&"##
"&text);
}
}

following your logic I need to move this to an external template because we
need to separate business logic from output in any case, right? or is this
different and if so why?
Who is defining where we draw the line?
Then they are cases where it makes sense to produce output in a component
and some maybe not, but in my opinion it is NOT up to the engine to decide!

MichaOn Fri, Feb 13, 2015 at 6:04 AM, Kai Koenig <@Kai_Koenig> wrote:

Option 2)
Don’t have a UIRenderer component but have tag-based custom tags for
rendering your widget (lists) or pagination etc. THAT is what tag-based
custom tags are really good at and useful for. Then on your page it’d
actually uses the custom tags which probably fits nicely into whatever
layout templating or page wrapper setup you prefer.

Personally, I think option 2 is much to be preferred as it separates
rendering (tag based in custom tags or templates) from business logic
(script based in components) very nicely.
right. that’s the way I used to do it before components were introduced
into the language. but

  1. it proved to be much slower to begin with.

  2. by using functions I can use cachedWithin, so for example, if I pass
    a widgetId and the function has to do a lookup to get more details (like
    name, price, etc), this can all be cached by Lucee internally, which
    makes it even more performant.

Ok, 1) and 2) are valid reasons from your point of view and that’s fair
enough. However, those should be of no concern when it comes to spec’ing a
new language as they’re implementation details of the Lucee server at this
point.

If custom tags are slower now, that’d need be looked into and I’m sure
there’ll be a way for better caching in a revised implementation of custom
tags, too. Essentially, saying components are better/preferred because of
the reasons mentioned is imho as bad as premature optimisation of code.

  1. it keeps all of my rendering code in a single file, so it’s much
    easier to find the piece I’m looking for when I need to do so.

Playing devil’s advocate I could now say: Ok, let’s put everything for a
page into one file, much easier to find stuff then, right?

Obviously it’s not that easy, but I personally think using an UIRenderer
component with functions to create HTML is good architectural practice. I
strongly think it’s the other extreme of putting business logic into your
cfml page template. If you chose to do that, that’s your option, but a new
language shouldn’t endorse that at all but instead opt for a clear
separation between what the respective components of the language are good
at.

Cheers
Kai


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/A08CB133-72E9-4B3C-8F9B-4CE4633EEC8F%40gmail.com
.
For more options, visit https://groups.google.com/d/optout.

In my opinion we need no prefix for tags, so simply

#now()# <!— no output necessary! —>
<!— attribute values with no " are handled as
expression, not strings! —>

<!— ignored and outputed as it is —>

the tags Lucee does not know are simply ignored then.

Fair enough. I like some prefix just because it makes it easier to find
“code” in amongst the markup.

TBH, I’m all for actually maintaining the namespacing. The Lucee stuff is
code and the mark-up is… well… markup. It doesn’t seem right to
actively remove that abstraction.

Then again I’m always the first to complain about “<cf” being everywhere in
CFML code unnecessarily, so that’s quite a paradox I have there. Hmmm.On 12 February 2015 at 21:06, Sean Corfield <@Sean_Corfield> wrote:


Adam

You already only need to implement the start/end tag handling if you
need the distinction
. If you don’t need that distinction, you don’t need
to code for it.

Unless you are being thoroughly defensive and want to defend against
calls causing a double output. Have
something built with a purer purpose is my point I think.–
Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn
http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB

Oh fuck off Igal.

I assure you /that/ is not the chief difference between you (singular)
and myself and Kai.
right. you’re also an asshole!On 2/12/2015 5:16 PM, Adam Cameron wrote:

On 13 February 2015 at 01:01, Igal @ Lucee.org <@Igal mailto:Igal> wrote:

1) the main difference between you (plural) and I is that you try
to push me to do things your way, while I prefer to keep my
options open.

Oh fuck off Igal.

I assure you /that/ is not the chief difference between you (singular)
and myself and Kai. However it would be “indelicate” of me to point
out what /is/ the chief difference.

so you create a Renderer component where you put some of your
rendering functions (the ones that apply to multiple pages, like so:

<cfcomponent name="UIRenderer">
   
    <cffunction name="renderSmallWidgetThumbnail">
        <cfargument name="widgetId">

        <!--- code goes here to render html with thumbnail, name,
price, etc !--->
    </cffunction>

    <cffunction name="renderLargeWidgetThumbnail">
        <cfargument name="widgetId">

        <!--- code goes here to render html with thumbnail, name,
price, etc !--->
    </cffunction>

    <cffunction name="renderPagination">
        <cfargument name="baseUrl">
        <cfargument name="pageNumber" default="1">
        <cfargument name="pageSize" default="20">

        <!--- render links for pages 1 .. N or whatever !--->
    </cffuntion>
</cfcomponent>

then on each page that uses those you can instantiate the
component and call the functions, for example, on pages that show
items thumbnails, you do:

You’ve demonstrated at least Abram’s point with your own blimin’
example! You’ve gone and factored-out all the mark-up! Why’s that?
Because it’s a different concern than the code.

Having a comment which amounts to “mark-up goes here” is the
equivalent of sticking it in an include, which also basically says
“mark-up [will go] here”.


Adam

You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAFwR%2BKcgcsghL-TZzz3zK_F0msqwCdbgHRXJs6PYyUVCs-620g%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAFwR%2BKcgcsghL-TZzz3zK_F0msqwCdbgHRXJs6PYyUVCs-620g%40mail.gmail.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

what makes again a simple custom tag mapping impossible…
again sometimes separation complicates things :wink:

MichaOn Fri, Feb 13, 2015 at 1:52 AM, Adam Cameron <@Adam_Cameron1> wrote:

On 13 February 2015 at 00:37, Kai Koenig <@Kai_Koenig> wrote:

  1. Funny, in another thread I was told by Micha that tag-based custom
    tags are bad and should not exist — that we all should use component-based
    custom tags because it’s all about the simplification and cleanup of the
    language…

I like the CFC-based custom tags because they better compartmentalise the
before / after logic and the tag inheritance. I take a look at Railo’s ones
here: Adam Cameron's Dev Blog: Railo: CFC-based custom tags

However I still don’t feel right putting any blocks of mark-up in them. If
I needed an actual view or even a viewlet, I’d probably still factor that
out into a separate file, and just include it when necessary.


Adam


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAFwR%2BKfnrRrnSfH2Lm7M3z9mv-ApvC-5nquq0%2BwvF57WEfDyFg%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAFwR%2BKfnrRrnSfH2Lm7M3z9mv-ApvC-5nquq0%2BwvF57WEfDyFg%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

I don’t understand why the insistence to remove features that you guys
don’t like.

No-one’s suggesting removing anything from anywhere.

We’re suggesting they shouldn’t go in in the first place. We’re talking
about .lucee, not .cfm/.cfc. You can do whatever you like with your CFML
files. We just don’t think it’s a great approach and oughtn’t be
encouraged, therefore - if left up to us - isn’t something that should be put
into
.lucee. It’s work to implement it for .lucee, and not work that
really would have much merit compared to applying the resources elsewhere.On Friday, 13 February 2015 19:39:45 UTC+13, Igal wrote:


Adam

Oh fuck off Igal.

I assure you that is not the chief difference between you (singular) and myself and Kai.
right. you’re also an asshole!

Jeez, could the two of you stop insulting each other, please?

I will respond on topic in a minute.

Sigh
Kai

What would be interesting to play with, is a core language feature to
render a view completely in its own context so that it is entirely self
contained (similar to cfmodule but without the starttag/endtag stuff). The
view then becomes like a standalone CFC with its own API for rendering
(params that it declares that it needs).

You already only need to implement the start/end tag handling if you need
the distinction
. If you don’t need that distinction, you don’t need to
code for it.On 13 February 2015 at 22:11, Dominic Watson <@Dominic_Watson> wrote:


Adam

i like the idea that all tags are part of the language and you simply can
chose to manipulate them or not.

MichaOn Fri, Feb 13, 2015 at 2:02 AM, Adam Cameron <@Adam_Cameron1> wrote:

On 12 February 2015 at 21:06, Sean Corfield <@Sean_Corfield> wrote:

In my opinion we need no prefix for tags, so simply

#now()# <!— no output necessary! —>
<!— attribute values with no " are handled as
expression, not strings! —>

<!— ignored and outputed as it is —>

the tags Lucee does not know are simply ignored then.

Fair enough. I like some prefix just because it makes it easier to find
“code” in amongst the markup.

TBH, I’m all for actually maintaining the namespacing. The Lucee stuff is
code and the mark-up is… well… markup. It doesn’t seem right to
actively remove that abstraction.

Then again I’m always the first to complain about “<cf” being everywhere
in CFML code unnecessarily, so that’s quite a paradox I have there. Hmmm.


Adam


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAFwR%2BKdjjFUVBGX%3DEPBkuW%3DbOnL-0s9xPb1E36LM1vdLAgiHfw%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAFwR%2BKdjjFUVBGX%3DEPBkuW%3DbOnL-0s9xPb1E36LM1vdLAgiHfw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

So, what would stop you from just including a cfm file with your UI stuff if you want it inside a cfc? To me that is the cleaner approach.
this is like asking “why do we need functions or custom tags in the language when we can just write the function’s body into a snippet and use cfinclude…”

No Igal, actually your position is more like that. Rolling disparate pieces of code into one location, instead of separating it out.

Fully agreeing with Adam (btw: awesome to have you in my timezone for a change — helps immediate responses) :)> On 13 February 2015 at 00:32, Igal @ Lucee.org <@Igal> wrote:

  1. Funny, in another thread I was told by Micha that tag-based custom tags
    are bad and should not exist — that we all should use component-based
    custom tags because it’s all about the simplification and cleanup of the
    language…

I like the CFC-based custom tags because they better compartmentalise the
before / after logic and the tag inheritance. I take a look at Railo’s ones
here: Adam Cameron's Dev Blog: Railo: CFC-based custom tags

However I still don’t feel right putting any blocks of mark-up in them. If
I needed an actual view or even a viewlet, I’d probably still factor that
out into a separate file, and just include it when necessary.On 13 February 2015 at 00:37, Kai Koenig <@Kai_Koenig> wrote:


Adam

I merely agreed with Adam that there was a bigger difference between him
and I.

I am always respectful in my replies, but some people here think that I
owe them something, or whatever. I don’t.

and Adam should not talk to me like that, nor to anyone else in this forum.On 2/12/2015 5:25 PM, Kai Koenig wrote:

Oh fuck off Igal.

I assure you /that/ is not the chief difference between you
(singular) and myself and Kai.
right. you’re also an asshole!

Jeez, could the two of you stop insulting each other, please?

I will respond on topic in a minute.

Sigh
Kai


You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/346FC818-E214-4A33-A908-9E3E8390D7C2%40gmail.com
https://groups.google.com/d/msgid/lucee/346FC818-E214-4A33-A908-9E3E8390D7C2%40gmail.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

So, what would stop you from just including a cfm file with your UI
stuff if you want it inside a cfc? To me that is the cleaner approach.
this is like asking “why do we need functions or custom tags in the
language when we can just write the function’s body into a snippet and
use cfinclude…”

there are times when you want to include a snippet/template, there are
times when you want to use custom tags, and there are times when you
want to use functions.

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/On 2/12/2015 3:56 PM, Adam Cameron wrote:

On Friday, 13 February 2015 11:31:04 UTC+13, Abram Adams wrote:

So, what would stop you from just including a cfm file with your
UI stuff if you want it inside a cfc?  To me that is the cleaner
approach.

Yup. “Separation of concerns” and all that sort of thing.

If one thinks one needs to start writing tags (where the intent of the
tags would be specifically for preparing a string for output) in a
component file, then one’s gone off the tracks, I think.

If one has view-helper type things (which take a block of text and
manipulate it for render), then I’d use a custom tag if anything.


Adam

You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/0ec8da1f-c2d2-43e1-ac57-9aa2b98122a3%40googlegroups.com
https://groups.google.com/d/msgid/lucee/0ec8da1f-c2d2-43e1-ac57-9aa2b98122a3%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

I disagree! I think that you’ve argued it better ;)On 2/13/2015 4:07 AM, Nando Breiter wrote:

To me, Igal, Dave and Micha have both argued the case for using
rendering functions & components better than I could. I would only add
that in my case, I’ve used functions to render portions of very
complex views, and found that the technique made it much easier to
reason through what needed to be done. Each function of several might
be called 100’s of times to render an entire view, and each does some
/discreet/ amount of conditional processing, looping, formatting, etc,
and I will sometimes chain them.

Another option would have been to build up a very complex data
structure that mimics the presentation structure needed, and then pass
that into a monster block of intertwined nested loops, conditionals
and html. I’ve done that. I’m not good at it. This approach takes me
far longer, and when I need to come back into it to make
modifications, it can take me hours to reason through these large
structures and then attempt to make the change needed, usually
proceeding by trial and error until I get it. Using rendering
functions, I can much more easily jump in, see how it works as a whole
and as discreet elements, and make the change needed accurately and
quickly.

I will admit that I can take a long time to first grasp and then
reason through very complex structures, and that may simply be my own
shortcoming.

I don’t like custom tags for cases like these, because they are off in
separate files. I’ve always found them less straightforward to use
than functions.

To be clear, I only create rendering functions if the view is
sufficiently complex, and if I use them, I set output to false, use
cfsavecontent, and return the generated string.

Would love to see tag islands added. I’ve built some rendering
functions in script, because I much prefer using script, but as things
stand, it’s simply easier to use cf tag syntax for this.

Aria Media Sagl
Via Rompada 40
6987 Caslano
Switzerland

+41 (0)91 600 9601
+41 (0)76 303 4477 cell
skype: ariamedia

On Fri, Feb 13, 2015 at 10:22 AM, Michael Offner <@Michael_Offner mailto:Michael_Offner> wrote:

the attribute output is only really necessary with tag based
components, then only they produce output "on their own".
script based code only producing output when you do a echo(...),
so why suppress your own actions by default?

Micha


On Fri, Feb 13, 2015 at 10:18 AM, Dominic Watson <@Dominic_Watson <mailto:@Dominic_Watson>> wrote:

    If that were a .lucee.cfc (or whatever), I'd like to see that
    output=false would be default. I would strongly discourage
    that kind of use of a CFC function and be pleased if the
    language to a lead in doing so too. i.e. why have the function
    output anything when it can return the value:

    component {
        public string function markdownTitleAndDescription(
    required string title, required string description )
    output=false {
            return "##" & title & "##
    " & description;
        }
    }

    ...

    #markdownHelper.markdownTitleAndDescription( 'title', 'lorem
    ipsum...' )#


    -- 
    Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
    SW8 3HT, United Kingdom



    T: +44 [0] 845 260 0726• W: www.pixl8.co.uk
    <http://www.pixl8.co.uk/>• E: info@pixl8.co.uk
    <mailto:info@pixl8.co.uk>


    	

    Follow us on: Facebook <http://www.facebook.com/pixl8> Twitter
    <http://www.twitter.com/pixl8> LinkedIn
    <http://www.linkedin.com/pixl8>



    	CONFIDENTIAL AND PRIVILEGED - This e-mail and any attachment
    is intended solely for the addressee, is strictly confidential
    and may also be subject to legal, professional or other
    privilege or may be protected by work product immunity or
    other legal rules. If you are not the addressee please do not
    read, print, re-transmit, store or act in reliance on it or
    any attachments. Instead, please email it back to the sender
    and then immediately permanently delete it. Pixl8 Interactive
    Ltd Registered in England. Registered number: 04336501.
    Registered office: 8 Spur Road, Cosham, Portsmouth, Hampshire,
    PO6 3EB

    -- 
    You received this message because you are subscribed to the
    Google Groups "Lucee" group.
    To unsubscribe from this group and stop receiving emails from
    it, send an email to lucee+unsubscribe@googlegroups.com
    <mailto:lucee+unsubscribe@googlegroups.com>.
    To post to this group, send email to lucee@googlegroups.com
    <mailto:lucee@googlegroups.com>.
    To view this discussion on the web visit
    https://groups.google.com/d/msgid/lucee/CAEYvUx%3Ddj3g1txWR0AA-YT68ms%3D6xA9XpUXT%2BD%3DDmknXfyqqKQ%40mail.gmail.com
    <https://groups.google.com/d/msgid/lucee/CAEYvUx%3Ddj3g1txWR0AA-YT68ms%3D6xA9XpUXT%2BD%3DDmknXfyqqKQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.


    For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google
Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it,
send an email to lucee+unsubscribe@googlegroups.com
<mailto:lucee+unsubscribe@googlegroups.com>.
To post to this group, send email to lucee@googlegroups.com
<mailto:lucee@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAG%2BEEBx%2B18iB%2BeDO65SLNhM3rOeZzEkip%3Dz2XRYNS053wX4kpw%40mail.gmail.com
<https://groups.google.com/d/msgid/lucee/CAG%2BEEBx%2B18iB%2BeDO65SLNhM3rOeZzEkip%3Dz2XRYNS053wX4kpw%40mail.gmail.com?utm_medium=email&utm_source=footer>.


For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAGHrs%3D--ymMJGvC3--%3D2Us5mdW9mML2iEMZjwt_dnhtDObb40g%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAGHrs%3D--ymMJGvC3--%3D2Us5mdW9mML2iEMZjwt_dnhtDObb40g%40mail.gmail.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.

To me, Igal, Dave and Micha have both argued the case for using rendering
functions & components better than I could. I would only add that in my
case, I’ve used functions to render portions of very complex views, and
found that the technique made it much easier to reason through what needed
to be done. Each function of several might be called 100’s of times to
render an entire view, and each does some discreet amount of conditional
processing, looping, formatting, etc, and I will sometimes chain them.

Another option would have been to build up a very complex data structure
that mimics the presentation structure needed, and then pass that into a
monster block of intertwined nested loops, conditionals and html. I’ve done
that. I’m not good at it. This approach takes me far longer, and when I
need to come back into it to make modifications, it can take me hours to
reason through these large structures and then attempt to make the change
needed, usually proceeding by trial and error until I get it. Using
rendering functions, I can much more easily jump in, see how it works as a
whole and as discreet elements, and make the change needed accurately and
quickly.

I will admit that I can take a long time to first grasp and then reason
through very complex structures, and that may simply be my own shortcoming.

I don’t like custom tags for cases like these, because they are off in
separate files. I’ve always found them less straightforward to use than
functions.

To be clear, I only create rendering functions if the view is sufficiently
complex, and if I use them, I set output to false, use cfsavecontent, and
return the generated string.

Would love to see tag islands added. I’ve built some rendering functions in
script, because I much prefer using script, but as things stand, it’s
simply easier to use cf tag syntax for this.

Aria Media Sagl
Via Rompada 40
6987 Caslano
Switzerland

+41 (0)91 600 9601
+41 (0)76 303 4477 cell
skype: ariamediaOn Fri, Feb 13, 2015 at 10:22 AM, Michael Offner <@Michael_Offner> wrote:

the attribute output is only really necessary with tag based components,
then only they produce output “on their own”.
script based code only producing output when you do a echo(…), so why
suppress your own actions by default?

Micha

On Fri, Feb 13, 2015 at 10:18 AM, Dominic Watson < @Dominic_Watson> wrote:

If that were a .lucee.cfc (or whatever), I’d like to see that
output=false would be default. I would strongly discourage that kind of use
of a CFC function and be pleased if the language to a lead in doing so too.
i.e. why have the function output anything when it can return the value:

component {
public string function markdownTitleAndDescription( required string
title, required string description ) output=false {
return “##” & title & "##
" & description;
}
}

#markdownHelper.markdownTitleAndDescription( ‘title’, ‘lorem ipsum…’ )#


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAEYvUx%3Ddj3g1txWR0AA-YT68ms%3D6xA9XpUXT%2BD%3DDmknXfyqqKQ%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAEYvUx%3Ddj3g1txWR0AA-YT68ms%3D6xA9XpUXT%2BD%3DDmknXfyqqKQ%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAG%2BEEBx%2B18iB%2BeDO65SLNhM3rOeZzEkip%3Dz2XRYNS053wX4kpw%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAG%2BEEBx%2B18iB%2BeDO65SLNhM3rOeZzEkip%3Dz2XRYNS053wX4kpw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

Igal, thanks for the kind words about trycf.

I probably didn’t make it clear in my post, but I’m not suggesting removing
features. I’m suggesting not to carry over things to .lucee just because.
Of course the way you code now would still work in cfcs.

I know folks can get a bit heated about this sort of stuff, and I’m not
trying to add fuel to the fire, just trying to present a valid case for why
I think tags in .lucee is a poor idea and solicit valid cases from those
who think otherwise. So far I honestly haven’t seen any valid reason to
add tags in .lucee. Convenience of having all your rendering stuff in one
file doesn’t really sell the idea. I’ve seen plenty enough of code written
with that mindset.On Thursday, February 12, 2015 at 10:39:45 PM UTC-8, Igal wrote:

comments in text:

On 2/12/2015 10:23 PM, Abram Adams wrote:

I use tags in less than 1% of the components that I write – in most

cases it’s just that one component that does the rendering.

Then let’s focus on creating a platform that is awesome at the other
99%. Making quality compromises for the 1% edge case, which is arguably
poor design to begin with regardless of the claim that it was borne out of
performance issues is not a way to design a new language. CFML has plenty
of those poorly decided “features” already and if someone wants to make use
of those then they can still do it in legacy tagged base cfc, but for a new
dialect, specifically .lucee I think it would be a bad call.

I’ve developed many sites (e-commerce and otherwise) that require
thumbnails, reusable html blocks, etc…

trycf is impressive. well done.

and I have never, ever had issues with using custom tags as a solution.
Granted, most of that was with ACF, so perhaps Railo/Lucee has an issue
and just needs a better custom tag implementation?

no, I actually started that with ACF. ACF’s performance is even worse.

Consider the following alternatives to your functions:
<widget:thumbnail size=“small” id=“#widgetId#”/>
<widget:thumbnail size=“large” id=“#widgetId#”/>
<widget:pagination pagesize=“20” pagenumber=“1” baseurl=“…”/>

Doesn’t that provide better reusability?

not in my opinion. it is also much more work to maintain the code in all
the different custom tags. add to that the performance difference and it’s
a no-go for me.

Just reduced your 3 functions into 2 very expressive and intuitive
tags that naturally fit in your HTML. Now pretend you’re a
non-developer-designer that is styling the widget listing page you just
made. Would the following be very intuitive:

... oUIR = new UIRenderer();
for (var widgetId in searchResults) 
    oUIR.renderSmallWidgetThumbnail(widgetId);
other content...
#oUIR.renderPagination(...)#

Or do you think this would be clearer:

...
other content...

you’re taking some of the things I wrote and added much of your own
assumptions.

Let’s not let the 1% use case dictate the direction the language goes.
Please.

my point was that even though it might be just 1%, it is still very
important and adds a lot.

I don’t understand why the insistence to remove features that you guys
don’t like. if you don’t want to use them, don’t use them. it doesn’t
mean that no one should use them.

On Thursday, February 12, 2015 at 6:38:12 PM UTC-8, Igal wrote:

just to be clear:

I use tags in less than 1% of the components that I write – in most
cases it’s just that one component that does the rendering.

that doesn’t mean, however, that it is not an important feature of the
language.

the bottom line, as far as I’m concerned, is that “tag islands” in
script would be a great feature.

On 2/12/2015 5:49 PM, Igal @ Lucee.org wrote:

Option 2)
Don’t have a UIRenderer component but have tag-based custom tags for
rendering your widget (lists) or pagination etc. THAT is what tag-based
custom tags are really good at and useful for. Then on your page it’d
actually uses the custom tags which probably fits nicely into whatever
layout templating or page wrapper setup you prefer.

Personally, I think option 2 is much to be preferred as it separates
rendering (tag based in custom tags or templates) from business logic
(script based in components) very nicely.
right. that’s the way I used to do it before components were
introduced
into the language. but

  1. it proved to be much slower to begin with.

  2. by using functions I can use cachedWithin, so for example, if I pass
    a widgetId and the function has to do a lookup to get more details
    (like
    name, price, etc), this can all be cached by Lucee internally, which
    makes it even more performant.

  3. it keeps all of my rendering code in a single file, so it’s much
    easier to find the piece I’m looking for when I need to do so.

On 2/12/2015 5:39 PM, Kai Koenig wrote:

  1. the main difference between you (plural) and I is that you try to
    push me to do things your way, while I prefer to keep my options open
    I would strongly debate that, but that’s a different discussion.
  1. Kai – the fact that you don’t understand something doesn’t make
    it bullsht. I’ve always treated you with respect – it’d be nice if you’d
    try to do the same
    Just to make things clear - the bullish
    t comment was not targeting
    you in particular but anyone in this discussion trying to convince me of
    breaking away from common-sense separation of concerns architectural
    principles without providing a use case why their proposed solution is
    better.

Now you HAVE supplied such a case (see below) and we can discuss your
argument. That has nothing to do with not understanding something at all.

  1. I will try to show an example of what I mean, hopefully the
    oversimplification will not make it miss the point
    a) I don’t see how the approach below differs from what Abram’s said:

"So, what would stop you from just including a cfm file with your UI
stuff if you want it inside a cfc? To me that is the cleaner approach.”

To me, that’d be a much clearer approach, too, instead of sticking
markup into a component. If you really wanted to have a UIRenderer
component.

b) Let’s assume you did NOT have tags in components, how would this
requirement be solved nicely?

Option 1)
Script component including a tag/markup file. That’s essentially the
CFML-based version of a mixin (well, -ish) and I don’t think there’s
anything wrong with that.

Option 2)
Don’t have a UIRenderer component but have tag-based custom tags for
rendering your widget (lists) or pagination etc. THAT is what tag-based
custom tags are really good at and useful for. Then on your page it’d
actually uses the custom tags which probably fits nicely into whatever
layout templating or page wrapper setup you prefer.

Personally, I think option 2 is much to be preferred as it separates
rendering (tag based in custom tags or templates) from business logic
(script based in components) very nicely.

Cheers
Kai


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+un...@googlegroups.com <javascript:>.
To post to this group, send email to lu...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/47d84ac6-4b54-4a9d-be55-79fde7a61689%40googlegroups.com
https://groups.google.com/d/msgid/lucee/47d84ac6-4b54-4a9d-be55-79fde7a61689%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

the output attribute is useless with script code, as simple as does.

MichaOn Fri, Feb 13, 2015 at 10:28 AM, Dominic Watson <@Dominic_Watson wrote:

To stop your developers from doing it in the first place :wink: and, from a
language perspective, lead people away from that approach. Tough to change
for .cfc extension - but IF we really are to have a new dialect, I think it
would be worth reviewing.

I can, of course, change the defaults of tag attributes in Application.cfc
(thanks for that btw, awesome).

Also, I always did output=false on functions due to whitespace production
issues. I’ll experiment now to see if that really still is the case.

On 13 February 2015 at 09:22, Michael Offner <@Michael_Offner> wrote:

the attribute output is only really necessary with tag based components,
then only they produce output “on their own”.
script based code only producing output when you do a echo(…), so why
suppress your own actions by default?

Micha

On Fri, Feb 13, 2015 at 10:18 AM, Dominic Watson < @Dominic_Watson> wrote:

If that were a .lucee.cfc (or whatever), I’d like to see that
output=false would be default. I would strongly discourage that kind of use
of a CFC function and be pleased if the language to a lead in doing so too.
i.e. why have the function output anything when it can return the value:

component {
public string function markdownTitleAndDescription( required string
title, required string description ) output=false {
return “##” & title & "##
" & description;
}
}

#markdownHelper.markdownTitleAndDescription( ‘title’, ‘lorem ipsum…’ )#


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB


You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAEYvUx%3Ddj3g1txWR0AA-YT68ms%3D6xA9XpUXT%2BD%3DDmknXfyqqKQ%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAEYvUx%3Ddj3g1txWR0AA-YT68ms%3D6xA9XpUXT%2BD%3DDmknXfyqqKQ%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAG%2BEEBx%2B18iB%2BeDO65SLNhM3rOeZzEkip%3Dz2XRYNS053wX4kpw%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAG%2BEEBx%2B18iB%2BeDO65SLNhM3rOeZzEkip%3Dz2XRYNS053wX4kpw%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.


Pixl8 Interactive, 3 Tun Yard, Peardon Street, London
SW8 3HT, United Kingdom

T: +44 [0] 845 260 0726• W: www.pixl8.co.uk• E: info@pixl8.co.uk
Follow us on: Facebook http://www.facebook.com/pixl8 Twitter
http://www.twitter.com/pixl8 LinkedIn http://www.linkedin.com/pixl8CONFIDENTIAL
AND PRIVILEGED - This e-mail and any attachment is intended solely for the
addressee, is strictly confidential and may also be subject to legal,
professional or other privilege or may be protected by work product
immunity or other legal rules. If you are not the addressee please do not
read, print, re-transmit, store or act in reliance on it or any
attachments. Instead, please email it back to the sender and then
immediately permanently delete it. Pixl8 Interactive Ltd Registered in
England. Registered number: 04336501. Registered office: 8 Spur Road,
Cosham, Portsmouth, Hampshire, PO6 3EB


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAEYvUx%3DM1-TFxMcpGnWMczE6LCd38qjqKOOKZ48-g2bhnmUAYA%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAEYvUx%3DM1-TFxMcpGnWMczE6LCd38qjqKOOKZ48-g2bhnmUAYA%40mail.gmail.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

that brings it to the point!
Sometimes “separation” do unnecessary complicate things, you assume that
this separation is always the better choise, but maybe it is sometimes not
in the interest of the greater good (see my testbox example above).

MichaOn Fri, Feb 13, 2015 at 1:37 AM, Adam Cameron <@Adam_Cameron1> wrote:

On 13 February 2015 at 00:32, Igal @ Lucee.org <@Igal> wrote:

So, what would stop you from just including a cfm file with your UI
stuff if you want it inside a cfc? To me that is the cleaner approach.

this is like asking “why do we need functions or custom tags in the
language when we can just write the function’s body into a snippet and use
cfinclude…”

No Igal, actually your position is more like that. Rolling disparate
pieces of code into one location, instead of separating it out.

there are times when you want to include a snippet/template, there are
times when you want to use custom tags, and there are times when you want
to use functions.

Well indeed. However you’re eschewing all of those options, instead
claiming that one might as well mix the tags and code into the same piece
of code. Abram’s merely suggesting the minimum level of abstraction.


Adam


You received this message because you are subscribed to the Google Groups
“Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAFwR%2BKfTuQXEpB5HOYCPW4GO6AP8HPr6UrJia3LLXBNndfNA%2BQ%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAFwR%2BKfTuQXEpB5HOYCPW4GO6AP8HPr6UrJia3LLXBNndfNA%2BQ%40mail.gmail.com?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.