Posts Tagged: coding

Die QUIETLY!

Here is a piece of JavaScript code taken from a public commercial website. I have redacted some of the code to protect the guilty, but the rest is verbatim in all its glory. See if you can spot the error. Continue reading “Die QUIETLY!” →

WordPress vs. mod_security

WordPress blog posts with certain words in them can sometimes be blocked or fail mysteriously. Sometimes the offending word is silently removed from the post; other times the post fails with an HTTP error. Here’s a description of one possible cause, together with a useful workaround in case this problem happens to you. The problem could actually affect any blog platform or pretty much any other web application, not just WordPress. Continue reading “WordPress vs. mod_security” →

Don’t tolerate compiler warnings

All code must compile without warnings. All warnings must be fixed before checking code in to a version control system. This applies not only to compiled languages: for example, validation of HTML or CSS code should also be warning-free for the same reasons given here. Continue reading “Don’t tolerate compiler warnings” →

Data access layer should be separate

In a multi-layered architecture, the data access layer should hide database foibles. For example, Oracle stores empty strings as null – this should be hidden in the data access layer by specifying function return values appropriately. For example, ensure that the layer never returns a null string: null strings returned from the database should be converted to empty strings. Continue reading “Data access layer should be separate” →