There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

smotherlove , in There once was a programmer

I’ve always, always been a documentation-only guy. Meaning I almost never use anything other than the documentation for the languages and libraries I use. I genuinely don’t feel that I’m missing out on anything, I already write code faster than my peers and I don’t feel the need to try to be some sort of 10x developer.

TrickDacy ,

Is there a c/iamverysmart ?

smotherlove ,

Learning the proper way to do things has nothing to do with being smart. I don’t think I’m smarter than my peers, I just have a longer attention span (thanks adderall!)

TrickDacy ,

Yeah I don’t buy it. I don’t think I’ve ever once used documentation so good I didn’t need to use a search engine at some point. Kind of odd you pretend you never use one lol… You and all the downvoters seem to have some kind of strange complex where you need to feel superior

smotherlove ,

I don’t get how you could think that’s what I meant. Every person with an internet connection uses a search engine. I use search engines to find relevant documentation. I assumed that went without saying.

TrickDacy ,

You say you use documentation only. You obviously use stack overflow or other forums too, like the rest of us. But keep on pretending

smotherlove ,

If you don’t believe me, there isn’t really anything I can do to change your mind. It doesn’t matter to me either way, but no I don’t go on stackoverflow because it’s toxic and unhelpful. I go on forums or IRC if I want to discuss the development of a library.

Honestly, I am pretty used to the “you can’t do things your way, you have to do them our way or it wont work” shit because practically every neurotypical thinks this way. All I’m saying is there’s a reason I’m faster than my peers. I don’t know how much of that is due to my avoidance of “crutches” but I’m certain it’s nonzero.

wizardbeard ,

This comment says a hell of a lot more about you than the other person here.

TrickDacy ,

The fact that you people pretend to only use documentation like some elitist boyscouts actually does say something about you.

I don’t believe you, you’re lying, you just want to seem smart. I don’t give a flying fuck if random Internet people think I’m smart or whatever the hell else you’re suggesting. Just flat don’t care. I know there is nothing wrong with using search engines and stack overflow and that we all do it. Pretty weird you all pretend otherwise. Kind of sad really that your ego requires this of you.

alignedchaos ,

Sometimes there are better methods to implement something, and we can learn from others’ mistakes without having to make them ourselves

wizardbeard ,

How would chatgpt streamline that any better than other documentation and skimming things like programming blogs and stackoverflow?

emptiestplace ,

It’s not as dumb as you are suggesting. I’ve been programming in various languages since the 80s and I can say with confidence that your take is, at best, absurd. Go spend some time with GPT 4.

smotherlove ,

I’m IP banned due to my VPN. If they don’t want my business, that’s fine. I’m not getting off my VPN just to interact with proprietary software.

alignedchaos ,

“skimming things like programming blogs and stackoverflow”

Like this commenter claims he doesn’t do?

smotherlove ,

Isn’t this why we use external libraries?

canni ,

I’ve always, always been a intuition only guy. Meaning I almost never use any thing other than blind guessing on how languages and libraries work. I genuinely don’t feel I’m missing out on anything, my farts already smell better than the rest of my peers and I just don’t feel the need to learn the modern tools of my trade.

blackbirdbiryani , in There once was a programmer

For the love of God, if you’re a junior programmer you’re overestimating your understanding if you keep relying on chatGPT thinking ‘of course I’ll spot the errors’. You will until you won’t and you end up dropping the company database or deleting everything in root.

All ChatGPT is doing is guessing the next word. And it’s trained on a bunch of bullshit coding blogs that litter the internet, half of which are now chatGPT written (without any validation of course).

If you can’t take 10 - 30 minutes to search for, read, and comprehend information on stack overflow or docs then programming (or problem solving) just isn’t for you. The junior end of this feel is really getting clogged with people who want to get rich quick without doing any of the legwork behind learning how to be good at this job, and ChatGPT is really exarcebating the problem.

chicken ,

If you can’t take 10 - 30 minutes to search for, read, and comprehend information on stack overflow or docs

