• 0 Posts
  • 16 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle

  • Writing good comments is an art form, and beginner programmers often struggle with it. They know comments mostly from their text books, where the comments explain what is happening to someone who doesn’t yet know programming, and nobody has told them yet that that is not at all a useful commenting style outside of education. So that’s how they use them. It usually ends up making the code harder to read, not easier.

    Later on, programmers will need to learn a few rules about comments, like:

    • Assume that whoever reads your code knows the programming language, the platform and the problem domain at least in general terms. You are not writing a teaching aid, you are writing presumably useful software.
    • Don’t comment the obvious. (Aside from documentation comments for function/method/class signatures)
    • Don’t comment what a line is doing. Instead, write your code, especially names for variables, constants, classes, functions, methods and so on, so that they produce talking code that needs no comments. Reserve the “what” style comments for where that just isn’t possible.
    • Do comment the why. Tell the reader about your intentions and about big-picture issues. If an if-statement is hard to parse, write a corresponding if clause in plain English on top of it.
    • In some cases, comment the “why not”, to keep maintenance programmers from falling in the same trap you already found.











  • That ‘amp;’ does not belong in there, it’s probably either a copy-paste error or a Lemmy-error.

    What this does (or would do it it were done correctly) is define a function called “:” (the colon symbol) which recursively calls itself twice, piping the output of one instance to the input of the other, then forks the resulting mess to the background. After defining that fork bomb of a function, it is immediately called once.

    It’s a very old trick that existed even on some of the ancient Unix systems that predated Linux. I think there’s some way of defending against using cgroups, but I don’t know how from the top of my head.


  • Using “they” when you haven’t yet established the group you are referring to in context feels weird and kinda wrong, especially if it’s about a group of inanimate objects. It really looks like the word should have been “there”, but they just mistyped and then didn’t catch the error in the editing process or didn’t bother to correct it.

    That’s what I think is wrong here. I’m not 100% sure that this grammatically wrong, but it sure feels like it. Might depend on what the page before this one said.


  • waigl@lemmy.worldtoAsklemmy@lemmy.mlWhat's a good alternative to Gmail?
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    11 months ago

    Honestly, that was a bit of a wise crack. What I am doing with those two things (plus a number of other that are required these days, notably for DKIM) is running my own mail server.

    Fair warning: Doing that costs money, time and effort, and messing it up can lead to… interesting results. (You usually don’t want “interesting” for something as fundamental as your email.)

    If you are still interested, join us in selfhosted@lemmy.world. (Still figuring out how to properly link to a community on lemmy. In the meantime, look for it under “Communitys”.)

    The postfix mail server can be found here: https://www.postfix.org/
    The Cyrus IMAP server can be found here: https://www.cyrusimap.org/

    Additionally, I also use roundcube so I can have a web interface for email.