Don't lie
TLDR: Lying in software writing is worse because I can see the lie and all I have to do is 'look'.
Few things are more humbling than spending an hour debugging unexpected behaviour in a routine, only to realize you were deceived by a function name. Half the time someone else wrote it; the other half, it was Past Me setting a trap for Future Me.
The usual approach for me here is to start reading the documentation, if there is any, followed by me double-checking parameters to make sure I'm using it right.
The next usual step is to get the most basic example working to confirm I'm not going crazy.
Eventually, I'd give up and actually have a look at what's going on behind the curtain.
It's not often that I find the parameters/methods/objects were simply lying. Lying about their intent, usage, and behaviour.
The last example I have of this was an untyped method in a service similar to the below sample:
public function getFile($foo, $bar,$baz)
{
// ...do stuff
// ...sometimes it created a file on a different filesystem that had nothing to do with the parameters
// ...create an entry in the database using one of the parameters as potential identifiers
// ...never return anything
}
Have a thought or counterpoint on this?
Reply via email