News for hackers. Stuff that matters.
Re:Vue.js: the good, the meh, and the ugly by erikpukinskis on Friday July 06, 2018 @02:22AM (#17469358)
> the actual data and state you need to distribute to them has a structure that is completely unrelated to how its laid out in the DOM.

It took me many years to realize this. I think very few front end developers understand this. And more problematically: very few framework devs seem to understand it.

Stated another way....

Your tree of UI widgets, and

Your tree of data which feeds those widgets

... are two orthogonal trees.

If you are a front end dev and you haven’t spend time wrestling with that, I strongly recommend it. It’s extremely likely your front end architecture is suffering because of it.

React take the strongest stance on this matter, by making the interface to every widget be one giant shared global. But globals are bad, so while it’s good they acknowledge the situation, they mostly punt on the question of how to deal with it.

Re:Vue.js: the good, the meh, and the ugly by bryanrasmussen on Friday July 06, 2018 @03:14AM (#17469569)
>Your tree of UI widgets, and

>Your tree of data which feeds those widgets

Not with a well-designed XML format and XSL-T! But hmm, nobody seems to use that anymore either.

Re:Vue.js: the good, the meh, and the ugly by mattmanser on Friday July 06, 2018 @04:16AM (#17469795)
Having done this in the wild a while ago, it seemed to be hard for most of the other developers to do anything complex with it.

You either really got it and then could do wonderful things, or you sorta muddled along with it and it was ok but it was like they were wearing a straitjacket.

I made a pivot table control out of it, with almost all the logic inside the XLST, it was amazingly fast compared to IE6's javascript at the time. I remember that Blizzard used it for the WoW online character viewer which was streets ahead of what anyone else was doing.

Also there's a DailyWTF about someone doing this on a large app, which brought the developer out of the woodwork to defend it who said in fact it wasn't a WTF, it was deliberate, it worked, loads of people loved it. Which prompted a huge debate about how it was actually kinda good, but just too high a learning curve (which is the death knell of many a tech).

Personally I don't miss it. The best way I can sum up XML/XLST up is that it made me feel clever, and now I know that when I start feeling clever about my code that's a sure sign I'm making something that's going to be a nightmare to maintain.

Re:Vue.js: the good, the meh, and the ugly by pjmlp on Friday July 06, 2018 @05:16AM (#17470017)
Once upon a time my web site was doing all the rendering via XML/XLST, and I looked forward to what might have been Web Components via the XML Components standards.

Oh well, at least Web Components seem to finally be around the corner, a decade later.

Re:Vue.js: the good, the meh, and the ugly by mattmanser on Saturday July 07, 2018 @05:00AM (#17477740)
Yes, the lack of reusable controls in hrml is utterly crazy!
Re:Vue.js: the good, the meh, and the ugly by matwood on Friday July 06, 2018 @07:46AM (#17470602)
> Having done this in the wild a while ago, it seemed to be hard for most of the other developers to do anything complex with it.

Same. Long ago I replaced an expensive Crystal Report solution with reports delivered as XML/XSLTs that used IE's feature at the time of applying the XSLT at the browser. It worked very well and provided nice interactive reports. I also wrote a bunch of cookbooks (for lack of a better term) that allowed the business analysts to create additional reports.

Re:Vue.js: the good, the meh, and the ugly by Falling3 on Friday July 06, 2018 @12:36PM (#17472800)
> streets ahead

Pierce? Is that you?

Re:Vue.js: the good, the meh, and the ugly by mattmanser on Friday July 06, 2018 @01:41PM (#17473465)
No, I'm from the UK, it's a common idiom over here.
Re:Vue.js: the good, the meh, and the ugly by avinium on Friday July 06, 2018 @05:54AM (#17470160)
Wouldn’t happen to have a link to that DailyWTF would you? Would love to read the discussion.
Re:Vue.js: the good, the meh, and the ugly by mattmanser on Friday July 06, 2018 @06:44AM (#17470337)
I was having trouble earlier, but have tracked it down:

https://thedailywtf.com/articles/Sketchy-Skecherscom

The featured comment at the bottom is from the original devs.

One of the early comments is that it only worked properly on Firefox, which is wrong. IE6+ had excellent, extremely fast XSLT support.

The company I worked for at the time actually had an enterprise app that didn't work properly on FF as it relied on some IE only functionality, some sort of VBScript controls you could embed in IE that I forget the name. They dropped support for them in IE8 or 9. The app was otherwise excellent, basically a sort of dropbox + basecamp for the construction industry before dropbox + basecamp were even made, users loved it. The founding developer was the best developer I have ever known (his quirk was that he'd often forget to rename his functions after prototyping something so a lot of his methods were called Something or Thing or Something2 and we'd have to rename them later to make it clear what they did).

We had a SQL helper that would allow you to write XPath in the SELECT names something like this (I have totally forgotten xpath by now, but hopefully you get the jist):

    SELECT c.CompanyId [@companyId], c.Name [@companyName], 
      o.OrderId [/orders/order/@orderId], o.Name [/orders/order/@name], o.Quantity [/orders/order/quantity]
    FROM Orders o
    JOIN Company c ON o.CompanyId = c.CompanyId
    ORDER BY c.CompanyId
And it would spit out appropriately nested and structured XML like:

    <companies>
      <company companyId="1" name="thing">
        <orders>
          <order orderId="142" orderName="Sally's Order">
            <quantity>1</quantity>
          </order>
          <order orderId="156" orderName="Sally's Other Order">
            <quantity>1</quantity>
          </order>
        </orders>
      </company>
      <company companyId="2" name="different company">
        ..etc
       </company>
    </companies>
     
It was actually pretty nifty, you only got exactly the data you needed for the page, but meant often our business logic was in SQL statements. It did make me realise how infrequently you actually re-use specific data queries and a lot of people over-egg how much data re-use there is or logic sharing that is actually required in a real-world app.

Because you had the XSLT on the page, you could make it dynamic, just post back for the new XML on a drop-down change, button-click, etc.

Another story from there is that they made their own version of jquery just before jquery rose to prominence. It was a nightmare to debug, that fully got me onboard the jquery train.

Re:Vue.js: the good, the meh, and the ugly by ethbro on Saturday July 07, 2018 @10:24AM (#17478584)
> It did make me realise how infrequently you actually re-use specific data queries and a lot of people over-egg how much data re-use there is or logic sharing that is actually required in a real-world app.

Agreed. Possibly a microsymptom of the "business only does boring things, developers do interesting things" mindset.

In my experience, one needs to constantly guard against thinking anyone else is mindlessly turning a crank. In fact, they're likely doing just as complex and interesting stuff as you, only with different tools.

Re:Vue.js: the good, the meh, and the ugly by bryanrasmussen on Friday July 06, 2018 @07:04AM (#17470435)
Looking at it, xsl:for-each inside of xsl:for-each should be xsl:template with it's own mode.

however it's also really too trivial and really straightforward and boring as a piece of code to be mentioned as a WTF, having difficulty understanding that code would just be a case of not understanding the language, which is also a thing that happens.

Re:Vue.js: the good, the meh, and the ugly by mattmanser on Friday July 06, 2018 @07:22AM (#17470516)
I seem to remember that was just a practical thing, sometimes you couldn't be bothered to split it into two.

The context of that article was more that doing XML/XSLT at all was a WTF.

Re:Vue.js: the good, the meh, and the ugly by pyre on Friday July 06, 2018 @08:05AM (#17470705)
IIRC, Colloquy (a macOS IRC client) used to do this. Each IRC channel was basically an XML feed, and the theming was just XSLT applied to the XML feed and the output displayed in a WebView widget.
Re:Vue.js: the good, the meh, and the ugly by jrs95 on Friday July 06, 2018 @06:43AM (#17470336)
I think this is the issue Relay tries to solve. It basically just allows components to declare which part of the data tree they are concerned about without having to have knowledge about the data that other components need.
Re:Vue.js: the good, the meh, and the ugly by boubiyeah on Friday July 06, 2018 @11:18AM (#17472115)
You wrote "React take the strongest stance" but you meant redux right?
Re:Vue.js: the good, the meh, and the ugly by erikpukinskis on Monday July 09, 2018 @05:21AM (#17488955)
No, React has a notion of a single giant state object, right?
Re:Vue.js: the good, the meh, and the ugly by boubiyeah on Wednesday July 11, 2018 @05:24PM (#17510405)
No. Vanilla React just give you the option to store state of any size in any component.