Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Coding Horror

Options
1192022242537

Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Clearly there's something very important about 4,8,9,11 & 12 :D


  • Registered Users Posts: 793 ✭✭✭FobleAsNuck


    seamus wrote: »
    Clearly there's something very important about 4,8,9,11 & 12 :D

    x > 7 :cool:


  • Registered Users Posts: 1,275 ✭✭✭tobsey


    x > 7 :cool:

    ... || x == 4

    ???


  • Moderators, Politics Moderators Posts: 38,941 Mod ✭✭✭✭Seth Brundle


    ...not forgetting that x <= Math.floor(12.999999)


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    After a bit of digging the number represent the index in a combo box which is populated by an enum definition.


  • Advertisement
  • Registered Users Posts: 6,250 ✭✭✭Buford T Justice


    if(isset($press_info) && $press_info['sent'] && $press_info['family_advised'] && $press_info['read_emailed'] === true){
                    $criteria_met = true;
                }
    ...some info here
    'disabled' => ($criteria_met == true ? false : true)
    

    $press_info and $criteria_met are both booleans :rolleyes:

    I wouldn't mind but its actually done properly in the same line of code. They're all booleans


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 90,766 Mod ✭✭✭✭Capt'n Midnight




  • Registered Users Posts: 6,236 ✭✭✭Idleater



    Please please please make their head of IT change their name to Bobby Tables


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows



    Jesus. Hopefully everyone using the CSV dump is correctly escaping their stuff. haha.


  • Banned (with Prison Access) Posts: 249 ✭✭Galway_Old_Man


    enum _BOOL { -1, 0, 1, 2 };
    

    :(


  • Advertisement
  • Registered Users Posts: 2,213 ✭✭✭MajesticDonkey


    enum _BOOL { -1, 0, 1, 2 };
    

    :(

    Is that some sort of superposition sh1t?


  • Banned (with Prison Access) Posts: 249 ✭✭Galway_Old_Man


    From my reading of the mess, it seems that it started life as a regular ol' two state type called _BOOL (0,1). Then someone decided they needed an unknown/unset state (-1), ok fair enough. Then the '2' was introduced for some bug fix, which is an absolute mess and one that I didn't really want to be trawling through on a Monday morning.


  • Registered Users Posts: 1,931 ✭✭✭PrzemoF


    I need a T-shirt saying "In extreme conditions a boolean variable might reach value of 2"


  • Banned (with Prison Access) Posts: 963 ✭✭✭Labarbapostiza


    Then someone decided they needed an unknown/unset state (-1), ok fair enough.

    No....there lies the path to hell.

    It gives you something like 10000001 ,00000001,00000000, as options. It's still logic, but now you'll be confusing the hell out of yourself, and there's a good chance somewhere your -1 will be taken to be TRUE, as being non zero.


  • Registered Users Posts: 1,460 ✭✭✭Anesthetize


    From my reading of the mess, it seems that it started life as a regular ol' two state type called _BOOL (0,1). Then someone decided they needed an unknown/unset state (-1), ok fair enough. Then the '2' was introduced for some bug fix, which is an absolute mess and one that I didn't really want to be trawling through on a Monday morning.
    dAEp7Wu.jpg?1


  • Registered Users Posts: 428 ✭✭[Rasta]


    enum _BOOL { -1, 0, 1, 2 };
    

    :(

    Reminds me of 4 valued logic from verilog/circuit design


  • Moderators, Computer Games Moderators, Social & Fun Moderators Posts: 80,019 Mod ✭✭✭✭Sephiroth_dude


    Is eum a variable type?


  • Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,050 Mod ✭✭✭✭AlmightyCushion


    Is eum a variable type?

    It's like a custom variable that you create yourself. E.g. you could create an enum called days that can only be given the value Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday. If you try to give it any other value then it will give an error message just like if you try to assign an int a string value it will give an error message.


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    I dug out an old application that I wrote 5-6 years ago with plans to rewrite and enhance with feature requests ive received over the years. Its for sale and I make a little side cash from it occasionally. It was pretty bug free from the first release, so I only released a minor bug fix about 5 years ago and haven't looked at it since.

    But my god...the code is horrific.
    Huge monster classes
    spaces in my code file names....SPACES!!!
    Naming conventions are non existent.


  • Registered Users Posts: 52 ✭✭DaveJoyce


    I took over some work from a 100x programmer (his opinion), and this is how he showed a form in dialog

    FormName.Show()
    While FormName.IsScreenShown
    Application.DoEvents()
    End While

    There was code after the While that should only run when the form was closed.

    IsScreenShown gets set to true when the from become visible and false when the user clicks close

    Dave

    Turbo Inventory ERP

    Helping you sell more, more often




  • Advertisement
  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    DaveJoyce wrote: »
    I took over some work from a 100x programmer (his opinion), and this is how he showed a form in dialog

    FormName.Show()
    While FormName.IsScreenShown
    Application.DoEvents()
    End While

    There was code after the While that should only run when the form was closed.

    IsScreenShown gets set to true when the from become visible and false when the user clicks close

    Jesus thats rough. Does he actually not know that ShowDialog exists or did he have some crazy logic behind this?


  • Registered Users Posts: 52 ✭✭DaveJoyce


    Jesus thats rough. Does he actually not know that ShowDialog exists or did he have some crazy logic behind this?

    To this day I really don't know, I have seen that more then once and most other forms didn't need to show dialog.

    According to the other people here, everything was wrong unless it was done his way.

    But saying that, I look amazing thanks to him. There are so many bottle necks and slow parts (selecting multiple columns from the same table one after another using different SQL commands, instead of one command) in the software that I am removing, people are starting to think I am some kind of genius

    Best job security ever :)

    Dave

    Turbo Inventory ERP

    Helping you sell more, more often




  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    DaveJoyce wrote: »
    To this day I really don't know, I have seen that more then once and most other forms didn't need to show dialog.

    According to the other people here, everything was wrong unless it was done his way.

    But saying that, I look amazing thanks to him. There are so many bottle necks and slow parts (selecting multiple columns from the same table one after another using different SQL commands, instead of one command) in the software that I am removing, people are starting to think I am some kind of genius

    Best job security ever :)

    Brilliant. Any vacancies?


  • Registered Users Posts: 13,104 ✭✭✭✭djpbarry


    DaveJoyce wrote: »
    But saying that, I look amazing thanks to him. There are so many bottle necks and slow parts (selecting multiple columns from the same table one after another using different SQL commands, instead of one command) in the software that I am removing, people are starting to think I am some kind of genius
    I actually know someone who was hired on a contract for a few months to develop a simple Java application. He finished in about a week, so in the first version of the app that he demoed to his employer, he sprinkled a bunch of Thread.sleep() commands throughout the code, then removed one a week for each new "version" of the app. Needless to say, they thought he was some sort of optimisation guru and have rehired him for several projects since.


  • Banned (with Prison Access) Posts: 963 ✭✭✭Labarbapostiza


    dAEp7Wu.jpg?1

    This is one of the causes of great general horror.

    Binary computers as opposed to analog computers, use binary, because binary has lots of features that are just not easily available with other number bases.

    The draw back is binary is neither easy to read nor type. (This is not completely true, but there's a learning curve and you need to work with the binary consistently to remember how it goes. And the same with reading Hex) One of the innovations of higher level languages was to use decimal as the base. Which is easier to read....easier to read small bits....But it leads to a massive convolution of logic, that no one can follow, and the compiler can't fix either.

    An example of the inefficiency. If there's a Boolean data type in a language, it will likely be an integer in the environment's base word length. On a 64 bit environment that will be 64 bits, or 0000000000000000000000000000000000000000000000000000000000000000, just for FALSE.

    Now imagine you want to have a data structure with eight logic switches. You create the values X1, X2, X3, X4, X5, X6, X7.

    In your high level language following standard practices you have created
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000
    0000000000000000000000000000000000000000000000000000000000000000, this many occupied transistor cells. And this stuff needs to be shipped around and stored and operated on, and it has a bulk.

    If you were programming one of those old 8-bit realtime processors with limited memory, you'd place the same data structure in 00000000. You're doing in 8 bits, what you're doing in the high level language in 512 bits. On a ZX 81 you'd nearly be out of memory before doing anything with the data structure. And the reason relatively simple applications on computers that are more than a million times faster than the ZX 81 run like clapped out dogs instead of like the clappers is because of the crap wasteful use of logic.

    On a highlevel language like C, you can actually load a 64-bit word with lots of data structure. You can do this in any language, I think. I do know it is actually still done in C for high speed and efficiency critical applications. And inside any PC, you will find some mini processors not unlike what's in a ZX spectrum doing things.


  • Registered Users Posts: 52 ✭✭DaveJoyce


    djpbarry wrote: »
    I actually know someone who was hired on a contract for a few months to develop a simple Java application. He finished in about a week, so in the first version of the app that he demoed to his employer, he sprinkled a bunch of Thread.sleep() commands throughout the code, then removed one a week for each new "version" of the app. Needless to say, they thought he was some sort of optimisation guru and have rehired him for several projects since.

    I love it what a great idea

    Dave

    Turbo Inventory ERP

    Helping you sell more, more often




  • Registered Users Posts: 8,229 ✭✭✭LeinsterDub


    DaveJoyce wrote: »
    I love it what a great idea

    Great idea till they have to do some actual optimisation


  • Registered Users Posts: 255 ✭✭mooonpie


    djpbarry wrote: »
    I actually know someone who was hired on a contract for a few months to develop a simple Java application. He finished in about a week, so in the first version of the app that he demoed to his employer, he sprinkled a bunch of Thread.sleep() commands throughout the code, then removed one a week for each new "version" of the app. Needless to say, they thought he was some sort of optimisation guru and have rehired him for several projects since.

    Reminded me of this Daily WTF article: http://thedailywtf.com/articles/The-Speedup-Loop


  • Advertisement
  • Registered Users Posts: 2,145 ✭✭✭dazberry


    Giblet wrote: »

    Going in the opposite direction - I knew a guy that worked on a team in Symantec, I think it was on some Norton product, probably something like Norton Commander, in the mid-90s. The prior version came on one 1.44MB floppy disk. For the version he worked on - they decided to add an easter egg of a group photo of all the developers (with a popup caption for each developer on mouse over). For that and that reason alone - that version came on two 1.44MB floppy disks.


Advertisement