While programming i am always afraid that what i do, even if it works, is unsafe/deprecated (stuff like using the mysql API in php instead of mysqli or PDO).

I was asking myself how does someone keep up with the best practices for a certain field/programming language?

thanks

EDIT: Thanks to everyone that was exaustive

  • Ephera
    link
    43 years ago

    Yep, best practices imply that there’s worse practices, and that it’s common to choose wrongly.
    Your programming language and tooling should make worse practices harder to choose, or clearly notify you that there’s a better way.

    Knowing these best practices yourself is dead weight and you should ideally choose a language which doesn’t require extensive best practices, and/or try to upgrade the tooling that you’re using.

    • Ephera
      link
      43 years ago

      Or to give maybe a more direct example: My company paid for a security training which is available for different programming languages.
      I chose Scala, because that’s what I mostly code in, and because of that, all the code examples are just the goofiest thing.

      “Here’s a really dangerous security vulnerability and you need to write extra code to prevent this. Well, in Scala, this isn’t the case, the default is actually correct, but let’s just assume a previous programmer explicitly wrote out two lines of code to allow the security vulnerability for no reason at all. Now, how do we fix this? Oh yeah, we just delete those two lines.”