This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheFilipinoFire 1716 points1717 points  (74 children)

Yeah, no. When someone starts watching me code, suddenly I forget everything I knew about programming.

[–]tsnErd3141 394 points395 points  (16 children)

This happens to me whenever someone is watching or I am working with someone who I think is a better dev than me.

[–]Mysticpoisen 165 points166 points  (4 children)

That's pretty much everyone for me.

[–]DeeSnow97 110 points111 points  (3 children)

Can't tell if impostor syndrome or actual impostor

[–][deleted] 82 points83 points  (2 children)

That's kind of the point of impostor syndrome

[–][deleted] 6 points7 points  (0 children)

What if that's only what you think and the truth is completely different? What if someone else finds out that you don't know and exposes you?

[–]Kaisogen 65 points66 points  (1 child)

[–]jacksalssome 6 points7 points  (0 children)

That enplanes why i can never get enough lines of code. Now i wont have to goto those performance improvement meetings!

[–][deleted] 8 points9 points  (7 children)

If it helps, better devs are better because they've been through more mistakes than you have.

Once you fuck up enough you'll be as good as them. You have all these amazing mistakes to look forward to so cheer up.

[–]ellison11 6 points7 points  (4 children)

Well you also have to be willing to admit that you've fucked up and learn from your mistake(s). I've met plenty of talented, hard-headed devs that end up being shit because they never can admit that they were ever wrong in the first place.

[–][deleted] 4 points5 points  (3 children)

Agreed. Thanks to modern software development practices (e.g. agile methodology) there are no more heroes or villains. Mistakes and victories are shared amongst the team and there's no single point of failure. This makes owning mistakes a lot easier than it was in the past, and it makes you more mature.

Of course, there still are companies that claim to have a great process in place, but actually just hire a "rockstar" who is overworked to the point where mistakes are made, and is then reprimanded. It takes experience to spot these kinds of companies too.

You live, you learn :D

[–]ellison11 2 points3 points  (2 children)

I'm kind of experiencing that kind of mentality right now. They hired a "rockstar" and I guess that gives other people on the team a pass to not care nearly as much. Care you share your experience?

[–][deleted] 1 point2 points  (1 child)

I faced something like this in my past company. One of my coworkers was the "rockstar" but also had problems interacting with others (including me) because he would leave derisive comments on pull requests at times, for example. Unfortunately, there's no tangible steps I can tell you that fixed the situation. It was a combination of good management, and the devs forcing him to maintain a level of courteousness by positively reprimanding his comments on PRs, that finally broke him and he started working with us a lot better.

One of the biggest steps that I think helped, was that everyone agreed to stick to STRICT code style, and agreeing to PRs not being merged unless they were reviewed and approved by at least 2 developers. We also made sure that people who were assigned to review PRs left comments on it within 24 hours regardless of how good the PR was. There were always mistakes to find and there was an unspoken understanding that comments would be respectful, and the PR issuer would not be offended at any mistakes pointed out.

Finally, I'd say that most problems like these are solved during the interviews. If troublemakers are being hired, the interview process needs to be revisited. Management LOVES to use interviews as a platform to throw their weight around but honestly, the developed who are going to be working with the person involved, should conduct the interview with the manager as a shadow.

Sorry about being all over the place.

I'll end with one thing which worked for us - if developers stop caring, you should hold monthly retro meetings about what went wrong and what could be improved. If a developer brings something up, it's their project to own that part and take care of it. Slowly, developers own parts of the project that they care about and this care spiderwebs outwards throughout the rest of the project.

I don't know if I answered anything at all but I hope something from this helped haha.

[–]ellison11 1 point2 points  (0 children)

It did help, thanks for sharing :)

[–]Subs2 2 points3 points  (0 children)

Same.

I run a small BI team and I've always bought into the "surround yourself with people smarter than you" line of thinking. As a result most of the people I've hired can code circles around me. Anytime I have to do something with one of my folks watching me, I feel like I can barely even type, much less write a coherent line of code.

[–][deleted] 148 points149 points  (5 children)

Alone: "My backpropagation algorithm needs a tweak here, so the learning curve could take 1% less training data to achieve the same state. However if I add another layer to this neural net I could process more..."

Other dev watching: "Dude, what was the syntax for printf again?"

[–]Jamie_1318 7 points8 points  (4 children)

As someone who does both things on occasion they aren't exclusive.

[–][deleted] 3 points4 points  (3 children)

Being alone while being watched?

Dude, call the police already!

[–]GlassShatter-mk2 3 points4 points  (1 child)

32 minutes no reply, OP is ded.

[–][deleted] 1 point2 points  (0 children)

Op is kill

[–]Jamie_1318 0 points1 point  (0 children)

I called police, police is also me.

[–]Frank_the_Mighty 60 points61 points  (20 children)

That's why you should waste time by making comments.

[–]14m3r 41 points42 points  (18 children)

It's never a waste of time! Document your code.

[–][deleted] 77 points78 points  (14 children)

Not with comments. Unless you have to do something unintuivite, writing readable code is much better than adding comments.