A lot of the time this is just looking for syntax though; you know what you want to do, and it’s simple, but it is gated behind busywork. This is to me the most useful part about ChatGPT, it knows all the syntax and will write it out for you and answer clarifying questions so you can remain in a mental state of thinking about the actual problem instead of digging through piles of junk for a bit of information.

el_bhm ,

Just a few days ago I read an article on the newest features of Kotlin 1.9. Zero of it was true.

Internet is littered with stuff like this.

If model is correct, you are correct. If model is not correct, you are working on false assumptions.

chicken ,

No difference there, either way your information may be wrong or misleading. Running code and seeing what it does is the solution.

bear ,

Never ask ChatGPT to write code that you plan to actually use, and never take it as a source of truth. I use it to put me on a possible right path when I’m totally lost and lack the vocabulary to accurately describe what I need. Sometimes I’ll ask it for an example of how sometimes works so that I can learn it myself. It’s an incredibly useful tool, but you’re out of your damn mind if you’re just regularly copying code it spits out. You need to error check everything it does, and if you don’t know the syntax well enough to write it yourself, how the hell do you plan to reliably error check it?

_danny ,

You absolutely can ask it for code you plan to use as long as you treat chatgpt like a beginner dev. Give it a small, very simple, self contained task and test it thoroughly.

Also, you can write unit tests while being quite unfamiliar with the syntax. For example, you could write a unit test for a function which utilizes a switch statement, without using a switch statement to test it. There’s a whole sect of “test driven development” where this kind of development would probably work pretty well.

I’ll agree that if you can’t test a piece of code, you have no business writing in the language in a professional capacity.

wizardbeard ,

The more you grow in experience the more you’re going to realize that syntax and organization is the majority of programming work.

When you first start out, it feels like the hardest part is figuring out how to get from a to b on a conceptual level. Eventually that will become far easier.

You break the big problem down into discrete steps, then figure out the besy way to do each step. It takes little skill to say “the computer just needs to do this”. The trick is knowing how to speak to the computer in a way that can make sense to the computer, to you, and to the others who will eventually have to work with your code.

You’re doing the equivalent of a painter saying “I’ve done the hard part of envisioning it in my head! I’m just going to pay some guy on fiver to move the brush for me”


This is difficult to put into words, as it’s also not about memorization of every language specific syntax pattern. But there’s a difference between looking up documentation or at previous code for syntax, and trying to have chatGPT turn your psiedocode notes into working code.

emptiestplace ,

The more you grow in experience the more you’re going to realize that syntax and organization is the majority of programming work.

organization, absolutely - but syntax? c’mon…

Stumblinbear ,
@Stumblinbear@pawb.social avatar

I’m a pretty senior dev and have chat gpt open for quick searches. It’s great for helping me figure out what to Google in the cases where I can’t think of the name of a pattern or type I’m looking for. It also helps quite a bit with learning about obscure functions and keywords in SQL that I can do more research on

Hell, I use Copilot daily. Its auto complete is top-tier

pkill ,

Copilot is good for tedious stuff like writing enums. But otherwise I more often than not need to only accept tne suggested line or particular words, since in multiline snippets it can do stupid things, like exiting outside of main() or skipping error checks.

chicken ,

I’ve been programming for decades, I’m not actually a beginner. A mistake I made early on was thinking that everything I learn will be worth the time to learn it, and will always increase my overall skill level. But (particularly as relates to syntax) it’s not and it doesn’t; something I only use once or rarely, something that isn’t closely connected with the rest of what I often do, I’ll just forget it after a while. I greatly prefer being broadly capable of making things happen to having a finely honed specialization, so I run into that sort of thing a lot, there is an ocean of information out there and many very different things a programmer can be doing.

I think it is an important and valuable lesson to know when to get over yourself and take shortcuts. There are situations where you absolutely should never do that, but they are rare. There are many situations where not taking shortcuts is a huge mistake and will result in piles of abandoned code and not finishing what you set out to do. AI is an incredibly powerful source of shortcuts.

