I am not stupid.
I just have to keep telling myself that.
Programming, as life, has its ups and downs. Today was most certainly filled with more downs than ups. I am used to programs I write breaking for no reason, even though they were working fine yesterday. I am used to neverending swarms of bugs. I am used to poring over a problem for a straight hour only to realize I just spelled something wrong. But I can generally take all this in stride because at least I never question my own competence. Well, today–or more accurately, tonight, that confidence I usually take for granted has been slipping from me.
We are building Acropolis on CakePHP, as I have probably mentioned. Now, although I have been using PHP for almost two years now, Cake is quite a bit different. And it is even more different from PHP4, which is what I have mostly used, than PHP5, which I have only recently begun to tinker with. The difference is between procedural verses object oriented programming (remember Alan Kay from my previous post) and perhaps one day I’ll feel like trying to explain the differences between the two approaches, but for now, take my word for it: the differences are huge.
Well, so I stayed a bit later at work today to try and hammer out one of the issues Travis was having trouble with. Namely, we want to be able to list a table of information–say, products. We want to be able to click on a product and get a dialog box, or “light box,” with fields for the product we want to edit. We then want to be able to save the form, and then instantly update the information in the row we just updated, without the page ever reloading.
I know how to do this, alright? I just haven’t done it in CakePHP before and I don’t want to just plow through it. I want to work carefully within the beautiful structure Cake provides. I don’t want to do it the way I have done before, which is to write out the table, and then when the update is made, execute a tiny script via AJAX that outputs the HTML for that row, and then do a replace. Because the fact that the code for the row’s rendering would then be in two places, rather than one, just means more to keep up with and more hassle when I want to make changes. And its just not elegant.
Well, I went to the #cakePHP chatroom for help, and I knew this was a big mistake. Because as far as I can tell, there is a minimum level of competence you are required to have unless you expect to be ridiculed. Of course I knew this, but I thought I was competent enough to ask a question like this. But, I was wrong. I am not sure if anyone ever really understood my question, since the only real answer I got was “Javascript.” I was also told quite a lot of other things I already knew, and then your usual RTFM. Well, ok. I guess the truth is that I should have gone to the manual first, but I still don’t understand why the atmosphere in those chatrooms tends to be so hostile. We are all at different places, alright? And I still have to recall that one of the friendliest responses I ever got in the #jquery IRC channel, which I used to frequent on a daily basis, was on my first day using the library and the assistance was offered by none other than John Resig himself (the guy who invented JQuery.) So I think that just goes to show you that a sign of greatness is not giving in to the urge to make others feel smaller.
I made some progress on this task, but I’m still pretty stumped right now and I know I’m just not in the right frame of mind just now. Give me first thing in the morning and a cup of coffee and I’ll probably have it all worked out in less than half an hour.
Gone to get a beer…
Recently

Leave a Reply