An exception to avoid copy and paste code?
Posted
by Jian Lin
on Stack Overflow
See other posts from Stack Overflow
or by Jian Lin
Published on 2010-04-25T16:18:15Z
Indexed on
2010/04/25
16:23 UTC
Read the original article
Hit count: 274
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?
© Stack Overflow or respective owner