You’re doing the equivalent of a painter saying “I’ve done the hard part of envisioning it in my head! I’m just going to pay some guy on fiver to move the brush for me”

More like you’ve coded the functionality for a webapp, have a visual mockup, and pay some guy on fiver to write the CSS for you, because doing it yourself is an inefficient use of your time and you don’t specialize in CSS.

As for the issue of a new programmer ending up with problems because they rely too much on AI and somehow fail to learn how to model the structure of programs in their head, that’s probably real, but I can’t imagine how that will go because all I had to go on when I was learning was google and IRC and it’s totally different. Hope it works out for them.

eclectic_electron ,

TBF that’s how many master artists worked in the past. The big art producers had one master painter guiding a bunch of apprentices who did the actual legwork.

Rodeo ,

And senior devs guide junior devs in the same way. The point is the masters already did their time in the trenches. That how they became masters.

257m ,

That the exact opposite problem for most people though. Syntax is hard at first because you are unfamiliar and gets more natural to you overtime. Algorithms are easier to think about conceptually as a person with no programming experience as they are not programming specific. If you are an experienced developer struggling over syntax yet breezing through difficult data structure and algorithm problems (Eg. Thinking about the most efficient way to upload constantly updating vertex data to the gpu) you are definitely the anomaly.

sj_zero ,

There's a 5 hour interview with John Carmack on YouTube where he talks about transitioning from really caring deeply about algorithms and the like to deeply caring about how to make a sustainable and maintainable codebase you can have an entire team work on.

Often, a solution that is completely correct if all you're doing is solving that problem is completely incorrect in the greater context of the codebase you're working within, like if you wanted to add a dog to the Mona Lisa, you can't just draw a detailed line art dog or a cartoon dog and expect it to work -- you'd need to find someone who can paint a dog similar to the art style of the piece and properly get it to mesh with the painting.

CoopaLoopa ,

Somehow you hit an unpopular opinion landmine with the greybeard devs.

For the greybeard devs: Try asking ChatGPT to write you some Arduino code to do a specific task. Even if you don’t know how to write code for an Arduino, ChatGPT will get you 95% of the way there with the proper libraries and syntax.

No way in hell I’m digging through forums and code repos for hours to blink an led and send out a notification through a web hook when a sensor gets triggered if AI can do it for me in 30 seconds. AI obviously can’t do everything for you if you’ve never coded anything before, but it can do a damn good job of translating your knowledge of one programming language into every other programming language available.

kogasa ,
@kogasa@programming.dev avatar

It’s great for jumping into something you’re very unfamiliar with. Unfortunately, if you often find yourself very unfamiliar with day to day tasks, you’re probably incompetent. (Or maybe a butterfly who gets paid to learn new things every day.)

ByGourou ,

Getting paid to learn new things everyday at work is a dream, I don’t see the issues

kogasa ,
@kogasa@programming.dev avatar

The issue is it’s a dream.

sj_zero ,

BIIIIG problem: The last 5%.

Did ChatGPT just hallucinate it? Does it exist but it isn't used like ChatGPT says? Does it exist but it doesn't do what ChatGPT thinks it does?

