• none (unregistered)

    I just found this section in a project I am working on. I guess using yes instead of true does save a keystroke but you know someone will set yes = false somewhere.

    if (employeeID > 0) { bool yes = true; CaseDRODataRequest result = new CaseDRODataRequest();

        result.IncludeCaseDetails = yes;
        result.IncludeEmployee = yes;
        result.IncludeJobInfo = yes;
    return result;
    

    } else return null;

  • DiverKas (unregistered) in reply to TopCod3r
    TopCod3r:
    So the lesson I want to leave you with, it is often best to store data as constants or variables in code that YOU CONTROL than it is to store it in a database that you have no control over.

    And there ladies and gentlemen, is the real WTF. A developer who didnt bother taking the time to build a maintenance screen and would rather submit to the DBA a simple DATA change. Not a table change, or SP change, but data. WTF indeed.

  • (cs) in reply to DiverKas
    DiverKas:
    TopCod3r:
    So the lesson I want to leave you with, it is often best to store data as constants or variables in code that YOU CONTROL than it is to store it in a database that you have no control over.

    And there ladies and gentlemen, is the real WTF. A developer who didnt bother taking the time to build a maintenance screen and would rather submit to the DBA a simple DATA change. Not a table change, or SP change, but data. WTF indeed.

    You seem to work for small to medium companies only. In the real world of big companies (1000+ employees) you may NOT have:

    • direct access to the database
    • CREATE TABLE (and the like) permissions
    • CREATE PROCEDURE permissions
    • INSERT/UPDATE permission
    • a budget for the creation of maintenance screens (if you don't believe it, try it out)
    • licenses for the product with which you want to create your screens
    • the time to do that all, ask for permissions (paperwork, get supervisor to sign security papers...)

    This list is not exhaustive. The situation can be so bad that you might ask yourself why you go to that place for "work", as there is not a lot you can do. Intranet is not allowed (security), VB6 is not allowed, nor Access, nor Java nor who knows what. And so on, and so on.

    So, before accusing people of being lazy or stupid, grab your own nose first and ask yourself if you really know all and everything about the business world outsidfe there.

  • (cs)

    This sounds ... familiar. While I convinced my boss on putting most of the "not-so-constant constants" on the DB, he did. But some other constants are defined in an interface, and not all of them are properly named.

    I've found some useful, like ACTIVE_STATE, some typos (DATA_SORUCE), and the best gems being something like this:

    public String AFOX = "AFOX";

    Please note that the whole idea of having these constant stuff is to minimize rewrites in case the "magic codes" change. Which might lead us to:

    public String AFOX = "OMFG";

    Nice.

  • cory (unregistered) in reply to APH

    This post is ABOUT the grue.

  • Ulti (unregistered) in reply to TopCod3r

    I hope this is a joke and or bait, even if it is I'm going to byte nom nom.

    TopCod3r:
    One of the great things about this site is having the opportunity to educate young developers as they start out on their career.

    Constants are something you should use to make your code more readable, and it is a good idea to keep them all in a central location.

    I am not a Java programmer (although I am sure it would be easy for me), but I have chosen to go into the more lucrative field of Visual Basic, since it is higher demand and has more room for promotion. Anyways...

    In VB, I like to put constants anywhere that the value could change. For example, in our ordering system, I have all the sales tax codes as constants, so if they change, all I need to do is whip open Visual Studio, make one change, recompile and I'm finished, no big deal.

    If you are a DBA, and not a developer, you might ask why do I store them as constants rather than in a database (and beleive me I have had to fight this fight), the answer is it takes less time to re-compile my application, than submit a database change request and wait for the DBA union to run my update script.

    So the lesson I want to leave you with, it is often best to store data as constants or variables in code that YOU CONTROL than it is to store it in a database that you have no control over.

    Ummmm first off compile time constants for variable data? WTF! What is wrong with an XML shudder or flat text file and then sending sighup to your process (or have it pole for modification time on the file) and have it get all that stuff at runtime.... you know so minimum of downtime etc. Or if you are in .NET what is wrong with using something like SQLite I'm sure there must be a built in class for dealing with it? It's this kind of thinking that leads to this kind of WTF.

    SCENE: Friday afternoon after a pub lunch.

    MOTIVATION: Office politics knee jerk reaction - They wont let me do what I want without waiting for someone else (I'm losing control of my "workflow"), I will stomp my feet and do something reactionary without thinking so that it's faster and easier for me, screw the consequences.

    CUE: WTF

  • John V (unregistered) in reply to Ulti
    Ulti:
    I will stomp my feet and do something reactionary without thinking so that it's faster and easier for me, screw the consequences.

    Classy

    (I might try it myself :P)

  • billy-joe-jim-bob the IIIrd (unregistered) in reply to BlueCollarAstronaut
    BlueCollarAstronaut:
    I can never remember which symbol is greater than and which one is less than
    English reads left-to-right (it's an SVO language - wikipedia it). So do the operational symbols, including 'greater than'.

    Therefore a > b reads as "a is greater than b".

    Now, who's seen my banjo?

  • Bill (unregistered)

    You start with the database, then write constants files? How very old-fashioned.

  • Eric (unregistered)

    Congratulations, you have discovered the dumbest thing I've seen all week.

  • srm (unregistered)

    not true! that never happened! suck thumb

  • ManiacZX (unregistered) in reply to akatherder

    It also helps out in case at some point some crazy math genius comes up with a proof that 14 is actually 18.

    While everyone else scrambles to catch up with this major revelation, these guys will be set.

    They won't have to go through all of the code changing >= 14 to >= 18, instead just change public static String _GREATER_THAN_OR_EQUAL14 = ">=14"; to public static String _GREATER_THAN_OR_EQUAL14 = ">=18";

  • Andrew (unregistered)

    Shhh this person is sitting right behind me and calls himself "The team lead."

  • (cs)

    class _1641 ....

    lol ...

    Long time ago I saw C code like this: #define CLASS class #define IF if

    ...

  • (cs) in reply to Andrew
    Andrew:
    Shhh this person is sitting right behind me and calls himself "The team lead."

    kick the "team leader" into his ass ... ;-)

  • (cs) in reply to APH
    APH:
    Am I the only one who caught the Zork reference? Seriously, isn't ANYBODY going to be eaten by a grue?

    It is well-lit. You are likely to be eaten by an eurg.

Leave a comment on “Constantly Expanding”

Log In or post as a guest

Replying to comment #:

« Return to Article