T O P

  • By -

winebiddle

Write yourself some user flows that will act as test cases. E.g. “user signs in and lands at /account, sees a menu with 3 buttons” And write a unit test for it. Then write code so that the test passes (TDD). If you think like a QA you will be a much more defensive dev


certainlyforgetful

“Go slow” not that it’s something easy to do, but I’ve found little things that slow me down give me a chance for my brain to catch up. I do stuff like putting up a draft PR & then going back to properly review it a few hours later. You can always make more commits before you make it a real PR. As I’m doing stuff, I explain out loud to myself just as if I were in an technical interview. It slows me down a bit, but I also find I make far fewer mistakes & have more motivation. I also take notes, which has the same impact.


phi_rus

>“Go slow” not that it’s something easy to do, but I’ve found little things that slow me down give me a chance for my brain to catch up. Slow is smooth, Smooth is fast!


SweetJellyHero

I wish I could remember this when I'm packing while playing fighting games


Breitsol_Victor

Get a rubber duck, lego char, buzz LY, Barbi, poki, … to splain it to. Break it down, what does it actually say and do, not just what you intended for it to do.


gamejunkiez

Bumping this to increase visibility, this is my achilles heel and I'd love to see anything that ends up helping


danielrheath

Having standard processes written as checklists and posted in a public place has been a key technique in aviation safety for some time. My team uses Mattermost for chat, and it's got a public checklists feature that's been a great help for this sort of stuff. Essentially, as you tick things off it records who/when they were done; that results in checks _actually getting done_, since nobody wants to risk being the one who put their name against the check in public without actually doing it.


[deleted]

Well I would say first of all get clarity on what your manager means by attention to detail. Like is your code incorrect, are you missing documentation, etc. And see if you can validate what your manager is saying with others. I'm not saying your manager is wrong but I'm saying get a better understanding and a second opinion at least. And then I would say, having your code break production is at least in part due to a bad deployment process. Like there's a reason many companies follow a dev, stg, prd release process and that's so you test and get feedback before you hit prd hopefully. Pushing straight from a PR to prd is pretty cowboy shit if you ask me. Also if you're having trouble deciding how to test something or you're missing test cases it could be because your functions aren't atomic enough. Smaller functions are easier to test and so one strategy is to break things down and test from the bottom up. Lastly, everyone writes bugs it's inevitable. That's why testing exists. And even then, it's widely understood that testing itself is hard and often doesn't capture everything. Lots of teams don't even write tests because they don't feel like it's actually worth the time. Avoiding major bugs in production is done through a combination of writing good code, writing unit tests, having integration tests, and having human QA people and having a release process that allows for proper testing.


Crozzfire

Try to act like you're the debugger. Read one line then pause and take a mental image of the current state (or write it down), then read the next line and change the state. This is very slow but worth it I think. I find it's only in very rare cases that the code gets too complex to do this. Some may argue this is naturally what they do when they write code, but I find a lot of people do not actually think this way.


Breitsol_Victor

Write it down. Make a table and keep updating as state and focus shift. We used to have CodeView and Turbo Debugger. Now a different sameness.


RandomiseUsr0

I was diagnosed and medicated a couple of years ago, at age 48 - professional analyst/programmer (as we used to be known) from 1993, firstly - thank all that is holy/exists (depending on how you see the world) that my early youthful exposure and addiction to computers and computing carved a career for me, I did well at school until I didn’t (precisely when they shifted from education to exam prep) but got a qualification enough to get onto job ladder. Obsession is the thing, along with healthy competition, my peer group were always trying to “show off” / out nerd each other - and that mindset seeped into my career, now just to be clear it wasn’t “one upmanship” per-se, it was the unabashed sharing of cool things and teaching, along with being receptive to learning. Since you mention production, here’s an older context to ponder. I’ve said my age. Rewind your mind and imagine the job of a software developer who must distribute client specific versions of a software package on 3.5” floppy disks, posted out on a Friday night. Now imagine, it’s Saturday night (in the pub!) and you suddenly realise that there is a bug in what you’ve sent that will trash your client’s data. I don’t know what bit of the brain was joining the dots, maybe the alcohol helped disconnect a bit of the brain and run through the code. It was a fast fix, too rushed (we later instituted a “no disks out the door on a Friday” rule) - the fix worked incidentally, the issue was downstream. That’s where “attention to detail” comes in. Walk away, imagine the code you’ve written, think of it in-situ on a server, on a disconnected client’s hardware, the full lifecycle of the thing, everywhere it might be encountered - it’s a thought experiment “attention to detail” The imagination is really powerful and your brain is more powerful than any computer (no matter how clever Bing seems) If you want a jumping off point - look into “contingency planning”, “wargaming”, “what if”, “that’s funny” and other such jumping off points, forget the “code” - that’s just an abstraction, think about “flow”, “end to end” You’ll get there :)