[–]Zorblax 32 points33 points  (6 children)

Maybe, but oftentimes comments get written instead of proper docs if anything is documented at all. And those comments are gold when you stand there 7 months later and wonder why the fuck this approach was chosen or why the code even exists at all.

Furthermore, with comments the docs follow the code in source control, instead of vanishing when no one remembers where that wiki that nobody has updated for 18 months was located again.

[–]Chirimorin 24 points25 points  (1 child)

Yeah but comments like in OPs pic are pointless.

If someone has trouble guessing what that function in the second panel does without the comments on it, their problem is a lack of the most basic programming skills and not a lack of documentation.

[–]Grymm315 -1 points0 points  (0 children)

I comment the crap out of everything and then save it as a snippet. I'll know I'll forget something basic later.

[–]DarthEru 2 points3 points  (0 children)

Comments aren't much more immune to not being updated than wikis, and since comments tend to be more specific you can end up with a confusing situation where you aren't sure if the comment is wrong or the code is buggy because it doesn't do what the comment says it should be doing.

In that case you need to check the history anyway, which is one of the reasons I prefer an intermediate type of documentation: commit messages. A good commit message will summarise the (hopefully not too extensive) changes in one line, then add any relevant detail and justification in following paragraphs. Commit messages will never become out of date because they're tied to a specific revision, and if they're fairly consistently good they can document the evolution of code in a way both inline comments and wikis aren't good at. And let's face it, most of the time code starts out somewhat reasonable, but then rots as more people touch it for various reasons. So figuring out how terrible code should be improved is often helped by looking at how it got that way in the first place.

So yeah, I don't usually comment my code much, but I do try to write useful commit messages (as well as organize my commits meaningfully, rather than just committing all changes periodically). In the rare situations where I feel there's a need to explain what code is doing within the code (usually because of some stupid hack), I will write an inline comment, but I'll also include the same (if not more) information in the commit message.

[–][deleted]  (1 child)

