|
Posted by SpaceGirl on 03/09/07 09:56
On Mar 9, 4:26 am, Onideus Mad Hatter <use...@backwater-
productions.net> wrote:
> On 8 Mar 2007 04:30:36 -0800, "SpaceGirl"
>
> <nothespacegirls...@subhuman.net> wrote:
> >Here we go, ultra simple XML example:
>
> <snip>
>
> Your code is hard to read like that...why not make it like this:
>
Because GG sucks, and it dropped my tabs when I cut and pasted.
<snip>
> >Try doing that without XML... it'd require MUCH more code. With the
> >code I have above, I barely have to modify anything if the XML
> >changes. It generates x number of clips, titles them etc from a single
> >XML document (which in turn can be a dynamic page that populates the
> >XML from a database).
>
> ...which would be absolutely fuckin retarded since um, why bother with
> the XML bullshit at all? I mean, if the shit is already *IN* the
> database...have it get the st00f DIRECTLY from the database.
> Essentially all you've done is create a rather deficient middle man.
And what format would you use to fetch it from the database? Raw text?
Most databases spit out their data in XML if you ask them. There is a
reason for this.
If I wanted a recordset of say, 100 items, I can make a SINGLE call to
the database and request all 100 items as an XML formatted lump. If I
were to do it *directly*, I would have to make 100 calls to the
database. Better still, once I have an XML snapshot of the data I
want, I can resort the data or perform queries INSIDE the XML. I need
never go back to the database ever again. Massive reduction in
overhead, much faster.
> >With a single tweak I can change the code from
> >using XML (from a URL) to use a Web Service. It would be a nightmare
> >trying to do this through para passing.
>
> ...how would it be a nightmare? Just use PHP and have it directly
> access a database and retrieve the data directly thus bypassing the
> need for any XML. Like I said, XML is just a poor mans database.
Directly. You keep using that word. What format would your data be in?
> Anything you're doing with XML I can do the same, directly, with a SQL
> database. That's why XML isn't really all that important overall. It
> can be handy in Flash in that you can write XML files directly without
> having to go through a PHP file to write data into a database...but
> the bottom line is that there are EQUIVALENT solutions that can
> achieve the same ends (extra code or not) and because of that, it's
> not of "life or death" importance. With something like Flash...well
> shit, if there was no Flash, half the gawd damn content would just be
> fucking GONE because THERE IS NO equivalent. The closest you can get
> is Java...and even it comes up short as far as video playback
> capabilities amongst other things. The most IMPORTANT web technology
> is the one that HAS NO REPLACEMENT. There's replacements for PHP,
> there's replacements for XML, there's replacements for pretty much
> everything...EXCEPT for Flash.
>
> >Okay your turn... post how to do this without XML, and less code,
> >that's easier to follow. Bet you can't :)1
>
> Sure I can, take whatever code you said was taking entries from a
> database to create that XML page and just modify it so that it'll send
> that data directly to the Flash st00f. Your trying to imply that:
>
> Flash -> PHP -> SQL Database -> XML -> Flash
>
> is somehow faster than:
>
> Flash -> PHP -> SQL Database -> Flash
It is. Vastly faster. Take it a step further; Say you have 10,000
records. I want to temporarily change the order of those records.
You're only allowed ONE database call to fetch the data. Now tell me
how to resort the data?
> It's not and your way would actually take MORE code and overall would
> actually be SLOWER. *shrugs*
Well, I'm not going to be dragged into a fight with you over this - I
think you have some great ideas and I think you're missing a trick
here. The kind of stuff we're doing here right NOW you could not TOUCH
without XML.
> The only real advantage that XML has is in creating kind of disposable
> databases in order to cut down on the processor consumption that comes
> from accessing/searching/sorting through a SQL database. Essentially
> you can have Flash just pick up the XML file and let Flash do the
> accessing/searching/sorting client side rather than server side...the
> DISADVANTAGE to that however is that you wouldn't be getting "real
> time" data.
This is very true; XML is fab for taking snapshots of data and
injecting data into lists, trees, tables - that sort of thing. Because
you are dealing with a snapshot you always have to check that your
data is fresh (if you are going to write it back to the DB, for
example), but effectively you'd have to do this using any other method
of getting data too.
> Well, you could, but if you had it setup that way you
> wouldn't NEED the XML at all, it'd just be consuming more resources.
Depends on the data. We have a system here that lets you edit users,
in Flash. It lists the users from the database (XML) and I can then
click and edit any user etc. It works well; the data is fairly static,
but it does validate that no changes have been made in the database
before writing back. The entire process can be done in TWO http
requests (3 if you include loading the actual SWF), plus one database
query to write, and one query to read. We have countless thousands of
users. If we were to do it the way you suggest, we'd have countless
thousands of DB requests, HTTP request, and you'd have to write your
own clever way to parse it all. If alternatively, you're suggesting
you simply spit the data out as text via PHP; you're effectively doing
what XML does anyway, just in an unstructured way.
Have you ever heard of "views"? In MySQL (and probably other
databases) it's a way to create a temporary "in memory" table, based
on a snapshot of data from other tables. This is done at the server.
If you like, XML can be used kinda like that, except that it takes
place in the client (Flash, or whatever has read your XML).
> In some situations with EXTREME server load it might make sense to
> have a server side app that will create a new XML file every few
> seconds, that way it's like the database is only being continuously
> accessed by a single person rather than being continuously accessed by
> dozens all at the same time.
>
> Again though, if the technology was history and simply ceased to be
> you could STILL achieve the same ends (slower and more resource heavy
> or not) which is why it's not the MOST important.
XML is a core part of; Windows Vista, Microsoft Office, OS X, Flash
AS3, Apache, IIS, etc etc... need a go on? These systems would not
exist in the form we see them today without XML, because XML provides
a way to structure data inside them. You're a Flash user; are you
writing off Flex/AS3? Because the core of Flash9/Flex/AS3 is something
called MXML... and guess what THAT is?
It's fine for you to stick with AS2 and Flash 8, but I prefer to work
with Flex/Flash9 and AS3, using XML to describe data structure and
pass data around. You really SHOULD spend some time playing with it; I
promise you, while it may seem a little weird at first, it is
extremely powerful. Even for small recordsets, where XML probably adds
overhead, it massively simplifies the code you have to write and
maintains your data in a format that 1000s of programs can understand
(rather than a flat file only your program understands). It's worth a
look into.
[Back to original message]
|