The Daily WTF
Follow
CodeSOD: An Echo In Here in here
The text critiques a piece of code written by "Tobbi" that combines JavaScript and PHP in a poor manner. The code uses PHP to generate JavaScript strings, a practice considered an anti-pattern. This specific code snippet makes AJAX calls, with PHP echoing JavaScript code that defines the AJAX requests. The author points out that the echoed JavaScript could have been written directly, avoiding the need for PHP. Tobbi's likely lack of foresight in writing this code is mocked by the author. The code, though harmless, is described as a "brain-fart" indicative of poor coding practices. The author suggests the mistake happened due to the absence of code reviews or weak execution. The author concludes that organizational failures allow such flawed code to be integrated. The text ends with an advertisement for a product related to software development.