- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Well, when we make code changes (even little ones) we go through this little process known as "testing". This requires resources and time.
We also use something known as "source code control". Nobody goes into Enterprise Manager and changes code directly against the DB.
As far as changing the data, we provide users with an interface to do that. Write it once, let the users manage it from there.
Admin
Hmm, "security through obscurity"? It didn't work for the ancient egyptians when they built tombs you know.
Admin
It would be much longer if your team is adhering to strict testing & version control procedures (which they should be!). Making changes to the schema (which a proc is part of) SHOULD be followed with a code review, checking the change into your version control system, user testing and production migration. 99% of all WTFs can be cured with these steps.
By putting the order in the table it's free to be changed by anyone with the rights to update that field -- in other words, the task can be delegated to the users (provided an interface) where it belongs instead of having to take up the programmers' valuable time!
I actually agree but have worked with people who would still have argued against it, prefering to stick with the safety of their "method" (wherein they can open up a book and point to the line some college professor wrote saying that it's wrong) than being creative and doing the best thing.
Admin
You're assuming that the developer would be making those changes and not an end user....much better to write a admin interface that would update the sort order column, I would think.
But that's just my opinon...
Admin
In the code presented, in its anonymized form, perhaps...
I've always used the ItemData property in VB6 as I thought that's just How It's Done. However, in a situation where the ItemData property isn't available, what would be the proper way to achieve the same result?
As for the WTF, I guess I stand somewhat corrected. I've never been in a situation where I needed to have a highly specialized sort order on a list of values, and that, in combination with the fact that the specialized sort order in this instance was so close to just sorting alphabetically and the fact that no user interface was designed by which the users could change that sort order (heck, the users can't even change add, edit, or delete records in this table without getting a developer to change the tables directly), led me to believe that this was a solid WTF.
Admin
As further facts are uncovered, I can see that this system as a whole is a WTF. Not that I haven't seen dozens of equally bad applications. Some of them from industry leaders . . . Lawson comes to mind (oops! did I say that out loud?)
Admin
I don't know whether you are trying to be trollish, or over-precise, or what, but from where I'm from, Rows and Columns are spreadsheet terms (but still widely used when talking about databases), and records and fields are database terms.
Please ignore this if my sarcasm meter was simply mis-functioning...
Admin
In olden times (VB6) I used a parallel array. These days (C#.Net) I would probably derive a new class from System.Windows.Forms.ComboBox and add my new properties.
Admin
You must be from the 60's, where they actually did have record- and field- based data models (reel-to-reel tapes). [;)] With the introduction of the relational model and relational databases, the proper terminology (as definied by Codd, Date, et al) is "tables", "rows", and "columns." (relational theory uses different terms, based on set-theory: relation/revlar, tuples, and attributes). Calling a "row" a "record" is as much a gaffe as mixing up "classes" and "objects."
But no, this is not meant to troll. A fundamental understanding of relational databases is something many programmers lack. What gets dangerous (and quite WTFy) is when said programmers think they know what their doing and then do it. They often find themselves creating (within a RDBMS) the exact problems that the reltional model set out to solve.
Admin
Well, in data modeling terminology, tables are "entities", fields/columns are "attributes", and records/rows are "instances".
:)
Admin
:O
Wow, that's so cool. I didn't know you could do that. Thanks for the cool trick.
Admin
I have to wonder how much it really matters if I say "rows" or "records." If anyone were to hear me say "records" and respond, "OMG WTF are you talking about!!11!one! I have no idea what you mean! Your terminology is so foreign to me!" I'd probably punch them in the nose.
While I understand that a common terminology is a valuable thing, as long as we're talking about the same thing (and we know it) I couldn't care less if you call rows "flimjamps" and columns "sloogyhoos."
Admin
Great Googly Moogly
No, I'm only 33, learned MS Access about 10 years ago (all together now: "ah, that explains alot") and SQL server about 5 years ago.
Guess I've always assumed that "row and column" were simply informal terms for "record and field". So in a relational database, we don't use the term "record" because that would imply one complete "instance" of data (like a flat-file database), where one "instance" of data really consists of rows of data across many related tables? Is that the reason for the terminology change? Or is there another substantive difference between the terms?
Admin
A "record" may or may not comprise multiple rows across multiple tables. And the term "relational" has nothing to do with "relationships" between data (and, frankly, is a misnomer -- the term should have been "functional", which would have implied that other database types didn't work, which would have come as quite a shock to the IMS customer base), it has to do with orthogonal access path axes in n-space -- one set of coordinates will uniquely address one datum (a Cartesian function, which is by definition also a Cartesian relation; the sicking point is that while all functions are relations, not all relations are functions, and it's easy to desribe a "relational" system that does not obey the Twelve Laws). The ability to create efficient relationships between data tables is implied by the coordinate system.
Admin
[:|]
[^o)]
[*-)]
[B][B]
[:D]
Admin
Don't feel bad; I was the same way. I think I may have the honor of doing one of the most horrific things possible with a relational database in one project I did ages ago (having, of course, no experience in anything); I may post that one of these days (well, it was a "hobby" project, but I make an exception for me).
This taught me three valuable lessons: (1) I don't know everything, (2) things that I don't know I should research extensively before trying, and (3) Relational Databases are nothing like procedural programming.
The short answer: kinda. Few points, keep in mind a comparison to non-relational databases ...
There's a lot more I'm sure, but the idea is that the relational model is completely different than non-relational models.
Admin
Those are supposed to be beers, btw...
A lot of the emoticons don't work properly.... WTF? [;)]
Admin
I did assume that. My bad [:P].
Admin
"Asshat", of course.
Admin
... and the "sicking point" [sic] should have been a "sticking point". Although, to a theoretical mathematician, there may have been some sicking going on as well [;)]
Admin
Well, there may be perfectly good reasons for this (appart from such naming and so on).
Someone has mentioned putting the common selections first, it may be that the system once worked that way, but was later changed to simple alphabetical sorting.
Internationalization is another good cause. The VB6 combo does not sort international characters correctly, for instance it sorts the Swedish characters å, ä and ö as if they were a and o, which is completely wrong. Even the database does not sort correctly in an international environment. It understands å, ä and ö correctly, but it, for some screwed up reason, decides to sort v and w as if they were the same character.
It probably could be better done, but it may very well be a practical solution to a very real problem.
Admin
I had Joe Celko flog me in private correspondence on the topic of prefixes to database objects, and I'm still non-plussed by the arguments against it. The arguments seem to corresponde nicely to the arguments against hungarian notation over in C++.
For a data model of size, adding a sprinkling of semantics to the names of objects helps to organize, particlarly when the model when it is browsed in a console; conceptually related items clump together. This point is diminished when using graphical data modeling tools, I admit. That great sin is being committed when I put extra information in the names of things, I have yet to see a convincing argument.
As for the ISO standard...I would have been interested in doing that research, just not $1,000 interested. Maybe I'll start a thread over on http://lambda-the-ultimate.org about it.
Admin
Admin
Alex, were those bullet points supposed to apply to relational or non-relational databases? I can't quite tell from the phrase "keep in mind a comparison to non-relational databases"...
Admin
Those were meant to illustrate *why* there is such a big difference between those words. "Fields", "Records", etc. come from the world of non-relational databases (from CODASYL to COBOL sequential files) because they accurately describe how those systems represent data. In a relational database, we don't use files with records to store data - we use tables with rows ...
Admin
Of coures, ironically, in the pure english definition sense, the words "Row" and "Column" bring to mind a visible position somewhere (i.e., on a screen or on a spreadsheet) implying a location or an ordering, while the words "Record" and "Field" do not have those same connotations since they are much more abstract concepts or ideas.
Admin
There is a physical position (row, column) in memory (or in the store), which is what makes a relational database an efficient database. Tables are tightly defined; every column has a defined "width" and all rows contain the same number of column entries. If you know the position of any one datum, it's simply a matter of pointer math (how far over, how far down) to get from one place to another. (That's what I meant by all of that there "orthoganal data access path axes" stuff.) If you are looking for a particular value in the table, you just move to the first row, move over to the column of interest, then jump down a row width at a time until you find what you're looking for -- no need to parse, say, a comma-delimited line of text. So there is a physical order to the data, but it may not be the same as the logical order -- you can't necessarily predict the content of one row simply by knowing the content of the previous and following rows.
Admin
OK but say you have a table like this
int
char(20)
so each record is 21 bytes long
the binary data will be
[ 1 ][ 20 ];[ 1 ][ 20 ];[ 1 ][ 20 ];...
why is each [ 1 ] [ 20 ] called a row? It could just as well be called a column.
I'm also guilty of an assumption writing it left-to-right - Arabic programmers might write it right-to-left, Japanese programmers top-down, ex-busboys bottom-up, etc.
record and field are culture-agnostic terms.
Admin
Convention, if you want to get all linguistic about it. The point is that to find any string value (char[20]), you go to the beginning of the table store, move one byte (or word, depending on how the storage structure is described) to skip over the int "column", then jump through the store using an offset equal to the "width" of a "row" (the sum of all of the data widths of the "columns"). The "rows" and "columns" are just aids to visualising the storage structure; a mathematical model of the way values are mapped in memory.
And no, "record" and "field" are not culture-agnostic. Where I come from, a "record" is a textured vinyl disc used to mechanically reproduce musical performances, and a "field" is a good place to grow hay or play ball [:)] As for their use in database terminology, a "record" is a complete entry describing an entity, and a "field" describes all of the data falling under a particular label. If the entity you are describing can be completely contained in itself (without refering to any other described entity), and all of the labelled values associated with that entity are singular values, it may be possible and correct to make a one-to-one correspondence between a "record" and a "row".
Let's say, though, that you are describing a set of contacts. It would be extraordinarily silly to store the contacts' office location in each contact row, particularly if several of those contacts work in the same location. As soon as you decide that updating all identical information in one place is a good idea, you've taken that "record" and split it into two tables. One holds a single unique row that holds the office info for everyone who works for the company, the other holds a row for each individual. Is that now two records? Not if the office has three fax machines -- if you follow the Twelve Laws, you can't store more than one value in any "cell" in the table, so you have to break the fax numbers of into yet another table. And so on, and so on.
Admin
The Swedish standard for alphabetical sorting is to treat v and w as the same letter, so if the sorting of å, ä, and ö is done localized, then v and w should be considered the same also. Furthermore, it is not possible to do the sorting un-localized when the information is to be presented to humans, as different languages have different sorting-orders.
As a side note, there has been some discussion recently to change the standard sorting-order in Sweden so that v and w should be considered different.
Admin
Thats the way I feel this forum os working. If the comment I write is very short, the CAPTCHA works. If it isn't, one has to validate twice.
Admin
So, let me get this straight. A less than perfect dynamic solution to a problem is a WTF but hard coding isn't?
Admin
W/w is not a letter, it's a different symbol for V/v in Swedish.
Admin
I think the real WTF here is that someone actually still uses VB6 (Which is known to suck on more than one occasion)
Admin
So... you prepend the columns with A_ so that you don't have to prepend them with A.
WTF??
Admin
Doing so has important advantages. First, if you do a statement against a single table, you still have to prefix. So it requires less thinking. Consider all the problems if a programmer always prefixes with "A.", but once forgets it and sees the statement is still working. It would totally confuse him. Second, some database tools can automatically guess join conditions based on identically named columns. Those tools threaten the programmer's job security, since they reduce the work to be done manually. Third, some companies use hungarian notation for column names, e.g. ID_ORDER instead of ORDER_ID. This is inherently wrong, but can be easily avoided by the A_ prefixes, since A_ID_ORDER looks extremely stupid and is (technically) no longer hungarian.
;-)
Admin
GROAN
I need to invest in some better goggles.
Admin
Admin
Adam, My heart goes out to you. Good luck maintaining a system built by morons. You have the smarts to counter the stupidity - but still it takes time and energy to come to some level of understanding as to what the idiots where trying to do. Good luck to you! Hopefully the people that came up with this system are not playing with sharp knives.