DevOps seems to be sweeping through IT departments these years and for most developers it seems to be sen as a way of getting those pesky gatekeepers from Operations away and ship code whenever any developers feels like it.
The problem is however, that in the eagerness to be a modern DevOps operation, the focus is often solely on the benefits of faster releases (on the short term) the “DevOps” provide over “Dev to Ops”, and many developers do seem to forget the virtues Operations (should) bring to the party.
Remember the good old days, when IT got a new server. It was a special event - and naturally the naming game. Finding that special name for the server, which neatly fitted into the naming scheme adopted (be it Indian cities, Nordic mythology or cartoon characters).
This ought to be then, but the ceremony still happens regularly in many IT departments, where servers are treated with the same affection as with pets - and with all the bad side effects it may bring along.
As a developer it seems, you always seem to strive towards producing ever more complicated code. Utilizing new frameworks, adopting an ever evolving “convention before configuration”, pushing object-oriented programming - maybe Domain Driven Development - are practices introduced, refined and explored in the quest to prove yourself as a steadily better developer with rising skills.
Yet to what point?
While the intricate complications may impress fellow developers, doing so often digs a hole which may be pretty hard to get out of.
PHP like many other programming languages has facilities to handle exceptions. Using them is pretty easy, but sometimes lazy programmers seems to misuse them to suppress error messages. A try/catch in PHP is usually constructed something like this:
try { // Something can go (horribly) wrong... } catch { } The lazy programmer may leave the catch empty, but frankly you should never do it. When you’re doing something - try’ing - it’s for a reason, and if it fails, someone quite possible need to know - the end user, a log file for the sysadm or someone else.
In PHP when you have a string and want to find out if it contains another string, there are a few ways to do it. You can use regular expressions, use the strstr functions and a few other methods. The easiest way though is probably by using strpos, which returns the number of the character containing the first occurrence of the thing you’re looking for - and false if the string isn’t found.