• Mike R (unregistered) in reply to Jaime
    Jaime:
    Mike M:
    Fred:
    Ok, why it the design poor? It has a reasonable name, and actually uses parameters instead of global variables. Ok, the FreeFile thing is a red herring, but other than that it does what it has to do. Blame Bill Gates for the error handling weird syntax.

    Wellllll.... assume the target file is an Excel file that some other user or perhaps, the application itself, has open for reading. The open statement in the function will fail due to a file lock, not because the file doesn't exist.

    Why assume that f is an Excel file? Because it often was.

    But that's just kid's stuff. How about taking a stab at defending the reports section? Each Crystal Report was pointed at a purpose-built SQL table that was emptied row by row and repopulated row by row and field by field each time the report was called. The original developer had apparently never heard of stored procedures.

    How would a stored procedure help here? If you forced this idiot to use a stored procedure, he would simply write a stored procedure that clears and fills his "temp tables" using the same row by row approach he currently uses. Stored procedures are not a magic panacea for people who don't know how to use databases.

    One advantage may be that in many organisations there is a separate team to handle "installing" stored procedures (assuming they let you write them in the first place). Hopefully the guys in that area, presumeably being db specialists, would pick up the problem...

  • Mike (unregistered) in reply to Grammar Nazi
    Grammar Nazi:
    I wonder if the narrated version of these posts leave in all the spelling/grammar mistakes.

    When Grammar Nazi makes grammatical/spelling errors, it makes my head hurt.

  • Bif D. (unregistered)

    As I was browsing that truly astounding code sample, I felt a subtle chill of vague remembrance of days long past. I'd like to say "And the it hit me!" but it actually crept over me slowly like the feeling you get when you're driving home late and realize you broke the build and there's absolutely no way to fix it before the build starts.

    Anyway, except for the programming language, that code is in the style and practice of dBASE or COBOL report generation. I had to rewrite a large (for dBASE) dBASE2 app in 1995-96 and the reports used very similar methods because that's all there were. Even in 1995, the app was ancient - running uner CP/M on a 'Mini' computer. The language was so incredibly limited that what we now consider absurd (e.g. manually traversing the record set to create a simple report) WAS the only way to get things done. But that was 15 years ago! And the app was at least ten years old when I first worked on it - parts of it had 'already' been upgraded to custom Turbo Pascal 1.0 for DOS apps by my predecessor.

    So, the point I am trying to make is that code is perfectly good, clean programming style using the best practices for software development in highly restrictive database manipulation languages circa 1980.

    How old was the person who wrote it?

  • SimonC (unregistered)

    Oracle doesn't have a boolean type. All the true/false values are accessible in the system views as CHAR(xx) values:

    'Y'/'N' 'YES'/'NO' 'ENABLED'/'DISABLED' 'VALID'/'INVALID'

    and even (including the extra spaces) ' Y'/ N' 'YES '/'NO '

    The wierdness is, PL/SQL has got a boolean type, you just can't store it in tables.

  • Coder (unregistered) in reply to Jay
    Jay:
    How are SSN's not unique? Unless you're thinking that an illegal alien might be using someone else's SSN.

    Or the duplicate SSN's mistakenly issued. Or the people who, as is their right, refuse to give you the SSN. Or the people who get the SSN wrong. Or the people not eligible to have SSNs (Some Video Shops want to lend DVD's to tourists too). Or the wrongly entered SSN, including the thousands of people who seem to have the same SSN as the one on the advertising wallet insert. Or the person who's SSN was used by someone else.

  • (cs) in reply to Mike R
    Mike R:
    Jaime:
    Mike M:
    Fred:
    Ok, why it the design poor? It has a reasonable name, and actually uses parameters instead of global variables. Ok, the FreeFile thing is a red herring, but other than that it does what it has to do. Blame Bill Gates for the error handling weird syntax.

    Wellllll.... assume the target file is an Excel file that some other user or perhaps, the application itself, has open for reading. The open statement in the function will fail due to a file lock, not because the file doesn't exist.

    Why assume that f is an Excel file? Because it often was.

    But that's just kid's stuff. How about taking a stab at defending the reports section? Each Crystal Report was pointed at a purpose-built SQL table that was emptied row by row and repopulated row by row and field by field each time the report was called. The original developer had apparently never heard of stored procedures.

    How would a stored procedure help here? If you forced this idiot to use a stored procedure, he would simply write a stored procedure that clears and fills his "temp tables" using the same row by row approach he currently uses. Stored procedures are not a magic panacea for people who don't know how to use databases.

    One advantage may be that in many organisations there is a separate team to handle "installing" stored procedures (assuming they let you write them in the first place). Hopefully the guys in that area, presumeably being db specialists, would pick up the problem...

    So, developers are too stupid to write code, but DBAs will never screw it up? The root of every WTF is that somebody is bad at their job. DBAs are not immune to this phenomenon. It might work for you, maybe because you are the only competent person where you work, but the solution is not generalizable. I guarantee that if I were required to to use stored procedures for all database access and my DBA was the only one to write them, it would be a permanent source of front page material for this site.

  • (cs) in reply to Ralf
    Ralf:
    Jaime:
    Simon:
    PRMan:
    Does nobody use transactions?

    Even most of the poor programmers I know use transactions to avoid this problem in their badly-written MAX+1 code.

    They're certainly poor programmers, if they think transactions will make any difference. The problem is simply that if two users run "select max+1" at the same time, they'll get the same answer, and they'll try to use the same 'unique' key on the next insert.

    If they use the SERIALIZABLE transaction isolation mode, one will wait for the other instead of arriving at the same answer. Of course, it effectively single-threads inserts, but it gives correct results.

    Hm, no, pretty sure a Microsoft SQL Server will give back the same "next" number to two callers for all TRANSACTION ISOLATION LEVELS. It might block the insert of one party until after the other commited - but then fail the second one as this ID exists.

    So: SERIALIZABLE also does not help here!

    I apologize, you are correct. SERIALIZABLE will only hold the shared lock until the end of the transaction, which won't prevent the second connection from reading. However using the (XLOCK HOLDLOCK) hint would work properly when used in a transaction. Yes, I tried it.

  • Smitty (unregistered) in reply to Dan
    Dan:
    Lotus Notes is ideal for a CMS.

    I sincerely hope that you're a troll or that my sarcasm detector is failing utterly. Lotus Notes is ideal for crushing developer morale; aside from that it's a steaming pile of fail.

  • Dave (unregistered) in reply to blakeyrat

    Yes, SSNs would be a bad choice for a publicly accessible system. However, he said SSN "for employee".

    SSNs would be appropriate for some internal app like payroll for example. Your employer has to ask for that information and have it on file anyway.

  • Lunkwill (unregistered)

    WTF, five characters for a boolean?! And how do these losers hope to represent FILE_NOT_FOUND, eh?

  • user unknown (unregistered)

    TrUe programmers know much more than 3 boolean values. No, really, TruE, TRuE, 'true '. (and 'cogo')

  • (cs) in reply to Dave
    Dave:
    Yes, SSNs would be a bad choice for a publicly accessible system. However, he said SSN "for employee".

    SSNs would be appropriate for some internal app like payroll for example. Your employer has to ask for that information and have it on file anyway.

    Until it expands into a timesheet system, then a project tracking system, and you have offshore employees.

  • hoodaticus (unregistered) in reply to Jaime
    Jaime:
    What would you suggest a natural identifier for an order header record would be?

    How about an order or confirmation number?

  • hoodaticus (unregistered) in reply to anon

    Yes, anon, thanks for pointing out the obvious of simply asking the OS if the file exists, rather than assigning a file handle and trying to open the damn thing, throwing an exception if it doesn't exist.

  • (cs) in reply to hoodaticus
    hoodaticus:
    Jaime:
    What would you suggest a natural identifier for an order header record would be?

    How about an order or confirmation number?

    Are you suggesting that an order number is a natural identifier? This is a case where a surrogate key is so perfect that non-computer systems use them too. Think about deli counter numbers or the order numbers that are on restaurant order pads. They are simply sequential numbers that have nothing to do with the content of the transaction.

  • PeteN (unregistered) in reply to Grammar Nazi
    Grammar Nazi:
    I wonder if the narrated version of these posts leave in all the spelling/grammar mistakes.

    Do Spollung amd gammer foulups really matter all that much i think not that is just a (as we call it here Fieldhouseism)

    get a life .

  • Kirby Wallace (unregistered) in reply to Cyrus
    Cyrus:
    Fred:
    Anon:
    Fred:
    >The code module contained such gems as this function: > Function FileExists(f As String) As Boolean

    That one is actually well designed - it just looks sucky because of the way you had to do things in VB.

    No, no it isn't.

    Ok, why it the design poor? It has a reasonable name, and actually uses parameters instead of global variables. Ok, the FreeFile thing is a red herring, but other than that it does what it has to do. Blame Bill Gates for the error handling weird syntax.

    Public Function FileExists(sFullPath As String) As Boolean
        Dim oFile As New Scripting.FileSystemObject
        FileExists = oFile.FileExists(sFullPath)
    End Function

    I'm pretty sure it's likely that this system predates the fileSystemObject. I'd have to chime in with the pragmatists over the purists in this one. While I would fault it for not using descriptive, meaningful identifier names, it yet remains that the thing is solid, does what it advertises, is terse and concise, and handles all possible errors through the only two vectors that it has.

    What more could you ask? A "class" here would only add bloat.

  • oksupra.com (unregistered)

    Supra shoes are so popular all over the world. Whatever you take on Supra being in the Supra Skytop Shoes market. Now Supra Strapped Shoes also very popular attention. It is nice that they actually took the time to make Supra Skate Shoes that work well. Supra shoes is a brand that has been inspired, designed and marketed by passionate individuals. We have brought to you the fullest selection of Supra footwear at cheapest price. Overload Skateshop carries a wide range of Supra Shoes to fit your 9-stair kickflips.

Leave a comment on “The Homegrown CMS”

Log In or post as a guest

Replying to comment #:

« Return to Article