A WTF? or common practice



  • I'm new here, i'm new to programming. I just graduated and took my first job, i support a variety of web applications within a team of programmers and support engineers. My first job is looking at an application that calls a bunch of XML/XSL, HTML and JSP pages.

     The XSL pages are all stored in records in an oracle database, I've never heard of it being done this way before and i just wondered if it was a common practice and there was a reason for it beyond what i could understand.



  • @djbaker2 said:

    I'm new here, i'm new to programming. I just graduated and took my first job, i support a variety of web applications within a team of programmers and support engineers. My first job is looking at an application that calls a bunch of XML/XSL, HTML and JSP pages.

     The XSL pages are all stored in records in an oracle database, I've never heard of it being done this way before and i just wondered if it was a common practice and there was a reason for it beyond what i could understand.

    It is a common form of insanity. 



  • LOL. It didn't seem right to me.



  • @djbaker2 said:

    I'm new here, i'm new to programming. I just graduated and took my first job, i support a variety of web applications within a team of programmers and support engineers. My first job is looking at an application that calls a bunch of XML/XSL, HTML and JSP pages.

     The XSL pages are all stored in records in an oracle database, I've never heard of it being done this way before and i just wondered if it was a common practice and there was a reason for it beyond what i could understand.

    Spend enough time on this site, and it'll seem like common practice.


  • You might start to think it is best practise, because when you are at that point, it really doesn't matter anymore.



  • Of course this is good practice. In fact, the only reason for the operating system and its file system to exist is so it can host an Oracle database system.



  • @bstorer said:

    Spend enough time on this site, and it'll seem like common practice.

    Probably because it is. (That doesn't mean it's not insane, just that there are a lot of crazy people with computers) 



  • Unless there is some need for them to be in the database, it's a WTF.  To elaborate: Let's say you had a system that was like Myspace, where users could upload their own content.  Let's say this was a super-advanced form of Myspace where they could also upload XSLs for some reason.  It might make sense to store all user data, including XSL.  In that case, this isn't a WTF.  Remember, a filesystem is a database and a database is a filesystem.  The only difference is that a filesystem stores files hierarchically while a DB stores them as relations, usually with indexes.  Not even that big a difference.

    If however these are just a bunch of static files then this is wrong.  I have seen websites where people did store all their stuff, like all the static images etc, in the db, and that's usually wrong.



  • @JavaCoder said:

    Remember, a filesystem is a database and a database is a filesystem.  The only difference is that a filesystem stores files hierarchically while a DB stores them as relations, usually with indexes.  Not even that big a difference.

    Spoken like a true Jave coder.

    A RDBMS database is nothing like a file system (unless you're talking about MySQL in which case you just might be getting somewhat close to having half a point).  And XML file isn't a database either before you start.  And while we're here, sucking up the contents of a database into collections in "the middle tier" to "process efficiently" isn't a good use of a database either.  Nor is serialising objects into BLOBs a reasonable technique for storing data.

     </Rant>



  • @LoztInSpace said:

    @JavaCoder said:

    Remember, a
    filesystem is a database and a database is a filesystem.  The only
    difference is that a filesystem stores files hierarchically while a DB
    stores them as relations, usually with indexes.  Not even that big
    a difference.

    Spoken like a true Jave coder.

    A RDBMS database is nothing like a file system (unless you're talking about MySQL in which case you just might be getting somewhat close to having half a point).  And XML file isn't a database either before you start.  And while we're here, sucking up the contents of a database into collections in "the middle tier" to "process efficiently" isn't a good use of a database either.  Nor is serialising objects into BLOBs a reasonable technique for storing data.

     </Rant>


    What are you, a professional axe-grinder? You could have just written "I hate Java, MySQL, XML and application servers" and transported the same amount of information.

    Filesystems and databases may not be the same thing, but there are clearly similarities in both their function (structured storage of data) and techniques (indexes, transactions). In fact, not so long ago,  the prevailing type of database was hierarchical, not relational.



  • @brazzy said:

    Filesystems and databases may not be the same thing, but there
    are clearly similarities in both their function (structured storage of
    data) and techniques (indexes, transactions). In fact, not so long
    ago,  the prevailing type of database was hierarchical, not
    relational.

    While there is clearly a tendency for file systems to become more like databases, it should IMO be clear that most filesystems are not databases and most databases are not filesystems. 



  • A filesystem resembles a database much as Perl resembles machine code.



  • @LoztInSpace said:

    Spoken like a true Jave coder.

    Why thank you!

    @LoztInSpace said:

    A RDBMS database is nothing like a file system (unless you're talking about MySQL in which case you just might be getting somewhat close to having half a point).

    An RDBMS could be very much like a file system.  They both store records (files).  Filesystems generally are optimized for retrieving large records (files) based on a hierarchical naming system.  RDBS are usually optimized for storing small records (files) based on indexes and queries.  Modern file system ideas like Reiser4 blur the lines even further.  I think it would be possible to write a reasonably efficient SQL module for Reiser4 even.
    One big difference is that filesystems have very efficient mechanisms for quickly reading large amounts of data out of a file.  JDBC is not nearly as efficient as a plain old file channel.

    @LoztInSpace said:
    And XML file isn't a database either before you start.

    No and neither is a .tar.gz, because neither XML files nor .tar.gz files have indexes, and data can only be accessed by linear access to them.

    @LoztInSpace said:
    And while we're here, sucking up the contents of a database into collections in "the middle tier" to "process efficiently" isn't a good use of a database either.  Nor is serialising objects into BLOBs a reasonable technique for storing data.


    Serializing objects to BLOBs is a universally bad idea.  Sucking up the contents into collection in the middle tier was an older approach to solving the object-relational problem.  It is no longer the way persistence frameworks like EJB3 do things.  They use real queries.

    --------------
    [url=http://chiralsoftware.com/my-ip-address.jsp]IP address and browser information[/url]



  • @ammoQ said:

    @brazzy said:

    Filesystems and databases may not be the same thing, but there
    are clearly similarities in both their function (structured storage of
    data) and techniques (indexes, transactions). In fact, not so long
    ago,  the prevailing type of database was hierarchical, not
    relational.

    While there is clearly a tendency for file systems to become more like databases, it should IMO be clear that most filesystems are not databases and most databases are not filesystems. 

    All unix filesystems are databases under any reasonable definition of the term (standard definition in database theory: anything in 1st normal form is a database, anything not in 1st normal form is not a database). Most other modern filesystems are also databases. To find a filesystem that was not a database, you'd have to go back to early floppy disks and tapes and stuff like that.

    Filesystems are not relational databases and have nothing in common with them except that both are databases. They belong to entirely different branches of database theory. (Much like PCs and S/360s are almost entirely unrelated except that both are computers)

    Note that the point of database theory is that the only sane way to organise a set of data is a database, so almost anything that organises a set of data is going to be a database (and therefore, database theory can reason about it).



  • Thank you.  The difference is that filesystems are (were) based on hierarchical storage whereas relational dbs are based on relations.

    But those lines are blurring.  Reiser4 and some new FSes from Microsoft will have other ways of indexing files besides the file hierarchy.  And relational databases uses indexes, and in fact indexes work by making a hierarchy of bins.  There isn't a wall between these two ideas.

    XML doesn't fit in this because there are no indexes.  The only way to find a datum in XML is to parse linearly until the datum is found.  The point of a database is that there is a mechanism to avoid this linear parsing.  And databases must allow transactions of some kind, something which isn't possible in XML, except in the form of re-writing the entire file.



  • @JavaCoder said:



    But those lines are blurring. Reiser4 and some new FSes from Microsoft will have other ways of indexing files besides the file hierarchy. And relational databases uses indexes, and in fact indexes work by making a hierarchy of bins. There isn't a wall between these two ideas.

    Relational databases are precisely the set of databases in which all data relationships are described using relational algebra. Don't confuse it with RDBMSes - that's a piece of software which manages a relational database (analogy: difference between a web server and a web site). There are some similarities between a modern filesystem driver and an RDBMS, but none between any of the major filesystems and a relational database (so far).


    XML doesn't fit in this because there are no indexes. The only way to find a datum in XML is to parse linearly until the datum is found. The point of a database is that there is a mechanism to avoid this linear parsing. And databases must allow transactions of some kind, something which isn't possible in XML, except in the form of re-writing the entire file.

    Access methods don't matter. Databases are about structure, and only about structure. Transactions are a common feature of a DBMS, they don't have anything to do with database theory. Database-ness describes what patterns of data you can select from the set, not how you can access it.



  • This thread is the perfect example of why there are so many WTFs out there. Too many of us think we know more than we know and use that false knowledge inappropriately.

     

    There's a lesson here: don't get too self-assured. And be very precise with your terms before you open your mouth (or flex your fingers in this case).  



  • I must say, I am intentionally mixing up two ideas: the definition of a [i]database[/i], and [i]database management software[/i].  The first is a mathematical definition, and it includes relational databases and filesystems.  Interestingly, systems like MySQL allow the management of sets of data which are [i]not[/i] databases, because they allow tables to have duplicate rows, which means it is no longer a database, I believe.  So not everything managed by a database manager is a database.

    My point is, as an app developer, I want a piece of software which is a [i]database manager[/i], like MySQL, and I also want my data to be stored in a database, like a relational database.  I'm more concerned with the piece of software (MySQL, Reiser4) than I am about the math, so long as I use the software correctly and design my tables correctly (as proper relations).

    Anyway, I stand by my statement that a modern filesystem like Reiser4 and a modern RDBMS like MySQL are not that different, and are in fact evolving to be even more similar, and at some point in the not so distant future we will probably be able to do database-style queries of our filesystems, and then it will be hard to draw a line between the two.  And therefore, having strong "always" opinions about where you should store your images doesn't make that much sense.



  • @JavaCoder said:

    I'm more concerned with the piece of software (MySQL, Reiser4) than I am about the math, so long as I use the software correctly and design my tables correctly (as proper relations).

    It's worth noting that the math behind it is just what you get when you precisely nail down the concept of "store your data in a sane and effective manner" - it turns out that we can pin an exact definition on that idea, and then check to see whether we have accomplished it.



  • @LoztInSpace said:

    @JavaCoder said:

    Remember, a filesystem is a database and a database is a filesystem.  The only difference is that a filesystem stores files hierarchically while a DB stores them as relations, usually with indexes.  Not even that big a difference.

    Spoken like a true Jave coder.

    A RDBMS database is nothing like a file system (unless you're talking about MySQL in which case you just might be getting somewhat close to having half a point).  And XML file isn't a database either before you start.  And while we're here, sucking up the contents of a database into collections in "the middle tier" to "process efficiently" isn't a good use of a database either.  Nor is serialising objects into BLOBs a reasonable technique for storing data.

     </Rant>

    I think that if you're using something like </Rant>, you should open your tag too, like <Rant>.  I see far too many </sarcasm> tags on the interwebs and there aren't enough <sarcasm> tags to cover them



  • @belgariontheking said:

    @LoztInSpace said:

    @JavaCoder said:

    Remember, a filesystem is a database and a database is a filesystem.  The only difference is that a filesystem stores files hierarchically while a DB stores them as relations, usually with indexes.  Not even that big a difference.

    Spoken like a true Jave coder.

    A RDBMS database is nothing like a file system (unless you're talking about MySQL in which case you just might be getting somewhat close to having half a point).  And XML file isn't a database either before you start.  And while we're here, sucking up the contents of a database into collections in "the middle tier" to "process efficiently" isn't a good use of a database either.  Nor is serialising objects into BLOBs a reasonable technique for storing data.

     </Rant>

    I think that if you're using something like </Rant>, you should open your tag too, like <Rant>.  I see far too many </sarcasm> tags on the interwebs and there aren't enough <sarcasm> tags to cover them

    <!ELEMENT RANT O - (%flow;)*>
    <!ELEMENT SARCASM O - (%flow;)*>

    Clearly, the opening tags are optional. It's right there in the DTD. That I just made up.

    The parser determines where to put the opening element from context (i.e. when you start being sarcastic / ranting) 



  • @Random832 said:

    <!ELEMENT RANT O - (%flow;)>
    <!ELEMENT SARCASM O - (%flow;)
    >

    Clearly, the opening tags are optional. It's right there in the DTD. That I just made up.

    The parser determines where to put the opening element from context (i.e. when you start being sarcastic / ranting) 

    Don't forget the default style!

    sarcasm {
       color: orange;



  • <sarcasm>Yeah, that really makes sense...</sarcasm>

    Damn, you can't actually post sarcasm tags (they show up in the editor, and round-trip, but the forum software filters them out.) 



  • @Random832 said:

    <sarcasm>Yeah, that really makes sense...</sarcasm>

    Damn, you can't actually post sarcasm tags (they show up in the editor, and round-trip, but the forum software filters them out.) 

     

    <sarcasm>damn, you are right</sarcasm>

Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.