Tuesday, 22 January 2013

Top 10 Drupal fail moments

Developers are human. That's not too easy to prove, better you trust me on that for now. And as a consequence they fail sometimes. I fail many times. Which I like actually. Not that I learn from my failures but it makes my day interesting. This time I decided to collect my top 10 Drupal fail moments :) Enjoy.

10 - Mr Typo

It's so common and still happens so often. Typo in a code is not too much of a problem in a static type language. Not the case with PHP and JavaScript, though. Especially when using magic methods or God forbid strings for vars / functions / classes. And it's mostly your most annoying colleague who can spot the typo.

9 - Browser cache, the overly attached girlfriend

There are times when the browser seems to be more clingy about the resources. You refresh the page hundred times and refactor the JavaScript two times when you realize it's you don't get the new version. And then you revert all changes and start all over again.

8 - Hiding sneaky Rules actions

It happened to be not long ago that we had to fix a mysterious bug by adding a targeted Rules action. As it used to be we all forgot about it. Weeks later we wondered how the heck we couldn't change some properties on entities. It took a while we find the hidden rule. Bastard.

7 - XDebug the process guard

You know the moment when you're having problems, pulling hair in a bug hunt - and suddenly PHP stops working. You eagerly hit the refresh button and check the same page in several browsers - no answer. You shift-tab to terminal and begging to drush to do something. No answer. Feeling betrayed. Of course you go back to the IDE hacking your code upside down - when a sudden moment you spot the debugger turned on waiting on a breakpoint. Well done, mate.

6 - APC the time capsule

One of my favorite fail. You just spot a small problem on a page, which of course was an obvious mistake se you get your editor and fix the problem. Did you fix? Nah, it's stil there. All right, it must be a variable, or a return value, let's double fix it. (Btw, have you ever double fix anything?) Still no. You start panicking, doing all random changes. Nothing. You get mad, echoing all the swearing words - expecting the compiler to work on them since it would be so funny. But no. Then after the first headbang you start suspecting the opcode cache. Indeed, apc.stat was turned off in php.ini, so none of your new code was compiled.

5 - Apache's mysterious ways

One of a kind :) I'm not a server expert. But when it's about Apache you don't think it can be too hard to mess up. So you hit the first tutorial page about virtual hosts and make yourself a nice environment. So did I. It works 95% of the time. But the other 5% it mixes up the hosts. No idea why. I was working on services, or just checking simple resources - got very surprising responses. Then after some time I tried to check a full page and got a different site. Brilliant. Time to learn Apache.

4 - Form and the black hole

That's my latest fail, a really good one. I was testing an entity field. Some roles had the access, some other did't. So I quickly added field permission settings and did a test. Privileged user could add a value, but saving the same form with a restricted user (no field) deleted the value. That wasn't cool. I tried many workaround with and without field permissions - same behavior. And then it hit why. My test method was 2 open browser with the 2 separate users logged in - where I was hitting submit buttons like a proper kid. I just forget that the restricted user always loaded the form without the value (before the test) - so it saved it empty of course - thanks to Drupal's advanced form mechanism. Lesson learned.

3 - Wrong site

Simple but evil. Like with the APC incident you try everything to solve the problem but see nothing new on the site - but this time you realize you was on the wrong site the whole time. The only drawback is that on the way to realize you're using a bad URL you already committed the code and reconfigured PHP and Apache and probably called your client that their server is an old ... yes. I mean what else is the meaning of life than shouting out our silliness?

2 - Skype you...

Nowadays working remotely and cooperating with other teams it's just inevitable to copy and paste code to Skype. I still see devs doing it (evil laugh). Using that code is super easy, however breaks the whole site. You can check the code hundreds of times, adjust it, fix it, change it. Nothing will work. The beauty is that you start doubting your dev skills, and your life. You start praying to God. And the funny thing you get so mad that you rewrite the whole code from scratch. And it's working. You got even more mad and write the same code your buddy sent you. Working. And then a little angel spells to your ear: UTF8 hidden characters. Thank you, Skype.

1 - Upside down images

It was a nice moment in my career. I was working on a huge site. I mean millions pare page views per day. Once I've seen on my local an image upside down. Oh well, silly CDN. Then again. Then I've seen the brand logo upside down. I was anxious. Wanted to call the server admins. When my buddy started laughing. That bastard (lovely human being) CSS3 transformed the images when I was away regularly.


That's why I love being a developer. Puzzles and problems and solutions make me happy. There is something I can solve each day. What's your favorite failure?


No comments:

Post a Comment