Why Is It A Bad Idea To Override Native Methods?
Solution 1:
One problem that I can think of is that now you have a push method that is very specific to your problem, and what if you later need the normal push method. You don't really know if this will be the case or not, but it might cause you to have to refactor your code later, to allow for both the "normal push" and the "altered push".
Another problem that I can think of, is that if you do something like this and you are not the only one working on the code, someone else might not know that push is overridden and does not follow the standard behaviour anymore.
This could cause potential issues. You might not have changed it a lot, but in case the changes you made cause an error, you might leave someone else scratching his head wondering why a (in his opinion normal) push is causing odd behaviour.
Post a Comment for "Why Is It A Bad Idea To Override Native Methods?"