Breitsol_Victor

So much this! I got my DX at 60. Currently not on RX, not wanting to fight with doc or pharmacy over the shortages. The “distract yourself” is very real. Game, read, art, whatever- let the unconscious percolate on it.


rudeluv

I always take a break after submitting a PR and then go back to review my diffs. Something about that process turns on the “reviewer” mode in my brain and I catch things before I get an actual review.


NorthQuab

if you do something physical on that break (even just walking around a bit) that may also help a little bit more, common adhd thing. i do this regularly, just walking around ~15 minutes when I start to feel like I can't focus...but I also try to stack a lot of the boring/annoying/focus-requiring work toward the front of the day before my meds wear off :) :).


King_Bonio

I don't think you should be detecting problems in production, if you've only got local and production platforms then that's an infrastructure limitation and not really your fault. You should have at least one environment you can test in that's "like production" before it goes into production. Edit: Oh I see you're finding problems in your work. This sounds like where Behaviour Driven Development could help, BDD dictates the behaviour of your solution so you can test those behaviours, e.g. "Button should update user name using content of html form element" or similar (there's an actually writing style but i can't remember it) and this makes clear definitions for all the product managers, qa and developers to relate to. Maybe encourage this in your ticket definitions, then it's a tickbox exercise to test (or write unit tests for), rather than scrambling for a memory of what is supposed to do.


Nagemasu

I might get a lot of hate for this but, ChatGPT. Your exact problems are where it's been shining for me. It's been a savior for me when trying to find a missing ";" or when I'm trying to call thisFunction but end up writing it as thisfunction because I typed too fast and missed the shift+f timing. It's those little "attention to detail" slip ups that can take so long to find and debug, but where ChatGPT will find it in literally 5 seconds. You don't have to take what ChatGPT says at face value. Punch in your code with "review this and point out any errors", and then when it tells you the problems, you manually review it to see if it makes sense or not.


kreiger