I use ChatGPT sometimes to help out with stuff at home (I've tried it for work stuff but the stuff I work on is niche enough that it purely hallucinates), and I've ended up running in circles for hours because the answer I got ended up in this uncanny valley: Correct enough that it isn't immediately obviously wrong, but incorrect enough that it won't work, it can't work, and you're going to really have to put a lot of work in to figure that out.

blackbirdbiryani ,

I write a lot of bash and I still have to check syntax every day, but the answer to that is not chatGPT but a proper linter like shell check that you can trust because it’s based on a rigid set of rules, not the black box of a LLM.

I can understand the syntax justification for obscure languages that don’t have a well written linter, but if anything that gives me less confidence about CHATGPT because it’s training material for an obscure language is likely smaller.

ByGourou ,

Less checking syntax and more like “what was this function name again ?”
“Which library has that ?”
“Do I need to instance this or is it static ?”
All of theses can be answered by documentation, but who want to read the docs when you can ask chatgpt. (Copilot is better in my experience btw)

pkill ,

you can remain in a mental state of thinking about the actual problem

more like you’ll end up wasting a significant amount of time debugging not only the problem, but also chatGPT, trying to correct the bullshit it spews out, often ignoring parts of your prompt

chicken ,

That hasn’t been my experience. How are you trying to use it?

pkill ,

It might be wrong even if you provide extensive context to make it more accurate in it’s heuristics. And providing extensive context is pretty time consuming at times.

chicken ,

I think it would help me organize my thoughts to write that all out anyway even without a LLM.

pkill ,

I mean it might be good at helping you when you’re stuck, but sometimes it misses simple issues such as typos and for one issue resolved, it might introduce another if you’re not careful.

state_electrician ,

ChatGPT cannot explain, because it doesn’t understand. It will simply string together a likely sequence of characters. I’ve tried to use it multiple times for programming tasks and found each time that it doesn’t save much time, compared to an IDE. ChatGPT regularly makes up methods or entire libraries. I do like it for creating longer texts that I then manually polish, but any LLM is awful for factual information.

chicken ,

ChatGPT regularly makes up methods or entire libraries

I think that when it is doing that, it is normally a sign that what you are asking for does not exist and you are on the wrong track.

ChatGPT cannot explain, because it doesn’t understand

I often get good explanations that seem to reflect understanding, which often would be difficult to look up otherwise. For example when I asked about the code generated, {myVariable} , and how it could be a valid function parameter in javascript, it responded that it is the equivalent of {“myVariable”:myVariable}, and “When using object literal property value shorthand, if you’re setting a property value to a variable of the same name, you can simply use the variable name.”

state_electrician ,

If ChatGPT gives you correct information you’re either lucky or just didn’t realize it was making shit up. That’s a simple fact. LLMs absolutely have their uses, but facts ain’t one of them.

apinanaivot ,

All ChatGPT is doing is guessing the next word.

You are saying that as if it’s a small feat. Accurately guessing the next word requires understanding of what the words and sentences mean in a specific context.

blackbirdbiryani ,

Don’t get me wrong, it’s incredible. But it’s still a variation of the Chinese room experiment, it’s not a real intelligence, but really good at pretending to be one. I might trust it more if there were variants based on strictly controlled datasets.

Fraylor ,

So theoretically could you program an AI using strictly verified programming textbooks/research etc, is it currently possible to make an AI that would do far better at programming? I love the concepts around AI but I know fuckall about ML and the actual intricacies of it. So sorry if it’s a dumb question.

PixelProf ,

Yeah, this is the approach people are trying to take more now, the problem is generally amount of that data needed and verifying it’s high quality in the first place, but these systems are positive feedback loops both in training and in use. If you train on higher quality code, it will write higher quality code, but be less able to handle edge cases or potentially complete code in a salient way that wasn’t at the same quality bar or style as the training code.

On the use side, if you provide higher quality code as input when prompting, it is more likely to predict higher quality code because it’s continuing what was written. Using standard approaches, documenting, just generally following good practice with code before sending it to the LLM will majorly improve results.

Fraylor ,

Interesting, that makes sense. Thank you for such a thoughtful response.

jadero ,

I have read more than is probably healthy about the Chinese room and variants since it was first published. I’ve gone back and forth on several ideas:

  • There is no understanding
  • The person in the room doesn’t understand, but the system does
  • We are all just Chinese rooms without knowing it (where either of the first 2 points might apply)

Since the advent of ChatGPT, or, more properly, my awareness of it, the confusion has only increased. My current thinking, which is by no means robust, is that humans may be little more than “meatGPT” systems. Admittedly, that is probably a cynical reaction to my sense that a lot of people seem to be running on automatic a lot of the time combined with an awareness that nearly everything new is built on top of or a variation on what came before.

I don’t use ChatGPT for anything (yet) for the same reasons I don’t depend too heavily on advice from others:

  • I suspect that most people know a whole lot less than they think they do
  • I very likely know little enough myself
  • I definitely don’t know enough to reliably distinguish between someone truly knowledgeable and a bullshitter.

I’ve not yet seen anything to suggest that ChatGPT is reliably any better than a bullshitter. Which is not nothing, I guess, but is at least a little dangerous.

nogrub ,

what often puts me of that people almost never fakt check me when i tell them something wich also tells me they wouldn’t do the same with chatgpt

worldsayshi , (edited )

The Chinese room thought experiment doesn’t prove anything and probably confuses the discussion more than it clarifies.

In order for the Chinese room to convince an outside observer of knowing Chinese like a person the room as a whole basically needs to be sentient and understand Chinese. The person in the room doesn’t need to understand Chinese. “The room” understands Chinese.

The confounding part is the book, pen and paper. It suggests that the room is “dumb”. But to behave like a person the person-not-knowing-Chinese plus book and paper needs to be able to memorize and reason about very complex concepts. You can do that with pen and paper and not-understanding-Chinese person it just takes an awful amount of time and complex set of continuously changing rules in said book.

Edit: Dall-E made a pretty neat mood illustration

worldsayshi ,

Yup. Accurately guessing the next thought (or action) is all brains need to do so I don’t see what the alleged “magic” is supposed to solve.

Hazzia ,

The best thing that’s come out of this ChatGPT bullshit is making me feel like I’m actually good at my job. To be clear, I’m not - but at the very least I can reverse engineer functional code and logically map out what I think is supposed to be happening. The bare minimum that should be required, and yet here we are, with me being able to lord my wizardry over the ChatGPT peasantry.

ETA: specifically lording myself over people who use ChatGPT to do the whole thing, not people who just use it to cut down on busywork

LemmyIsFantastic ,

It’s okay old man. There is a middle there where folks understand the task but aren’t familiar with the implementation.

RandomVideos , in There once was a programmer

I cant use chatgpt with godot :(

kurwa ,

Why not? I haven’t had the best time with it, but it certainly can write gdscript

RandomVideos ,

Godot 4.0, which was released in 2023, changed a lot of gdscript

Chatgpt only knows gdscript from godot 3.x

Semi-Hemi-Demigod , in There once was a programmer
@Semi-Hemi-Demigod@kbin.social avatar

In days of yore, before Google or even Altavista, you could tell the quality of a team by how many O'Reilly books they had on the shelves.

corsicanguppy ,

I should sell mine. Maybe I’ll keep the crab book and the white book, but the latter’s not even an O’Reilly.

PrettyFlyForAFatGuy , in There once was a programmer

I can code a feature faster than i can debug ChatGPTs attempt. so long as it’s in JS

ChatGPT is better at bash than me though

i_am_hiding ,

The good thing about ChatGPT is that it gives you a starting point for languages you’re not familiar / rusty with.

netwren , in There once was a programmer

ChatGPT is next level Rubber Duck. Tell it to talk to you like Socrates.

szczuroarturo , in There once was a programmer

I find it to be suprisingly usless compared to classic aproach. But in my case it might be beacuse of the language i work with ( abap ).

Skyrmir ,

It’s not the language. ChatGPT is about as useful as a decent code manual. It won’t actually solve any problems for you, but it can show you the general format for doing so.

Pechente ,

And it’s great for boilerplate heavy stuff or writing tests.

EatATaco ,

Yeah I’ve used it for boiler plate stuff for things I’ve not done before, but I always then read about what it did and make sure I understand it and where to look further.

marcos ,

The manual is usually not wrong.

Skyrmir ,

Have you read Microsoft manuals?

marcos ,

Ok, I’ll use the “usually” wildcard to absorb this one.

Odds are that ChatGPT can help you better with C# than the documentation. It’s also easier to navigate because you only need to know the answer before being able to make a good question, while merely knowing the answer and having a search engine won’t help you find the right Microsoft doc.

PixxlMan ,

The docs for C# are stellar imo

marcos ,

You talk about their location?

moonpiedumplings ,

Sometimes whatever you are working with will have outdated or really poor docs, so an advanced internet info aggregator is useful in that sense.

I started learning nix before chatgpt and it was a nightmare. I had to continually ask for help on discord, of all places, for things that should really be in the docs.

Chatgpt makes nix easier, except not really because it’s info is outdated a lot of the time.

phorq , in There once was a programmer

ChatGPT just makes me feel like I’m doing code review for junior developers who don’t understand the task… wait…

Fermiverse , in There once was a programmer

…who wrote code without stack overflow

spudwart ,

…who wrote in-line assembly.

metaStatic ,

6502 or 68000?

Fermiverse ,

I know and wrote for both of them.

Jeez I am old.

wizardbeard ,

I’ve got no issues with people using stackoverflow or chatGPT as a reference. The problem has always been when anyone just skims what they found and just paste it in without understanding it. Without looking at the rest of the comments, further discussion, or looking at any other search results for further insight and context.

I think chatGPT makes this sort of “carelessness” (as opposed to carefulness) even easier to do, as it appears to be responding with an answer to your exact question and not just something the search algorithm thinks is related.

magic_lobster_party , in I am God's greatest programmer

There’s also that long time senior dev who’s overly confident in their abilities and force pushes production breaking code directly to master.

Anticorp ,

Not for long there isn’t.

magic_lobster_party ,

Nah, they’re the one who’s contributing most to the project. Mostly because their code is so garbage no one else can work with it. But that’s not a thing the managers take into account.

jelloeater85 ,
@jelloeater85@lemmy.world avatar

Yeet that shit into main. Who needs unit tests, it works on my computer?

magic_lobster_party ,

If it works in my mind it’s ready for production

jelloeater85 ,
@jelloeater85@lemmy.world avatar

Top kek

wizardbeard ,

YOLOdev is the best way to dev

Strawberry ,

This shit happened the other week for me. Senior dev pushed the shittiest JS code without testing the day of a production install and it caused us to have to roll back the install after it very predictably caused a bunch of crashes for pages on our public site. Worst part is, the entirety of what he wrote could’ve been implemented as a CSS media query

MamboGator , in I am God's greatest programmer
@MamboGator@lemmy.world avatar

The junior doesn’t know that these aren’t unused functions. They’re load bearing functions.

sbv ,

Neither does the senior

Killing_Spark ,

Anymore

ryan , in I am God's greatest programmer

Let him play in the legacy code. You can just hose him off later before letting him back into the office so he doesn't track it everywhere.

ISometimesAdmin ,
@ISometimesAdmin@the.coolest.zone avatar

Unfortunately if you let Junior play in legacy code once, it'll learn some nasty habits and make more of it from scratch, usually when you're trying to sleep.

Hazzia ,

It’s true, spaghettification sauce stains clothes. Best keep Jr out of it entirely.

MagicShel ,

I don’t want that shit all over me though. That’s why I hired junior!

MonkderZweite ,

That’s what the line represents. So they can pull you if you do something nasty.

BaardFigur ,

deleted_by_author

  • Loading...
  • CodeMonkey ,

    If you are creating an alternative implementation and leaving the old one in place, you are not fixing a problem, you are just creating a new one (and a third one because you have duplication of logic).

    Either refactor the old function so that it transparently calls the new logic or delete the old function and replace all the existing usage with usage of the new one. It does not need to happen as a single commit. You can check in the new function, tell everyone to use it, and clean up usage of the old one. If anyone tries to use the old implementation, call them out in a code review.

    If removing or replacing the old implementation is not possible, at least mark it as deprecated so that anyone using it gets a warning.

    BaardFigur , (edited )

    deleted_by_author

  • Loading...
  • magic_lobster_party ,

    I’m sure that ring buffer started out as a “temporary solution”.

    mbp ,
    @mbp@lemmy.sdf.org avatar

    God, I would love that so much

    southsamurai , in I am God's greatest programmer
    @southsamurai@sh.itjust.works avatar

    Why is the junior dev tied to the other one’s penis?

    ButtCheekOnAStick ,

    Because everyone sucks at drawing hands

    morrowind ,
    @morrowind@lemmy.ml avatar

    Bro that’s not where the penis is located on the body

    southsamurai ,
    @southsamurai@sh.itjust.works avatar

    Hey, I don’t body shame

    WhiskyTangoFoxtrot ,
    bappity , in I am God's greatest programmer
    @bappity@lemmy.world avatar

    me when first starting out at a job commenting everything I can
    VS
    me a couple years in completely lost because I never updated the comments and now none of them make any sense whatsoever

    xmunk ,

    Commenting well is a highly advanced skill. I generally prefer no comments on code since it’s less likely to confuse people and I’ll merrily purge auto-doc comments and anything like

    // getId() returns an id

    That comment has negative value.

    kubica ,
    @kubica@kbin.social avatar

    I can't help it, I always get the mental image of hands clapping sarcastically when I see something like that.

    bear ,

    I write a lot of fairly simple scripts in Bash and PowerShell that should be easily understood by anybody else with moderate experience in the language, but I leave a lot of obvious comments because my coworkers don’t write any code and are extremely skittish about my automations. I add them basically to quell their fears.

    odium ,

    Why are coworkers who don’t write any code in the codebase?

    bear , (edited )

    These are scripts that manage stuff on a few hundred user endpoints and a few servers. They were doing basically everything manually until I got here, and the only way I could get them on board with my slow introduction of automation is to let them see it. I have to ensure things don’t get too long, complex, or hard to explain, or they start getting nervous.

    magic_lobster_party ,

    Comments should only be used to describe stuff that’s otherwise difficult to convey with code.

    dukk ,

    Yeah. Most of the time I use comments in my algorithms, as they often use some weird optimized black magic which are difficult to understand without comments.

    DoomBot5 ,

    Like don’t set this value to the obvious default. Bad stuff happens

    xmunk ,

    The best explanation I’ve ever heard is:

    Comments should state the ‘Why’ never the ‘What’.

    hikaru755 ,

    There are some cases though where the code is just complicated for reasons outside of your control, in which case “what” comments are good - but they should never be taken at face value, but only used as a first step in understanding the code. There’s a significant risk of the code not actually doing what the comment says.

    platypode ,
    @platypode@sh.itjust.works avatar

    In my experience refactoring lots and lots of crappy code left by devs long gone, a dev who can write useful comments is by and large a dev who can write code clean and simple enough not to need them. If the code doesn’t have informative names and clear separation of concern, chances are a comment won’t help because the dev didn’t really know what they did that worked in the first place.

    MagicShel ,

    Generally, yes. However I have been known to document exactly why I’m doing something incredibly stupid - because it’s required but a stupid third party library which, despite being awful, is still better than implementing it myself as a refactor.

    bappity ,
    @bappity@lemmy.world avatar

    a dev who can write useful comments is by and large a dev who can write code clean and simple enough not to need them.

    my boss is great in this regard and also always has to keep reminding us to write unit tests 😅

    MajorHavoc ,

    I’ll point to the sign again:

    Points to sign

    “Comments shouldn’t say ‘what’ the code does, they should say ‘why’ it does it the way it does.”

    oce ,
    @oce@jlai.lu avatar

    I’d rather teach people to comment well through my reviews. Much easier to understand two lines of well written function description in English than 20 lines of code.

    Landless2029 ,

    Yeah well now we have git copilot where your comments include AI suggestions.

    Now I have TONS more comments

    pennomi , in I am God's greatest programmer

    The leash is good unit testing.

    gjoel ,

    Oh, he’ll just change the unit test if it fails.

    Killing_Spark ,

    Unit tests are there to get an @ignore annotation!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines