Advertisement
How to add spoiler tags, edit posts, add images etc. How to - a user's guide to the new version of Boards
Mods please check the Moderators Group for an important update on Mod tools. If you do not have access to the group, please PM Niamh. Thanks!

Coding Horror

1246736

Comments



  • Korvanica wrote: »
    started a new job a while ago, NONE of the code is commented.... 80k lines of code? Lovely thanks for that...
    And then when stuff is commented, there's a good chance it's:
    populateResultMap(); // get the result map
    int i = map.get("val"); // get val from the new map
    if(i > -1)
      params[i+1] = true; // set the appropriate parameter
    return dance(params); // do a dance
    
    etc :P




  • srsly78 wrote: »
    Of all things to rage about :rolleyes: You realise most editors will just let you hit ctrl+I or whatever to autoindent everything? Stop using notepad ffs.

    Also perl is terrible and only good for writing hacky scripts. There is no such thing as a perl programmer, just jumped-up sysadmins.

    Well if this exists in Dreamweaver (CS5) I'd like to know where it is!




  • komodosp wrote: »
    Well if this exists in Dreamweaver (CS5) I'd like to know where it is!
    http://stackoverflow.com/questions/2146862/is-it-possible-to-auto-format-your-code-in-dreamweaver
    A quick Google search turns up these two possibilities:

    * Commands > Apply Formatting
    * Commands > Clean up HTML




  • srsly78 wrote: »
    Of all things to rage about :rolleyes: You realise most editors will just let you hit ctrl+I or whatever to autoindent everything?
    And then you check in the code with clearcase, and someone else goes to findmerge in your changes and suddenly has thousands of merge fixes that they have to do by hand because clearcase doesn't know how to cope with changes in whitespace sanely.
    Also perl is terrible and only good for writing hacky scripts. There is no such thing as a perl programmer, just jumped-up sysadmins.
    Really? I've seen fortune 500 companies whose entire test teams did all their work in Perl. I think they might disagree with you. But you wouldn't know, because your email would have mysteriously stopped working :D

    I may hate Perl with a new-found passion, but at least I know it's a real language and does a lot of work that keeps things ticking over...




  • +1 for Wrath of Khan (and as such Shakespeare?) paraphrasing!


  • Advertisement


  • Also a wonderful threat to cow-orkers:
    Go away or I will replace you with 3 lines of perl.




  • Sparks wrote: »
    And then you check in the code with clearcase, and someone else goes to findmerge in your changes and suddenly has thousands of merge fixes that they have to do by hand because clearcase doesn't know how to cope with changes in whitespace sanely..

    Top tip - you can install KDiff3 as your CC Merge tool and configure it to automatically manage whitespace merges.




  • 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...

    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.




  • Korvanica wrote: »
    WHY CANT PEOPLE COMMENT CODE!
    dim n as integer ' variable used for for loop.
    for n = 1 to 10 ' This is the start of a for loop.
      call method()  ' Calling method. 
    next n              ' Continue until 10 iterations.
    ' END OF LOOP!
    

    :) That is worse.




  • {-------------------------------------------------------------------------------
    Name        : TfrmQueue.tvUnderWriterCollapsing
    Description : Don't allow the list to be collapsed
    Input       : Sender: TObject
                  Node: TTreeNode
    In-/Output  : AllowCollapse: Boolean
    Author      : *********
    Date        : 10/01/200*
    Revision history:
    ! Date       ! Sign   ! Description                                     !
    ! 10/01/200* ! *********
    -------------------------------------------------------------------------------}
    
    procedure TMain.tvAgentsCollapsing( Sender: TObject;
      Node: TTreeNode; var AllowCollapse: Boolean );
    begin
      inherited;
     // AllowCollapse := false;
    end;
    
    

    This sort of comment drives me nuts, 12 lines that tells me practically nothing, just takes up space, date and author in there twice. Comment doesn't reflect what the code actually does, and it's boiler plate code anyway, but ********* obviously had it as a template, and put if f**king everywhere. Actual code wasn't any better.

    I'm a great believer in SoC. It drives me mad when someone is adding something to my code and they drop say a query component on a form and embed SQL in the UI layer, and these are so called senior guys stuck in the 90s RAD paradigm :mad: :mad: :mad:

    D.


  • Advertisement


  • 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...




  • 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.




  • 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.




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




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




  • 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....




  • 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.




  • 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?




  • 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.




  • 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


  • 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.




  • 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.




  • 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.




  • 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 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.




  • If they were not, my bad then.




  • 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.




  • 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
    




  • 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


  • 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).


Advertisement