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
Hi all! We have been experiencing an issue on site where threads have been missing the latest postings. The platform host Vanilla are working on this issue. A workaround that has been used by some is to navigate back from 1 to 10+ pages to re-sync the thread and this will then show the latest posts. Thanks, Mike.
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Coding Horror

1356722

Comments

  • Registered Users, Registered Users 2 Posts: 40,038 ✭✭✭✭Sparks


    Top tip - you can install KDiff3 as your CC Merge tool and configure it to automatically manage whitespace merges.
    Oh, please let that work in here...


  • Registered Users, Registered Users 2 Posts: 8,219 ✭✭✭Calina


    Had that in a job I worked at before. It was an old program written in vb6 and there was barely a comment in sight. It was used by a boat load of people and it had loads of bugs which meant every month without fail there was about half a dozen bugs reported for it. Guess who had the joy of sorting most of those bug fixes. I tried commenting as much as I could as I went along but it was like pissing on a house fire. There was talk of replacing it but it kept getting put off for various reasons. I hope for the sake of everyone there that they eventually done it.

    Doubt it. Things like that tend not to be gotten rid of until it's far too late.

    bad and all as no comments are are badly copied and pasted comments. That's all I will say.


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    Had that in a job I worked at before. It was an old program written in vb6 and there was barely a comment in sight. It was used by a boat load of people and it had loads of bugs which meant every month without fail there was about half a dozen bugs reported for it. Guess who had the joy of sorting most of those bug fixes. I tried commenting as much as I could as I went along but it was like pissing on a house fire. There was talk of replacing it but it kept getting put off for various reasons. I hope for the sake of everyone there that they eventually done it.

    As a side project, I've inherited a VBA Excel/Access monstrosity thats been growing and constantly modified for 15yrs by about 5 different developers. No comments what so ever. 6GB of data, and I'd have to write all the Access VBA and Excel code to move it to SQL. Not that I have time to do that since its not my main job. Its just cracks me up when I have to go near it.

    Legacy VB/VBA apps seem to be in every place I've worked. Usually in the same state as the above.


  • Registered Users, Registered Users 2 Posts: 8,219 ✭✭✭Calina


    I suspect some of them are user written applications that become business critical and then, as userwriters leave...land elsewhere for TLC.


  • Registered Users, Registered Users 2 Posts: 5,246 ✭✭✭conor.hogan.2


    Teaching sql92 in late 2010. Hey why dont you teach me old english too?


  • Registered Users, Registered Users 2 Posts: 3,992 ✭✭✭Korvanica


    Had that in a job I worked at before. It was an old program written in vb6 and there was barely a comment in sight. It was used by a boat load of people and it had loads of bugs which meant every month without fail there was about half a dozen bugs reported for it. Guess who had the joy of sorting most of those bug fixes. I tried commenting as much as I could as I went along but it was like pissing on a house fire. There was talk of replacing it but it kept getting put off for various reasons. I hope for the sake of everyone there that they eventually done it.

    Its a similiar story here.... initial program was written in asp and then transferred to .NET - badly..

    the program just evolved, additions to it weren't planned and were takd on in places.. so so so so much redundancy aswell... ive found the same method in about 15 classes....


  • Banned (with Prison Access) Posts: 3,455 ✭✭✭krd


    Korvanica wrote: »
    WHY CANT PEOPLE COMMENT CODE!

    F**K SAKE...

    started a new job a while ago, NONE of the code is commented.... 80k lines of code? Lovely thanks for that...

    There are several reasons.

    1. By not commenting the code, you become the only person who understands it. You're less likely to get fired.
    2. The coder is one of these ad hoc boys who start with a clean sheet and proceed to cover it in miles of ****.
    3. The coder deliberately does it to make other coders look bad.
    4. It depends on what you're doing, but there are companies who will sell you source code but they remove all comments. They'll even construct the code in ways that makes it impossible to figure out what they've done.

    If the comments and the code is bad, it's worse than no comments.


  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    Part of my job is maintaining a few legacy apps that have been dragged from Win16 to Win32 through a spaghetti code bush and the only comments in that code is commented out code. Why would you leave commented out code in something that's kept in source control?


  • Banned (with Prison Access) Posts: 3,455 ✭✭✭krd


    fasty wrote: »
    Part of my job is maintaining a few legacy apps that have been dragged from Win16 to Win32 through a spaghetti code bush and the only comments in that code is commented out code. Why would you leave commented out code in something that's kept in source control?

    Programmers get sacked all the time. Pulling your comments is a good way of teaching the sackers a lesson. People obtusificate code for the same reason.


  • Registered Users, Registered Users 2 Posts: 40,038 ✭✭✭✭Sparks


    krd wrote: »
    By not commenting the code, you become the only person who understands it. You're less likely to get fired.
    krd wrote: »
    Programmers get sacked all the time. Pulling your comments is a good way of teaching the sackers a lesson. People obtusificate code for the same reason.
    Leaving aside the point for a moment that it's an incredibly unprofessional practice to deliberately do shoddy work, there's a small practical point to consider there. Our industry is surprisingly small, with a surprisingly long memory. People who code like that get a reputation for being a monumental pain in the <InsertColloquailDescriptionOfBodypartHere>. And sooner or later, they go into an interview with, or need a recommendation from, someone who's suffered through a week of trying to figure out their uncommented, badly written code while their manager taps a metaphorical foot in every meeting...


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


    Sparks wrote: »
    Leaving aside the point for a moment that it's an incredibly unprofessional practice to deliberately do shoddy work, there's a small practical point to consider there. Our industry is surprisingly small, with a surprisingly long memory. People who code like that get a reputation for being a monumental pain in the <InsertColloquailDescriptionOfBodypartHere>. And sooner or later, they go into an interview with, or need a recommendation from, someone who's suffered through a week of trying to figure out their uncommented, badly written code while their manager taps a metaphorical foot in every meeting...

    Plus one of your team could leave and start working for a different company. Imagine applying for a job there after writing horrible code in the previous job. I think best practise is that when leaving a company (whether you left or were sacked) try not to do anything that pisses the company or the people working there. It could bite you in the ass big time.


  • Registered Users, Registered Users 2 Posts: 515 ✭✭✭NeverSayDie


    krd wrote: »
    Programmers get sacked all the time. Pulling your comments is a good way of teaching the sackers a lesson.

    No, it really, really isn't. See Sparks' post.


  • Banned (with Prison Access) Posts: 3,455 ✭✭✭krd


    Plus one of your team could leave and start working for a different company. Imagine applying for a job there after writing horrible code in the previous job.

    People get away with things. If they couldn't get away with, they wouldn't do it. They get away with it. And they'll do things they can get away with.

    In my experience people who drip feed information for power get away with it. If someone becomes the gatekeeper on some code, system or whatever they have power.

    It should be a given that everyone should clearly comment their code. There is ABSOLUTELY no good reason (there are plenty of nefarious ones) why a short narrative of the code and an explanation of all variables, naming conventions etc shouldn't be put in the comments. The whole team could have an air crash over the Andes in the morning.

    How much resources are wasted by "teams" unable to follow or understand each others work?

    I think best practise is that when leaving a company (whether you left or were sacked) try not to do anything that pisses the company or the people working there. It could bite you in the ass big time.

    If you get sacked from anywhere - for whatever reasons - even if it's just a case they needed to lower the head count and you're just not popular enough - you will get a bad reference. The way the world works, when people f you over, they want to make sure you can't come back at them. The way many people see the world is life is one big game where everything and everyone is bullsh1t.

    The Irish IT world is tiny and it is choc a block full of bolloxes. And it's a shadow of what it once was.


  • Registered Users, Registered Users 2 Posts: 5,246 ✭✭✭conor.hogan.2


    I hope I never even have to look at your code never mind work with you.

    Comment when needed and dont be a "<InsertColloquailDescriptionOfBodypartHere>", it will come back to screw you over than it did other people.


  • Registered Users, Registered Users 2 Posts: 1,529 ✭✭✭zynaps


    I hope I never even have to look at your code never mind work with you.

    Comment when needed and dont be a "<InsertColloquailDescriptionOfBodypartHere>", it will come back to screw you over than it did other people.
    I don't think he was advocating that people leave out comments, rather pointing out how unfortunately prevalent the practice of purposely leaving out comments as active sabotage/entrenchment is.


  • Registered Users, Registered Users 2 Posts: 5,246 ✭✭✭conor.hogan.2


    If they were not, my bad then.


  • Banned (with Prison Access) Posts: 3,455 ✭✭✭krd


    I hope I never even have to look at your code never mind work with you.

    Comment when needed and dont be a "<InsertColloquailDescriptionOfBodypartHere>", it will come back to screw you over than it did other people.

    Conor, see zynaps comment.

    I don't work in software anymore. I could tell you a lot of stories. In my experience and in the experience of other people I've known, there is a lot of sabotage. There is total and utter bollox behavior that goes across the entire Irish IT industry. And a lot of the bolloxes are good at climbing the ladder.

    "Never ascribe to malice, that which can be explained by incompetence." Napoleon Bonaparte

    Napoleon was naieve. He never worked in the Irish IT industry.

    If someone strips comment from code they're doing it deliberately. If they're using a naming convention that's very confusing, it's deliberate. If every time you ask them a straightforward question, they give you a misleading one word answer, once or twice is failure in communication, every time is very deliberate.


  • Registered Users Posts: 452 ✭✭AwayWithFaries


    krd wrote: »
    If the comments and the code is bad, it's worse than no comments.

    I hate this with a passion. It so much better to just to leave out comments than put in some of the nonsensical crap I've seen at times.
    Or this kinda stuff drives me mad aswell:
    Long complicated code with no comments.
    
    var c = a+b;//c = a+b
    


  • Banned (with Prison Access) Posts: 3,455 ✭✭✭krd


    I hate this with a passion. It so much better to just to leave out comments than put in some of the nonsensical crap I've seen at times.
    Or this kinda stuff drives me mad aswell:
    Long complicated code with no comments.
    
    var c = a+b;//c = a+b
    

    Well, it's why people are meant to write their code clearly and meaningful. Well written stuff is surprisingly easy to read.

    This is required reading

    http://codecourse.sourceforge.net/materials/How-To-Write-Unmaintainable-Code.html

    50.In C++, overload +,-,*,/ to do things totally unrelated to addition, subtraction etc. After all, if the Stroustroup can use the shift operator to do I/O, why should you not be equally creative? If you overload +, make sure you do it in a way that i = i + 5; has a totally different meaning from i += 5;


    And I knew people who did this as a rule.
    49.In C++, overload library functions by using #define. That way it looks like you are using a familiar library function where in actuality you are using something totally different.

    That can be incredibly confusing if you do it multiple times. You can effectively create a new programming language. Or a programming language where the rules keep changing.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,529 ✭✭✭zynaps


    krd wrote: »
    And I knew people who did this as a rule.
    49.In C++, overload library functions by using #define. That way it looks like you are using a familiar library function where in actuality you are using something totally different.

    That can be incredibly confusing if you do it multiple times. You can effectively create a new programming language. Or a programming language where the rules keep changing.
    Ouch :) A testament to the importance and value of namespaces when you can use them (and not making every function globally visible).


  • Registered Users, Registered Users 2 Posts: 5,246 ✭✭✭conor.hogan.2


    That link is evil :) and also it runs on the premise that there is no code overviews or even anyone with half a brain looking at your code even on a weekly basis to see it is maintainable.


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    I've seen obscurification a couple of times. Pages of code that goes all over the place fore no reason. First time was a student, that was more like just badly written. The second time, was a programmer who did it to the source code of the company he was working for, just before he left to set up in competition. They only realised after he left there was deliberate errors in the code, and in their product.


  • Registered Users, Registered Users 2 Posts: 1,109 ✭✭✭Skrynesaver


    I saw a beautiful example of 49 in the International Obfuscated C contest many years ago, someone had used #define to effectively turn cc into a COBOL compiler. Truly shock and awe inducing.


  • Closed Accounts Posts: 8,199 ✭✭✭G-Money


    This isn't a coding horror issue, more just a rant.

    I'd been working on a script change and it had been through several rounds of code review where people gave me feedback on various changes to be made. All changes were made and I got the thing tested finally (our environment is very restrictive/inflexible and testing can take a long time).

    Sent the thing off for the next stage of the process which is to be approved and someone pipes up with several changes they want made. Even though they were on the code review list from the start.

    Some of the suggested changes are possibly valid but quite a few I think are personal preferences. Let's just say I'm not best pleased.

    I find it massively frustrating that this person had numerous chances to give feedback before this and they said nothing. Then when they do, it's after I've completed testing (which was frustrating to do itself) and which may set me back a week or two due to the way things run.

    Lets just say they're going to need jedi mind powers to convince me to make their changes, especially at this stage.


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    I had that problem on contract, but the person was trying to derail the project and discredit me. I assume though it would replace them, which is couldn't, just save them a bunch of time. Lucky enough the people in charge could see this and basically got the problem person to sign off the project each week at a regular meeting to keep it on track.

    A paper trail and a few stats, kept them from causing trouble anymore.


  • Advertisement
  • Moderators, Politics Moderators Posts: 40,290 Mod ✭✭✭✭Seth Brundle


    G-Money wrote: »
    This isn't a coding horror issue, more just a rant.

    I'd been working on a script change and it had been through several rounds of code review where people gave me feedback on various changes to be made. All changes were made and I got the thing tested finally (our environment is very restrictive/inflexible and testing can take a long time).

    Sent the thing off for the next stage of the process which is to be approved and someone pipes up with several changes they want made. Even though they were on the code review list from the start.

    Some of the suggested changes are possibly valid but quite a few I think are personal preferences. Let's just say I'm not best pleased.

    I find it massively frustrating that this person had numerous chances to give feedback before this and they said nothing. Then when they do, it's after I've completed testing (which was frustrating to do itself) and which may set me back a week or two due to the way things run.

    Lets just say they're going to need jedi mind powers to convince me to make their changes, especially at this stage.
    Four words: Change Control Request Form
    Let the buggers know the amount of work that it would take now along with the cost of doing them!


  • Registered Users, Registered Users 2 Posts: 3,156 ✭✭✭oneweb


    Someone forgot to comment on where the author tag is, sheer laziness...
    (!)
    <head>
    <link href="/favicon.ico" type="image/x-icon" />
    <!--This is the Document CHARSET -->
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
    
    
    
    <!-- This is the Title Element -->
    
    <title>StatCentral.ie - The Portal to Ireland's Official Statistics</title>
    
    
    
    <!-- This is the META Description Tag -->
    
    <meta name="description" content="The home page of StatCentral.ie" />
    
    
    
    <!-- This is the META Keywords Tag -->
    
    <meta name="keywords" content="Home, Statcentral.ie, CSO, Central Statistics office, Statistics Ireland" />
    
    
    
    <!-- This is the beginning of the DCMI Element Set -->
    
    <link rel="schema.DC" href="http://www.purl.org/dc/elements/1.1/" />
    
    
    <!-- Element Name: Title -->
    
    <meta name="DC.title" content="StatCentral.ie - The Portal to Ireland's Official Statistics" />
    
    
    
    <!-- Element Name: Creator -->
    
    <meta name="DC.creator" content="Central Statistics Office; Statcentral" />
    
    
    
    <!-- Element Name: Subject -->
    
    <meta name="DC.subject" content="Home, Statcentral.ie, CSO, Central Statistics office, Statistics Ireland" />
    
    
    <!-- Element Name: Description -->
    
    <meta name="DC.description" content="The home page of StatCentral.ie" />
    
    
    
    <!-- Element Name: Publisher-->
    
    <meta name="DC.publisher" content="Central Statistics Office; Statcentral" />
    
    
    
    <!-- Element Name: Contributor -->
    
    <meta name="DC.contributor" content="Central Statistics Office; Statcentral" />
    
    
    
    <!-- Element Name: Date -->
    
    <meta name="DC.date" scheme="W3CDTF" content="2008-01-31" />
    
    
    
    <!-- Element Name: Type -->
    
    <meta name="DC.type" scheme="DCMIType" content="Text" />
    
    
    
    <!-- Element Name: Format -->
    
    <meta name="DC.format" scheme="IMT" content="text/html" />
    
    
    
    <!-- Element Name: Identifier -->
    
    <meta name="DC.identifier" content="/meta-tags/dublin/" />
    
    
    
    <!-- Element Name: Source -->
    
    <meta name="DC.source" content="/meta-tags/" />
    
    
    
    <!-- Element Name: Language -->
    
    <meta name="DC.language" scheme="RFC1766" content="en" />
    
    
    
    <!-- Element Name: Relation -->
    
    <meta name="DC.relation" content="/meta-tags/" />
    
    
    
    <!-- Element Name: Coverage -->
    
    <meta name="DC.coverage" content="World" />
    
    
    
    <!-- Element Name: Rights -->
    
    <meta name="DC.rights" content="Copyright Government of Ireland" />
    
    
    
    <meta name="author" content="Central Statistics Office; Statcentral" />
    
    
    
    
    
    
    
    
    
    
    
    

    It is what it's.



  • Registered Users, Registered Users 2 Posts: 1,529 ✭✭✭zynaps


    oneweb wrote: »
    Someone forgot to comment on where the author tag is, sheer laziness...
    (!)


    <!--This is the Document CHARSET --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" /> <!-- This is the Title Element --> <title>StatCentral.ie - The Portal to Ireland's Official Statistics</title> <!-- This is the META Description Tag --> <meta name="description" content="The home page of StatCentral.ie" /> <!-- This is the META Keywords Tag --> <meta name="keywords" content="Home, Statcentral.ie, CSO, Central Statistics office, Statistics Ireland" />
    [...etc...]
    <!-- This is the jovial sarcasm element --> Man, I'd never have expected mind-numbing comment bureaucracy from them! <!-- This is the smiley --> ;)


  • Registered Users, Registered Users 2 Posts: 2,320 ✭✭✭Q_Ball


    That link is evil :) and also it runs on the premise that there is no code overviews or even anyone with half a brain looking at your code even on a weekly basis to see it is maintainable.

    This is the case where I work. Peer reviews are supposed to be done, but they're never factored into estimates. Logic behind this is that we've never done them before so why add additional cost and time to the estimate. After all, we've "built" similar for the client before, they are expecting a cost that is less or in line with.

    We propose improvements to the underlying codebase, "under the hood" so to speak, but why would the client pay for that when they are not getting any new functionality.

    I won't tell you what we were actually told to do. I died a little on the inside.

    Funny thing is, if the client actually had a technical person who could evaluate our code, I'm sure we'd have been fired long ago. The problem is they don't. So they see the figures coming in, thinking we're great and management are giving themselves a pat on the back for a "job well done".

    Meanwhile, the application (d)evolves quite rapidly into an unmaintainable mess. It really is enough to break a person.

    New job time methinks.


  • Registered Users, Registered Users 2 Posts: 4,277 ✭✭✭km991148


    Q_Ball wrote: »
    This is the case where I work. Peer reviews are supposed to be done, but they're never factored into estimates. Logic behind this is that we've never done them before so why add additional cost and time to the estimate. After all, we've "built" similar for the client before, they are expecting a cost that is less or in line with.

    We propose improvements to the underlying codebase, "under the hood" so to speak, but why would the client pay for that when they are not getting any new functionality.

    I won't tell you what we were actually told to do. I died a little on the inside.

    Funny thing is, if the client actually had a technical person who could evaluate our code, I'm sure we'd have been fired long ago. The problem is they don't. So they see the figures coming in, thinking we're great and management are giving themselves a pat on the back for a "job well done".

    Meanwhile, the application (d)evolves quite rapidly into an unmaintainable mess. It really is enough to break a person.

    New job time methinks.

    I (Briefly) worked in a place like this. Soul destroying - and as a result had very high turnover. Good developers left quickly, not so good ones stayed a while longer and polluted code further making it increasingly harder for new comers to figure out what half the products were doing/ supposed to be doing. Management couldn't understand the problem as products were still being shipped and were not interested in investing time in improving quality even although it would altos certainly decrease overall development time (It even took ridiculous amounts of time to find code, never mind work out what the fu(k it was doing due to half ars3d practices of previous 'developers').


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,182 ✭✭✭Genghiz Cohen


    "Hey, this didn't save my input."
    "Oh yeah?"
    "Yeah, I put in the names then clicked 'Save For Later' and when I came back it didn't load them. Any ideas?"
    "Oh, that 'Save For Later' button doesn't actually do anything."


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    How about the secret button.

    "Hey these calculations don't work"

    "Hit ALT Z T H"

    "What the .... does that do"

    "Fixes the numbers"

    Some coder decided to code hidden buttons to do things, so he could fix things in his apps, and others wouldn't be able to.


  • Closed Accounts Posts: 18,056 ✭✭✭✭BostonB


    Another one I don't get is coding error handlers, but then not putting any plain text explanation so users don't understand the errors, or coding to UI to to provide feedback to the user . IE "Truncated String Error" you've entered too much text. Then repeat that for every type of user input that requires validation. Or not checking a record/data already exists on input, so users enter duplicated data constantly, requiring records to be merged and fixed.

    Just ARRRTGGGGGHHH. :mad:


  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    A friend of mine recently did some development on a game I've been working on...

    Seeing people use boost::function and boost::bind when a C style callback will do makes me cry.

    Boost is the business and the above has it's place in an event driven Windows app, but not sprinkled liberally in code where performance matters inside loops processing hundreds of elements in some other data structure.

    Plus he really does not give a crap about thread safety which is why things are crashing on him and thanks to his liberal use of the above event system, I'd have to slap mutexes all over the place to make it thread safe.

    Thank **** for source control...


  • Registered Users, Registered Users 2 Posts: 7,041 ✭✭✭Seachmall


    Figured this was suited to here (if not just delete it),

    [Too wide to embed, NSFW language]

    "That's The F'ing Business"


  • Closed Accounts Posts: 6,151 ✭✭✭Thomas_S_Hunterson


    Spotted on StackOverflow: link

    Closely related to thread title.


  • Registered Users, Registered Users 2 Posts: 7,157 ✭✭✭srsly78


    Spotted on StackOverflow: link

    Closely related to thread title.

    Ok I just spat my coffee all over monitor :D


  • Registered Users, Registered Users 2 Posts: 2,172 ✭✭✭Flojo


    How come on this forum the BBcode is turned off in sigs? Surely it would prevent a lot of "sig too big" crap if allow alignment BB code NoYes?


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


    Flojo wrote: »
    How come on this forum the BBcode is turned off in sigs? Surely it would prevent a lot of "sig too big" crap if allow alignment BB code NoYes?

    I don't know about anyone else but I find right or centre alligned sigs very distracting.


  • Registered Users, Registered Users 2 Posts: 2,172 ✭✭✭Flojo


    I don't know about anyone else but I find right or centre alligned sigs very distracting.

    Really hehe, how so? Surely it's better than looking at a car crash sig!


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 83 ✭✭fatlog


    Spotted on StackOverflow: link

    Closely related to thread title.

    love the comment...

    #include "fritzl.h".


  • Registered Users, Registered Users 2 Posts: 3,992 ✭✭✭Korvanica


    if (newConfirm("<%=CO_Corrections_p%>", checkMessage, 2, 1, 0)) 
    {
         document.CorDetails.ApplyToAllDays.value = 1;
    }
    
    document.CorDetails.ApplyToAllDays.value = 1;
    

    ffs....


  • Closed Accounts Posts: 884 ✭✭✭spider guardian




  • Registered Users, Registered Users 2 Posts: 1,529 ✭✭✭zynaps



    Oh my christ.
    @@ -348,7 +348,7 @@ case "$DISTRO" in
       ln -s /usr/lib/mesa/ld.so.conf /etc/alternatives/gl_conf
       rm -rf /etc/alternatives/xorg_extra_modules
       rm -rf /etc/alternatives/xorg_extra_modules-bumblebee
    -  rm -rf /usr /lib/nvidia-current/xorg/xorg
    

    :eek: :mad:


  • Closed Accounts Posts: 5,082 ✭✭✭Pygmalion


    Been looking over some of my old code, found this gem (was scrolling through the file and the 7 levels of indentation immediately piqued my interest).

    PUmir.png

    Not something I'm particularly proud of :o.

    In fairness it was something I wrote as part of a competition and I was in "get something compiled before time runs out mode" (with a tiny bit of "oh god my brain stopped working an hour ago mode").


  • Closed Accounts Posts: 884 ✭✭✭spider guardian


    Pygmalion wrote: »
    Been looking over some of my old code, found this gem (was scrolling through the file and the 7 levels of indentation immediately piqued my interest).

    PUmir.png

    Not something I'm particularly proud of :o.

    In fairness it was something I wrote as part of a competition and I was in "get something compiled before time runs out mode" (with a tiny bit of "oh god my brain stopped working an hour ago mode").

    Good lord man. Have you entered that into the obfuscated java contest?


  • Registered Users, Registered Users 2 Posts: 1,235 ✭✭✭Odaise Gaelach


    This is probably a stupid question, but... what does it do? :D


  • Registered Users, Registered Users 2 Posts: 5,246 ✭✭✭conor.hogan.2


    Pygmalion wrote: »
    ...7 levels of indentation...

    I used to do that….. :D Well, the gist of it, I carriage return the opening braces.

    Not coding horror, but I love random/funny comments sometimes. obviously they can be abused as comments are supposed to be helpful.

    I saw "hacked from some f'in place" in some code the other day, needless to say it was bad code….


  • Registered Users, Registered Users 2 Posts: 981 ✭✭✭fasty


    But what's the fix for such deep indentation? :D


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,529 ✭✭✭zynaps


    fasty wrote: »
    But what's the fix for such deep indentation? :D
    Maybe to extract a method or two, or maybe some of the logic can be "flattened" somehow to mitigate the real problem (apart from a lack of comments); the nested loops 4-levels deep.
    It might be faster to walk the list of frames and then do whatever "bubbling up" process happens in the deepest loop, rather than testing frame.ontile(x,y) for every position on the grid.

    Still, it's a polynomial runtime at worst, which isn't a big deal :)


Advertisement