Events, events and more events!

After thinking, thinking, thinking and thinking. I just had to admit, it’s hard to make your web application to support (plug-ins/add-ons/modules/extensions) whatever you prefer to call it, for me they are extensions. So I had to go over and see some patterns and finally I came with a few ideas. It included a registry (protected one of course), and events(name) and listeners(extensions) and a handler to manage the injections.

I’m aware I left templates “manipulation” out, and I still won’t care for it yet. It is not the time to bother with such fancy features if I don’t have a solid extension base to work with. I’m seriously hoping to pull this one off. I want to get STARTED to code more, but I can’t code blindfolded with just ideas on mine and no blueprint to guide me, which is why I analyze, design, implement, test (you should know what I’m talking about :) ).

Extensions in a bulletin board is hard to see, I mean, there is so MUCH data to process. So many “events” to place, like on the one I placed “prePostLoop” which if injected, instead of calling my default model, all the raw data will be gone to your extension for you to process. Of course, you don’t have choose “prePostLoop” to just change ONE thing, there will be of course, other events to be placed.

Yet, a bigger problem to overcome is making the extension database layer and choosing the right database user, and also determining the extension’s “templatebits”, “routes”. It all requires a lot of “injections” to routes, doctrine (yes, I chose Doctrine ORM), views. One thing for sure is that, in the end you will have to place your function in the template. That’s a no brainer for many people, but I’m attempting to do something else.

To be honest, while it looks overwhelming for me. I still know I can do it if I keep my mind cool. I mean, it’s not HARD, like it was for me that I had to take a few days off after I designed how ACL (Access lists), ACL_Roles, ACL_Roles_Whitelist, ACL_Items. All I know is that the initialization of the board is going to be quite heavy.

To end this post, talking about events made me think of “Sections” as in “Link sections”. Where everyone want to keep it nice and neat. The problem with link sections is that I have to take care of administration pages and other things. It means, many and “Iterate” object comes to mind, such an eventful semester, I’m hoping it gives good results :)

Posted in Projects | Tagged , , | Leave a comment

Designing your database, sometimes its more than just a storage

Sadly, I’m catching a cold. I seriously hate being sick, all my motivation goes to nada. Yet I wanted to post on this subject, while I’m not going to get all specific and detailed about it. I will mention basic factors of designing your database. I have this book I bought on the many programming books I have, it was requested by my professor to use it in our database design class but we actually never got to use it.

Now it bothered me, I don’t like buying things without a purpose so I opened it to apply things I learnt in my project. I did learn a few things about database designers, they are divided in two tasks, one is to design the database and the other is to check engines and worry about all physical files and how they are going to be managed. And so on, since it had this overwhelming history of flat files. And it got me to thinking of PHP and some developers.

While I love so much PHP, it’s disheartening to see many people just to rush over the project start assigning all kind of unneeded data types. Let’s be realistic, many people use Int over Medium Int because they “foresee their application passing over a range of 9 millions”, to actually reach that amount it will take years unless you spend an insane amount of money in promotions to get all kind of traffic. You can’t be a microsoft or a google in a year.

It also makes me glad in a way, this mistakes generate jobs, didn’t  you know? Because the buyers who hired those kind of people and made the database design shaky, don’t know why their page is slow or why their query is so slow. By putting a higher range, it means more work for the database engine.

Don’t go adding all type of indexes, just the ones your APPLICATION use most of the type. Like for example we got our auto-incrementer primary key (id), it is UNIQUE so MySQL will check UNIQUE ones first than non-unique ones. Or if we got lets say (categoryID, attachmentID) we got non-unique IDs, but they are mostly searched in a query statement.

Secondly, while I won’t probably real-world examples. A bad design can lead the web application to become a nightmare to maintain or add new features because you will end up refactoring or worst, re-designing your database.

Read this page, it’s from MySQL‘s documentation. It’ll be a guide to you if you are designing the database using that database system.

I was thinking, after I release OpenType Threads, oh boy I should be prepared to receive a rain of complains. And shield myself from patterns fanboys. Oh, and I started to like Ruby and Javascript syntax, it’s quite… fun. And now, making extra code to support other browsers is NOT fun.

Posted in PHP, Programming | Leave a comment