An exception to avoid copy and paste code?
- by Jian Lin
There are many files in our project that would call a Facebook api. And the call is complicated, spanning usually 8 lines or more, just for the argument values.
In this case, we can make it into a function, and place that function in a common_library.php, but doing so would just change the name of the function call from the Facebook API function to our name, and we still need to repeat the 8 lines of arguments. Each time, the call is very similar, but with slight variations to the argument values.
In that case, would copy and paste be needed no matter what we do?