Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Are You Proud of Your Code? 682

An anonymous reader writes "I am downright embarrassed by the quality of my code. It is buggy, slow, fragile, and a nightmare to maintain. Do you feel the same way? If so, then what is holding you back from realizing your full potential? More importantly, what if anything are you planning to do about it? I enjoy programming and have from a young age (cut my teeth on BASIC on an Apple IIe). I have worked for companies large and small in a variety of languages and platforms. Sadly the one constant in my career is that I am assigned to projects that drift, seemingly aimlessly, from inception to a point where the client runs out of funding. Have any developers here successfully lobbied their company to stop or cut back on 'cowboy coding' and adopt best practices? Has anyone convinced their superiors that the customer isn't always right and saying no once in awhile is the best course of action?"
This discussion has been archived. No new comments can be posted.

Are You Proud of Your Code?

Comments Filter:
  • by explosivejared ( 1186049 ) <hagan@jared.gmail@com> on Monday December 10, 2007 @09:19AM (#21640683)
    If so, then what is holding you back from realizing your full potential?

    This post [slashdot.org] should explain it. If you think hiring practices are discriminatory for minorities, try being like me!

    Cherish YOUR THUMBS!
  • by Anonymous Coward on Monday December 10, 2007 @09:23AM (#21640733)
    I'm happy with my code. It's beautiful, modular, fast, maintainable, portable and basic tasks take me only a few weeks.
  • by Anonymous Coward on Monday December 10, 2007 @09:26AM (#21640761)
    I had this problem with a guy that was complaining that my code was full of GOTO statements, used all global variables, and didn't have any comments or subroutines. Bah, it worked so why should he bitch about it?
  • by Rik Sweeney ( 471717 ) on Monday December 10, 2007 @09:28AM (#21640777) Homepage
    No matter what I think of my code, I always know (pray) that it'll never be bad enough to be submitted to Worse Than Failure [thedailywtf.com].

    That said, I do revisit code that I'd written a few years back and think "WTF were you thinking?!"
  • Lost out (Score:5, Funny)

    by gaou ( 1200987 ) on Monday December 10, 2007 @09:33AM (#21640829)
    "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration."
    Edsger Dijkstra


    Sorry mate, there is no hope :)

  • by CmdrGravy ( 645153 ) on Monday December 10, 2007 @09:44AM (#21640941) Homepage
    No wonder, that's a really old fashioned way of doing things. You need to get with the times and functional programming. Personally I do all my programming in functions, often I just need 1 or 2 big functions for a program if I make sure the functions all behave entirely differently depending on the values of the 30 or so parameters I pass to them. It's very efficient and yet still people moan !

    CalcCallWaitingTime StripIllegalCharacters CreateInterfaceToACD DrawCalendarOutline may well be quite a long title ( often it's easier to acronymise them before I hand the code over ) but it's amazing the number of loops you can reuse if you have enough switches.
  • I often find passing the function name itself as a parameter helps with loop re-use.
    That way you only need to create a single do loop and allow your cx(...) sub (result passed back in the 14th argument unless the 3rd is "E" or above in which case its pushed onto the reference you passed as arg[19 + val(arg4)].

    The last guy who tried to use the code was so awestruck with my genius he passed out!
  • Yes (Score:5, Funny)

    by Average_Joe_Sixpack ( 534373 ) on Monday December 10, 2007 @09:56AM (#21641065)
    I often use "Programmer: Alan Smithee" in the comment header
  • by sm62704 ( 957197 ) on Monday December 10, 2007 @10:13AM (#21641249) Journal
    I've seen time and time again programmers taking over for other programmers' code and saying that the previous person's code sucks. Its like a right of passage or something

    You should realise that programming is an art. In art school what you''re referring to is called a critique. It's a good thing. From an old tome I wrote about ten years ago, Steve's School of Fine Art [mcgrew.info]:

    Lesson 1: The Critique
            The ultimate in masochism. Your grade depends on the critique. In the critique, everyone in class exhibits their work, and comments on all of it. How good yours looks depends on how bad theirs looks. Each work is scrutinized and ruthlessly shredded by your competitors, whose grades depend on how good their work looks compared to yours. These people are mostly talentless losers, not unlike yourself, who desperately want their work placed somewhere where someone might see it, just like you and Vincent.

          To survive this ordeal, keep your work covered until nearly everyone has their work displayed. Place yours prominently next to the worst piece of crap in the room. While everyone is ripping each other to shreds with pompous, empty, multisyllable phrases, translate what they say into plain english, which will demonstrate to the instructor that you, unlike they, actually understand this gobbledygook. Praise everyone's work with backhanded compliments in such a way that the teacher knows that you know it's crap, while the other students think you're complimenting their work.

          Beat everyone to the punch by being merciless about your own work, especially if you've outdone yourself and have actually produced something that doesn't suck. The teacher knows what you've done right; show him/her/it that you know what you've done wrong.

          Smile smugly when you're ripped. Let your face say "HA! It worked! They HATE it!" (See Insulting an Art Student and Art History, below)

          Lastly, be an attractive woman with large breasts. The heterosexual men and the lesbians will all be trying to get in your pants and won't be hard on your work, the homosexual men will be afraid of being thought of as mysogonistic, and the heterosexual women will dismiss you completely as a total, talentless airhead. This is the only place they won't think of you as a threat.

    -mcgrew

    Condsidering the subject matter, every comment on this story should be modded "flamebait".
  • by ebbe11 ( 121118 ) on Monday December 10, 2007 @10:49AM (#21641669)
    ...as if the guy who is going to maintain it is a 6'6" tall two feet wide bodybuilding psychopath who knows where you live.
  • by Tom Cully ( 1052856 ) on Monday December 10, 2007 @10:54AM (#21641735)
    Q: How many developers does it take to change a lightbulb?

    A: 10. 1 to change the bulb, and 9 to say "no, I would have done it like this..."

    For me, this is part of the "Is programming is a science or an art?" argument. You can send a person to Art College and then have them paint for 10 years, and even then they won't necessarily produce masterpieces. Sometimes we comment like that on code we've taken over, because it really is awful...
  • by gardyloo ( 512791 ) on Monday December 10, 2007 @11:00AM (#21641841)

    It the code passes these simple rules the code is fine, leave it alone, it does NOT suck.
    That's because it puts the lotion on the skin, or it gets the hose again.
  • by mwvdlee ( 775178 ) on Monday December 10, 2007 @11:37AM (#21642357) Homepage

    So what I'm asking is: why have I always heard that #including in your headers is a big no-no?

    Everybody does it, from companies big to hobbyists small, so therefore a university cannot possibly allow it.
  • by mini me ( 132455 ) on Monday December 10, 2007 @11:54AM (#21642609)

    # Les gars sont agiles droite. Si le code est écrit Bien, il va parler pour lui-même.
    # Il n'ya pas besoin de Double emploi avec ce que dit le code dans une autre
    # langue (Anglais). C'est peu comme votre commentant Anglais paragraphes d'une
    # interprétation française. À moins français est votre langue maternelle c'est
    # juste aller Pour obtenir de la manière et de rendre la lecture de la même Anglais
    # Plus difficile. Comme un programmeur, c'est mon travail d'être Parle couramment le
    # langage de programmation de mon choix. Reading Code devrait être aussi simple que de lire un livre.
    The agile guys are right. If the code is written well, it will speak for itself. There's no need to
    duplicate what the code says in another language (i.e. english). It's kind of like commenting your
    english paragraphs with a french interpretation. Unless french is your native tongue it's just going
    to get in the way and make reading the english even more difficult. As a programmer, it's my job to
    be fluent in my programming langauge of choice. Reading code should be as easy as reading a book.

    # Cela dit, parfois, vous avez vraiment à écrire Quelque chose d'anormal, et, dans ce cas, vous devriez
    # Commentaire. Toutefois, ces cas sont rares Entre.
    That said, sometimes you really do have to write something abnormal, and in those cases you should
    comment it. However, those instances are few and far between.
  • by Anonymous Coward on Monday December 10, 2007 @11:55AM (#21642631)
    Man.. I came into an organization and saw this gem:


    LOGDIR=/opt/oracle/logs

    cd ${LOGDIR}
    rm -rf *


    The above ran as root. I'm hardly a graybeard programmer, but that just gave me chills because they wanted me to help with the code.

  • by Moraelin ( 679338 ) on Monday December 10, 2007 @01:11PM (#21643915) Journal
    Ah, kids these days... so easily impressed.

    I remember one piece of code that makes even that seem tame. Assembly, mind you, back in the 386 days.

    Someone had calculated something as a 4 byte float, then took it as a 32-bit integer, swapped the higher and lower 16-bit words, wrote it into a memory location at the start of a function, and then actually jumped to that location. I.e., he actually executed that result. That was actually in the (uncommented) assembly source code, mind you, not some accidentally disasssembling a piece of the data segment and discovering that it makes no sense.

    To this day, I have no clue what that did. Awestruck is putting it mildly.
  • by macrom ( 537566 ) <macrom75@hotmail.com> on Monday December 10, 2007 @05:09PM (#21647485) Homepage
    It's said comments are like sex - even when they're bad, they're still pretty good.

    No, programming is like sex. Make one mistake and you end up supporting it the rest of your life.

2.4 statute miles of surgical tubing at Yale U. = 1 I.V.League

Working...