• (nodebb)

    I wonder if was frist something else that devolved into this mess we got.

  • (nodebb)

    [first example]

    We've seen it, we hate it

    Anyone care to explain why we hate it? I do this quite frequently in my Razor View code.

  • dusoft (unregistered)

    Well, it works. It does nothing on Javascript side and sets a variable on PHP side. But indeed, it does not work as the author expected...

  • (author) in reply to dpm

    Blurring your state across front-end and back-end is just bad separation of concerns. It makes everything harder to test and debug.

  • dusoft (unregistered) in reply to Remy Porter

    I think the author used a conditional PHP once to generate a Javascript code and it worked. So they tried in reverse...

  • (nodebb) in reply to dpm

    Balzor is different because it's designed to let you write server-side looking code that runs on the client. PHP doesn't.

    Addendum 2025-04-21 11:06: Blazor*

  • Duke of New York (unregistered) in reply to dpm

    Using a template to generate JavaScript code that injects parameters into a page is not completely intolerable. Doing it the point of parameter use, with inline calculation logic, entangles and obscures the content of the page and the logic of the calculations. Every effort should be made to consolidate parameter calculation in one code block, leaving the page to consume them without question.

    Now, maybe you have lists on your page that are generated from particular database queries, and you think it would be cool and efficient to generate them in a stream from the database cursor, but I suggest that a template that generates more than one such list probably isn't getting the benefit from it that you assume, or it should be subdivided.

  • Shorty (unregistered)

    They must not have code review or any testing. If I try to check in code like that it won't be accepted or fail the QA process. It most definitely would not be deployed to production and lead to a host of tickets on the backlog.

  • Glenjamin (unregistered)

    What fascinates me is the bizarre persistence of the offending developer. Like I just find it wild that they keep pumping out the same non-working code without trying a different approach...

Leave a comment on “The Variable Toggle”

Log In or post as a guest

Replying to comment #679282:

« Return to Article