Follow

Developer Pro Tip:

When you copy code from stackoverflow, make sure it's from the answer, not the question.

@fribbledom Also make sure it's from the most up-to-date answer, not the most accepted answer.

-stares at half-decade-old bash scripting questions whose top answers don't work anymore-

@fribbledom sometimes it works or it gives you hint to reproduce the question

Even more when doing with a badly documented thing

@fribbledom what's the license for stack overflow code these days? It was CC-BY-SA 3.0, then 4.0 - I think they wanted to change to MIT, but I'm not sure it happened. Also it's not retroactive, I suppose so old solutions are not really usable seeing CC licensing compatibility

@fribbledom afaict, the mit Switch is stalled, hence all code is CC-BY-SA, which in practice means you won't be able to paste it into your project (unless your license allows combining with that).

@juliank @fribbledom it's still CC-BY- SA 4.0 (at least for new content)

@fribbledom and be aware that they are theoratically licensed under CC BY-SA

@fribbledom And make sure to take into account the variable names.

If someone sees the code and, for instance, finds a class called "PandaKamasutra," they might get curious and google such a name.

@fribbledom and when you do, make sure you understand what it is doing, so you can spot bugs such as this one that instead of getting the app's GUID to prevent multiple instance from running, got the GUID of a .NET library, which meant that all apps that copied the same code (such as for Windows, and the Synapse driver apparently), could not be run simultaneously:
old.reddit.com/r/ProgrammerHum

@fribbledom and never from the accepted answer because it's always wrong

@fribbledom

A developer veteran tip:

The approved answer is not always the best one. Infact sometimes it's trash. Look through the top answers and find the best one by checking the comments, actual answer, and the points.

Many times I've saved a ton of headache and time by skipping the approved answer.

@fribbledom Except when it's a question that's using the solution to your problem as example for "I know this, but that's different from what I'm asking."

@fribbledom Developer Pro Tip:

When yoi copy and paste code from StackOverflow make sure it's code, not regular text.

@fribbledom i put the answer url in a comment above, if the code is in any way magical, not easily understood, or hacky.

Sign in to participate in the conversation
Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!