When you start a new project, think big!

Posted on Tue 03 April 2012 in programming

As you may know, I am the happy developer of a Wordpress plugin called Post Pay Counter. I dare say that that has been my first serious coding project, well thought and well written. It taught me a lot, above all the concept that when you start a new project, you should think as if it was going to become a huge one. This is what I'd like to share with you today.

When I started developing the Post Pay Counter project it was two years ago. I took it up because a friend of mine needed it, and asked me if I could set up a plugin that could simplify writers payments. That was how the project started. Looking back at that time, I can clearly identify an error that came along with me and, partly, is still with me today: the idea that was not going to be an important plugin, that I would not have edited it much after, that I would not have added almost anything... that so it was, so it would have remained. What did this practically mean?

Well, first, it meant that I had chosen a way to save options that was not convenient at all. I had very few settings to store and I went for an option in the database, using two different separators to distinguish them. It was quite resource-cheap, but when it came to coding, it was a mess. My files were filled up with nested explode() functions and I was driven mad to remember which array I should use and which index.

Second, as a result, my whole code (although it was only half a thousand lines long overall) was just like a puzzle. Few functions, badly organized and slowly working. I was scared that the puzzle could break for every more piece I added. The problem was that when I designed it, I did not thought of adding stuff later, I just regarded it as done at the first release. So, basically, when I wanted to implement a new feature, I did not know how and where to put it simply because I was not supposed to do it!

Third, I was so eager to finish it, that I did not even stop to think about the name. The very first release of the plugin, in fact, held a different name than the current one: Monthly Post Counter. I am sure I made other mistakes more, but I think these were the major ones.

The consequence of this all, is that after a year, when I had a whole summer in front of me, I decided that, if I were to keep updating the plugin and keep adding new features, I had to rewrite it from scratch. And so I did. But this time with a brand new idea in my head: this is going to become something big, I cannot predict what I am going to do with it nor whether I will keep adding stuff in a year or two, so let's do things well since the beginning.

And so I started, again. I did not touch the computer in the first place, instead I reached for some paper. It was a week of thought and notes, no coding. And then there was the real, concrete start: there were classes, and methods, and performance, and speed, and graphics. I got rid of that horrible wp_option value and built a new independent table to store my data.

I committed just one more mistake: the names I chose for my MySQL fields were stupid and my whole table was not thought to welcome almost sixty fields, as they are in the current release indeed. But I did not need to work too much to make that work as I wanted, since everything else was working fine...

I acknowledge what I have written is more like the diary of a plugin developer, but the message is "this what happens when you do not think big, so do think big since the beginning!".