What would happen on the job?

This is a discussion on What would happen on the job? within the C Programming forums, part of the General Programming Boards category; If someone had a job as a programmer and they used bad naming convention constantly, what do you think would ...

  1. #1
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    265

    What would happen on the job?

    If someone had a job as a programmer and they used bad naming convention constantly, what do you think would happen? Take for example this snippet below:

    Code:
    #include <stdio.h>
    int main(){
    
        int *__ = (int *) malloc(sizeof(int));
        int *___ = &__;
        int _____;
        int *__12__34__56____78 = (int *)malloc(sizeof(int));
        int d398w9eskj__wuj = 0;
    
    
        scanf("%d",&__);
    
    
        *___+= 1;
    
        _____ = *___+ 2;
    
        *__12__34__56____78 = 5;
    
        d398w9eskj__wuj = *__12__34__56____78;
    
        printf("%d\n",*___);
    
        printf("%d\n",_____);
    
        printf("%d\n",d398w9eskj__wuj);
    
    
        return 0;
    }
    Do you think someone would try and help them by say, letting them know that what they are doing is bad? Or do you think they would get fired? I would never do something like this, just curious. Does this type of thing ever happen in the real world?

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    I have had coworkers fired for poor coding practices. (I drove the effort on one of them, as a matter of fact.) Yes, it happens.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,712
    Looking at that example... I would make him an offer he can't refuse.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    That's not a bad naming convention, it's a bad joke.

    At least the names are completely meaningless. I've seen far worse code, where the names had apparent meanings which had little or nothing to do with what the code was actually doing.

    A poorly chosen name for something can literally cause weeks of wasted effort. Would it get you fired? I'd rather say that it would prevent you from being hired to begin with. Anybody writing code like that who actually finds employment is clearly working for people even dumber than he is.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  5. #5
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    My first inclination is that of brewbuck...it was a joke. Were the author serious, I would think he/she would be warned and expected thereafter to follow reasonable standards.

  6. #6
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    265
    Heh, I sometimes have the bad habit of using a single character as a variable. Say "b" or "e" for "begin" and "end" respectively. Though this is usually just some sort of draft code that never leaves my personal desktop and nobody else ever sees it. Heck, who else (at the moment) WOULD see it? I don't have a job in the field yet.

  7. #7
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,650
    You'd better break yourself of that habit. When you DO get a job, it likely won't be tolerated in any decent shop.

  8. #8
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    265
    Yeah, I know it just sounds ridiculous but I sometimes just find it to be quicker(as if it takes sooo long to type a few more characters). Also, this may be off topic but in class today, I had another student tell me that he dropped the computer science major and switched because they used "old crappy languages like C, C++ and Java". I thought to myself, thats most of the languages I know! He then went on to say "I wish they were using something newer like Visual Basic". Now, I've never used visual basic, but is it really that much better than C or C++? Not saying that I would drop C, Python, or C++ for VB but I'm just wondering.

  9. #9
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by Syscal View Post
    Yeah, I know it just sounds ridiculous but I sometimes just find it to be quicker(as if it takes sooo long to type a few more characters). Also, this may be off topic but in class today, I had another student tell me that he dropped the computer science major and switched because they used "old crappy languages like C, C++ and Java". I thought to myself, thats most of the languages I know! He then went on to say "I wish they were using something newer like Visual Basic". Now, I've never used visual basic, but is it really that much better than C or C++? Not saying that I would drop C, Python, or C++ for VB but I'm just wondering.
    If he switched majors away from CS because of the specific programming languages being used, then it's a good thing he switched, because CS has little or nothing to do with programming languages, and he obviously had no idea what it was about.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #10
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    If you seriously think that naming variables "__" and "___" isn't a horrible idea, you likely wouldn't have gotten past the hiring process in the first place. If you're joking, I would hope a co-worker doesn't think that committing code like this on a regular basis is funny. They would certainly be verbally told to knock it off as soon as someone saw it. How long would it take to get fired? Where I work - probably a long time. If it was my own business and my living partly depended on their performance, and they had already been told how obnoxious and counterproductive it is, they would probably be let go the next time I saw them do it.

    As for your other question: If your friend left the CS major because he considers C, C++ and Java "old crappy languages" in favor of Visual Basic, CS is likely not the right major for him anyway. Perhaps he would enjoy working in Graphic Design, UX Design or something like that. Even Software Development might be a better major, but CS programs generally focus on a lot more theory and mathematics / logic. Visual Basic is hardly the best language to use in teaching a class on those topics (even though I agree with brewbuck, that the language matters very little). Compared to other languages, I hear almost no talk about Visual Basic being used in a serious setting anymore. Even when it was more popular, it was really only targeted at developers who wanted to create user-applications fairly quickly.

    Incidentally, are you trying to start a flame war? You seem to be bringing up some fairly obvious points.

  11. #11
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    265
    No, that wasn't the idea at all. I guess the "bad naming" example I proposed was a bit extreme. Besides, how would THIS start a flame war? If someone can't take the heat, so be it. Even though that isn't what I was trying to do.

  12. #12
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    <sniffs the air>

    I am not detecting any smoke, Captain.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  13. #13
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    Asking questions about which language, x or y, is better can be a sore point around here. As some experienced programmers around here have pointed out, after a while, all the languages start looking the same. Which one you use depends on the job.

  14. #14
    C lover
    Join Date
    Oct 2007
    Location
    Virginia
    Posts
    265
    Quote Originally Posted by brewbuck View Post
    <sniffs the air>

    I am not detecting any smoke, Captain.
    I take it thats your way of being sarcastic?


    Kermit,

    I definitely do not consider myself an experienced programmer. Heck, I only know Python, Java, C, and C++. Aside from programming, I know Javascript, HTML and CSS. I would see no reason for someone to get mad. Everyone has an opinion. But do all languages look the same to you? Definitely not to me. I just see different ways of doing the same thing.

    EDIT: While I am at this, can I ask what a day at work is like for you guys? Is it non stop coding until your shift ends? Then only to go home and work on the project some more? What happens if someone doesn't know how to code something?
    Last edited by Syscal; 09-07-2010 at 05:58 PM.

  15. #15
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Besides, how would THIS start a flame war? If someone can't take the heat, so be it.
    For starters, bring up a discussion on programming languages generally degrades into that, and your argument for your variable naming convention seems like you're just trying to get a reaction.

    can I ask what a day at work is like for you guys? Is it non stop coding until your shift ends? Then only to go home and work on the project some more?
    It would vary depending on the exact job, but my job, as does most, also involves a bit of walking around and talking to different people to clarify what people need, trying to help someone solve a problem, bouncing ideas off people, etc... I also try and spend time writing documentation and training materials based on what I learn. When I go home, I leave work at work. I have funner things to do at home (which sometimes is coding, but on more interesting projects).

    What happens if someone doesn't know how to code something?
    After a certain level of experience, it really becomes a question of breaking down the problem correctly. Talking to other people can help, etc... But most of the people I work with almost never run into something they don't know how to at least start doing.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. crazy pipe/fork
    By fortune2k in forum C Programming
    Replies: 8
    Last Post: 03-13-2009, 11:28 AM
  2. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 03:49 PM
  3. a VB.NET job
    By Brain Cell in forum A Brief History of Cprogramming.com
    Replies: 20
    Last Post: 05-09-2005, 06:41 PM
  4. I can't find a job.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 42
    Last Post: 06-29-2003, 08:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21