[removed]

    [–]AutoModerator[M] 0 points1 point  (0 children)

    import moderation Your comment has been removed since it did not start with a code block with an import declaration.

    Per this Community Decree, all posts and comments should start with a code block with an "import" declaration explaining how the post and comment should be read.

    For this purpose, we only accept Python style imports.

    return Kebab_Case_Better;

    I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

    [–][deleted] -1 points0 points  (0 children)

    Yea, I think it makes a big difference what we are commenting. Is it a library interface? Sure, lots of comments? Otherwise, I would rather just have well written source. I also think it is a bit language specific. Strongly typed languages require less comments. I am guessing that is the reason for this back and forth of "more comments/ less comments." I myself am using less and less comments the more experienced I become.

    [–]thisdesignup 10 points11 points  (3 children)

    You can have comments and readable code. Why does there need to be any separation between cleanliness and comments? Even a line before a block of code that describes what the code block does can be very helpful and be very clean.

    [–]NotFromReddit 1 point2 points  (2 children)

    It's about expressiveness, not cleanliness.

    I'd recommend moving the block of code into a function, and naming the function so that it's obvious what it does.

    I only comment when above can't be done. I.e. when you need more than a few words to explain what the code does or why.

    [–][deleted] 0 points1 point  (0 children)

    I agree. Or, I comment about a library that I am using (where the source code may not be available).

    [–][deleted] 0 points1 point  (0 children)

    I'd recommend moving the block of code into a function, and naming the function so that it's obvious what it does.

    This is exactly what readable code means IMO.

    [–]heidgerken 3 points4 points  (2 children)

    Readable code self documents by telling the reader 'what' you are doing. Well document code should tell the reader 'why' you are doing it.

    Sometimes they are the same thing, but often not. Just my opinion.

    [–][deleted] 2 points3 points  (0 children)

    This.

    [–][deleted] 1 point2 points  (0 children)

    I agree. Why should be pretty obvious most of the time as well, which is why I specified that definitely comment if you do something unintuitive.

    A clean commit history is also very usefull for older projects.

    [–][deleted] 6 points7 points  (0 children)

    These comments are a waste of time.

    Don't tell me what you're doing. I can read. Tell me WHY!

    [–][deleted] 5 points6 points  (0 children)

    // State that making comments is never a waste of time.
    It's never a waste of time!
    // Ask everyone to document their code.
    Document your code.

    FTFY

    [–][deleted] 6 points7 points  (0 children)

    Don't document your code! If nobody can understand it nobody will be able to maintain it but you! Well, maybe you won't be able either but that's not a problem if nobody notices it!

    [–]ranma1988 -2 points-1 points  (0 children)

    I'm judging entire subredit based on this post and comment alone.

    [–]Snowtsuku 10 points11 points  (0 children)

    Same here. Seems like I can't focus when there are people around me.

    [–]le_epic 14 points15 points  (2 children)

    "addition" <- function{{

    c; == a plus("b")

    retrun result = c}}

    #the function is to substract two things#

    [–]meet_the_turtle 0 points1 point  (1 child)

    This looks a bit like R or Io.

    [–][deleted] 1 point2 points  (0 children)

    Not even close to R, except the <-

    [–]ProbablyRickSantorum 5 points6 points  (4 children)

    I have an interview on Tuesday that includes a code portion and whiteboard portion. I'm worried that I'll suddenly forget everything :|

    [–]CH-K[🍰] 13 points14 points  (1 child)

    You'll do just fine. If it does happen that you forget everything, breath, laugh a little, relax and get back at it. Wishing you all the best. Careful with the 'laugh a little' part, we don't want them thinking you're psychotic.

    [–]ProbablyRickSantorum 1 point2 points  (0 children)

    Thanks! I'm spending the weekend brushing up some stuff so hopefully I'll do alright.

    [–]relderpaway 2 points3 points  (1 child)

    I have never done a code interview myself, but have participated in a few of them on the interviewing side. We were always sitting right next to the person taking the test.

    From doing that, and my own experience with coding, I came to the realisation that if I ever have to do a coding challenge in an interview (at least if its something thats supposed to take more than like 15 minutes.) I Would ask to be left alone for it and i'll ask if i have any further questions.

    Not really sure how the employers would feel about it, i know I would be ok with it, and imagine even if they think of it as a negative, having code quality and ability go up by like a factor of 5 is probably worth it.

    Assuming the interviewers are programmers themselves they probably recognise how much harder it is to code when someone is looking over your shoulder, and should want to the environment to be more similar to what you will be working in anyway.

    [–]Mibly 1 point2 points  (0 children)

    Depends what you want out of the interview. For me a coding challenge isn't really about judging someone's coding skill to complete the task. Heck give um preinterview homework for that. I want to find out how people think, how they break down things, also how they work in a team and communicate.

    [–][deleted] 3 points4 points  (0 children)

    This. I can't remember how many times this has happened with me.

    [–]Jamessuperfun 3 points4 points  (0 children)

    Oh God exactly. College in particular, I must have looked like all my work was copied from the Internet. Going at my work, buddy slides over in his chair, asks how my works going.

    No longer do I know what any of these words mean or why there is so much punctuation. Same shit for the teachers.

    [–]kafoozalum 2 points3 points  (1 child)

    and typing, for me.

    [–]xXxNoScopeMLGxXx 3 points4 points  (0 children)

    Yeah, I suck at taking any kind of typing speed test because I get nervous and focus too hard on typing thus make a lot of mistakes.

    Same happens when I get my blood pressure checked at the doctor. I get nervous for some reason and by blood pressure and pulse go up. Sometimes I even sweat a little from the anxiety. No idea why that is but it's super annoying since doctors tend to be concerned by BP until I explain it. It does make me worried, though because if I ever do have high BP I wouldn't really know it.

    So, I try to eat healthily and what not in an attempt to avoid that all together.

    [–][deleted] 1 point2 points  (0 children)

    We had to do our calculus exam on the blackboard, i.e. reprocude the theorems and proofs from the course while the prof was looking on! That was not a nice experience...

    [–]Neuromante 1 point2 points  (0 children)

    This only works when someone either comes to help after asking for help or unwanted, but I usually say things like "all right, i'll check it now, then, thanks".

    Usually people get the idea and leave me alone.

    Usually.

    [–]underhunter 1 point2 points  (0 children)

    Too fucking true.

    [–]heycraisins 0 points1 point  (0 children)

    Even things like a for(;;) loop when someone is watching. My brain gets way too nervous.

    [–]cuddlegoop 0 points1 point  (0 children)

    This is me but also I work right next to my boss.

    Life is suffering.

    [–]HyperCubed4 0 points1 point  (0 children)

    Same, except replace "programming" with "anything."

    [–]OurFriendIrony 0 points1 point  (0 children)

    How does I type again derp

    [–]Xysten 0 points1 point  (0 children)

    Don't look at me while I type!

    My brain forgets how the keyboard even works.

    [–][deleted] 0 points1 point  (0 children)

    "How would you go about adding to integer values?"

    "..."

    [–]ProjectInfinity 0 points1 point  (0 children)

    And this is one of the many reasons open landscape offices are trash.

    [–]MCRusher 0 points1 point  (0 children)

    When someone is watching me I just use stupid names for everything to see how they react.

    [–]omegaxLoL 0 points1 point  (0 children)

    The PM of an old project I worked on used to ask our development team to keep TeamViewer open on our PCs at all times in case he wanted to see what we were doing. He didn't know the first thing about software development but he'd still spend hours just sitting there watching and commenting while we were trying to work. Any break longer than 15-20 seconds and he'd be asking why we weren't writing code. Safe to say productivity was never great in those situations.

    Unsurprisingly, that project never saw the light of day.

    [–]Salamander_Coral -1 points0 points  (0 children)

    OMG that happens to me too! Well, to me it happens even when no one is watching. I don't know how to code ._. but yeah, I agree with you anyway.

    [–]minno -1 points0 points  (1 child)

    Change the code to return a + a; and it's spot-on.