You all know that lately i’ve been up to coding a few plugins and sharpening my WordPress coding skills. Besides mine, on the WordPress plugin directory you can find hundreds and hundreds of plugins doing just about anything. It’s actually thousands of hard worked coding lines by authors that, one time or another, needed something more out of their WordPress installation (i am not saying blog since WordPress is used for just about anything nowadays). So, they coded it for themselves and were kind enough to share it with the world for the ease of other people too. Others, me included, code for fun and just because every now and then, when i am reading blogs, i’d like to bump into something done by my plugin. You can’t imagine the overwhelming feeling that gets over me when i see that someone is actually using my code…

But, there is one thing i’d like to bring to your attention guys. There is a very thin line between using a plugin that actually makes your life easier and using one just because you might need it a couple of times. What is very “dangerous” with plugins is that they can be resource hungry. Here is a simple example. A socialize plugin, the one that adds digg, stumbleuppon etc on the bottom of each one of your posts, actually is a php function that gets the whole text of the post as a parameter just to add on the bottom a few lines of simple and plain HTML. And how is that resource hungry? Well, on your frontpage there can be five to ten posts so imagine it running ten times (60 kilobytes of text, or even more, going back and fourth). Now that is not that tragic since it’s just adding text. But, imagine a plugin that makes a query on the database. Imagine that running ten times on your frontpage. Each time it renders, ten queries are done just like that. That might be a tradeoff that you are willing to make if the plugin is absolutely nessesary but what if you just use it rarely or, even worse, once?

Ok, criticizing is fun but what about solutions? Well, for those socialize plugins, and a few more tricks, i’d like to bring this post to your attention. Edit your single.php or index.php file and add plain HTML. Go on, don’t be afraid, edit a few lines of code and you will be rewarded! But what about things that can’t be done simply and need a plugin. There, “a man’s gotta do what a man’s gotta do”. Still though, consider every aspect before installing one. Now, before going on open your administration and take another look at your plugins list. Do you really need them all?

One more thing i’d like to add. If you know your way around code then why not take a look at a plugin’s code before installing. It might give you a good idea of the coding technique. One of your main concerns must be code efficiency. When i try to do something and need a plugin i usualy take a glimpse at the code. Sometimes the simplest things can give you a good idea on the code’s efficiency. For instance, on a simple echo using double quotes is not such a good idea. This is because, for php, there is a major difference between ‘ (single quote) and ” (double quote). That is, any string within a single quote is echoed as is whereis a string within a double quote is parsed for special characters, php variables etc. I know, this is silly since it might slow down the execution by a fraction of a second, or even less for that matter, but it’s a good indication on wether the coder had efficiency on his mind when coding or not. Another thing you should be very carefull of is SQL queries. I have seen some very bad practices on my days (and i assure you they are very few). For instance, producing a result with a nested query is not as good. There must be a way around. Imagine that really bad and time consuming query running two or three times per render. That could be a killer or performance.

I know i sound pretty vague but finding out if you trully need a plugin and, uppon discovering one, if it is suitable and the best solution, is not such an easy job. It all comes around with experience and constant testing. My main advice here is make sure you need a plugin to do some kind of job, and if you do need, make sure you test them all and see which one is the best for you.

Finally, i’d like to tell you why i made this post. It’s actually for two main reasons. For one, i see so many plugins that actually do something that can be staticaly done through a template, therefore adding an unessesary burdain on your code. Secondly, talking with friends and reading reviews, i see that there is constant argument that WordPress is a pretty heavy platform. That is pretty much wrong. A simple and virgin installation of the platform, provides minimal things but it is pretty light too. When you start bloating it up with unessesary plugins and badly written code then, it’s only natural, that it will get heavy. So, each time you start nagging about the loading times of your blog, think about this: “It’s the man my friend, not the machine!”

All in all, i just felt like writing this post just to tell you, please consider all this processing power that goes to waste when using something you don’t need. Not only it’s a pitty but it makes your blog load badly. Any thoughts, comments, corrections as always are welcome!