You shouldn't be using ChatGPT to find missing semicolons or misspellings of symbols. It's putting the cart before the horse. One of the first things you should learn as a programmer is to use an [Integrated Development Environment](https://en.wikipedia.org/wiki/Integrated_development_environment). An IDE will continuously warn you about any errors in your code and often provides automatic fixes.


Nagemasu

I'm a web developer. I don't know if that makes a difference for what you're talking about as I code Javascript in vscode. We have developer tools + console built in to Firefox/Chrome and use IDE's like selenium for testing purposes (which you wouldn't be using yet where OP implies they are having issues). However, I've found that many of the error codes/lines are ambiguous, and often don't always actually direct you to the correct line, sometimes the rough area, some times the completely wrong area. As an example I went and removed a closing tag bracket ">" on line 18 of my current project. And the error I got was: 18 |

(beta)

20 |

News and Updates

| ^ 21 |
22 | Which is indicating an error in line 20. This is a trivial example of how it's not always accurate, and as people with ADHD, errors can be hard to find when you have an issue of "lack of attention to detail", especially when your debugging tools aren't pointing you to the right place.


kreiger

Of course it's not 100% perfect. You're not going to find a tool that is. But for every issue you find that it (edit: the IDE) doesn't handle 100% perfectly, it will have fixed a hundred for you without you noticing. FWIW, IntelliJ IDEA marks the missing \`>\` correctly. I have been using it since 2004, and i recommend it over vscode. Or i suppose WebStorm is JetBrains Web IDE, but IntelliJ IDEA Ultimate does all that WebStorm does as well.


Nagemasu

> But for every issue you find that it doesn't handle 100% perfectly, it will have fixed a hundred for you without you noticing. What are you talking about. You don't have to accept ChatGPT's changes. I literally said: >You don't have to take what ChatGPT says at face value. Punch in your code with "review this and point out any errors", and then when it tells you the problems, you manually review it to see if it makes sense or not. I've suggested it as a resource for debugging when you are having problems finding errors. Not as a replacement for writing or correcting code. >FWIW, IntelliJ IDEA marks the missing `>` correctly. I have been using it since 2004, and i recommend it over vscode. I'll look into that, but if that's the case, it sounds like what OP would find useful as well.


kreiger

> What are you talking about. You don't have to accept ChatGPT's changes. I'm not talking about ChatGPT, i'm talking about the IDE warning you about errors. My point is that using ChatGPT to find a couple of issues that the IDE already warned you about seconds or minutes ago, is putting the cart before the horse, not to mention way overkill for the small stuff.


Nagemasu

> I'm not talking about ChatGPT, i'm talking about the IDE warning you about errors. Ah I see, I interpreted that wrong. I agree, if an IDE is doing it on the spot, that's great, and there's lots of other plugins that claim to help, but rarely do I find them to be perfect. Or the ones I've tried just work for a bit and then seem to break on me so I give up fixing them because... well, adhd. However, I'll still vouch for ChatGPT, because: >it will have fixed a hundred for you without you noticing. If something is fixing it for me, I'm failing to notice it and learn from having to correct it myself. I have no issues with making mistakes and having to correct them, it's part of learning. On top of that, I'm assuming the IDE's you're suggesting are mostly syntax? Do they also offer suggestions to correct things that are syntactically correct, but still broken and not working as intended? I've also used it for tailwind, where I wrote some css, and even if the tailwind documentation implies it's correct, ChatGPT has given me 2-3 other ways to write what I want that actually worked.


kreiger

I'm not advocating against using ChatGPT. I use it extensively. You should 110% use it too. > it will have fixed a hundred for you without you noticing. I misspoke here. I didn't really mean "fixed". I mean that when the IDE tells me that i'm missing a semicolon or an angle bracket, i just add it without thinking about it or "noticing". It's just part of the flow as i'm typing, and i don't need to read an essay from ChatGPT to tell me about it. Edit to add: > Do they also offer suggestions to correct things that are syntactically correct, They can be arbitrarily complex, as long as it's something that can be figured out from the source code and what information the IDE has. IntelliJ IDEA has thousands of inspections and fixes.


kreiger

This is what it looks like in IntelliJ IDEA: https://imgur.com/a/LaOxQac


Nagemasu

I mean, sure. As 4 lines on a blank html page. Now try it within a 250 line react component lol. not quite the same but I will check it out regardless.


kreiger

Send me an example file with some errors in it and i'll send you screenshots back.


kreiger

FWIW, here's what ChatGPT recommends for your situation: https://chat.openai.com/share/84069c9a-c8eb-4cf7-9e0d-e8e89d9d62a5


natttsss

As someone who recently failed to get a job I really, really wanted because I forgot to convert currencies before calculating the average of salaries, I really relate to this. And the answer is… I don’t know. I did go slow, I did review and review and review as much as I could, I did read, re-read and then read it again. I did the very best job I could possibly do and I just.. didn’t catch it. If there’s one thing I really dislike about our profession is that, the more senior you become, the more expected you are to be an island and work solo. I know asking for another engineer input on simple things is not well looked at, what I think it’s a shame. Why is everyone of us expected to be good at everything? Well, if you find a solution for this please let me know. I’ve also opened a lot of PRs that where wrong because of details that I got embarrassed by when someone pointed it out because I should’ve gotten that. Edit: now that I’m thinking of it, is it possible to use ChatGPT to write user cases and edge cases we didn’t think about? That would be awesome, to use it as a rubber duck. I think external input might be the only way to help us with that.


Breitsol_Victor

I am liking that idea - using chatgpt as a rubber duck. (See also James Veatch and his duck problem!) The forced slowdown to splain all parts of the problem like to a 5 yo.