Wednesday, February 28, 2007

OOP and Me - The $Real->Deal()

So my spat with a purely OOP site design is coming along quite nicely. I've been trying to break out some research on design patterns, but still have yet to truly understand what the hell they're trying to do, other than make it easier for developers later on. I don't think I need this for my site (it'll be just me developing, but if it does take off and I need developers, I'd like to have a pattern in place already). I like the factory idea, and it makes sense. The one I'm interested in, however, is the Registry. I sort of understand it, but I'm not exactly sure the true purpose and how to really implement it for it to make sense to me. I haven't implemented either of these into my design so far, but one day I will. For now, though, I'm sticking to my guns and going with what I know, which is just normal tight coupling (I know, bad bad bad!), but it works for me currently. I wish I could use PHP5, but my host has only 4.3, so I'm limited to a lot of old-world OOP. I had a few interfaces created, only to realize that they didn't work, and I didn't like the idea of using class extenders because I wanted to have the abstract parent to define the functions, not actually implement them.

Back onto my original thought process, I have implemented what I consider to be at least a partial "front controller". The class itself is called Page, and just handles the creation of the page, including the template (the templating itself is handled by a template class, soon to be abstracted by an interface [hopefully], including parsing through it), adding controls (dynamic stuff that the template won't be aware of, thus lightening the load somewhat of the template engine), dynamically loading necessary classes, and other maybe like 2 other things. I've got a few design questions that I've got to look into, including the page configuration being dynamic (not sure if I want to have a single sessioned config and be able to change it when I need to, or if I should load the config on each page to allow for different tasks to use different configs).

What it looks like so far, however is: (not all the code, only config portion)


function LoadConfig($config_file)
{
$this->my_config = $config_file;
$contents = file_get_contents($config_file);
preg_match_all("/config\['([a-zA-Z_]*?)'\]\['([a-zA-Z_]*?)'\] = \"(.*?)\";/", $contents, $cfg_values);
for($i=0; $i $this->my_config_values[$cfg_values[1][$i]][$cfg_values[2][$i]] = $cfg_values[3][$i];
}

As you can see my dilemma, is I'm not sure if I want to pass it the config file itself, or just pass it a sessioned config (Singleton!! I understand that much at least). The way it is now has a heavier overhead because of the processing time of loading the config on every single page, but has a more modularized feel that each page in itself can be encapsulated alone.

Once I get some time to work on this from home, I'll be doing some testing of execution times to see if there's a substantial load time optimization that I'll be in for, or if I can let this one slip by as a "necessary evil", so to speak.

Until next time, $this->post->end();

Friday, February 16, 2007

President's Weekend

Hopefully this weekend will be fun. Monday is a holiday, so thank jebus for that. I don't have my psychology class either, so it's even better. Planning on trying to see Ghost Rider (yes I know, hokey movie, but I still want to see it) either today or tomorrow, depending on what the girl wants (and prefers). Having some friends over Sunday just because, cook out a few hotdogs, a few burgers, and just sit back and have a good time.

Still have a lot of work on my website idea, a lot of design details I need to work out. One of these days I'll get around to finding a graphic designer to do all that craziness for me, since I'm pretty bad at designing things and using Photoshop. I still want to get a prototype made and show it to a few people in the right places to see what kind of potential audience I need to be focusing my attention towards. I've got a few domains registered, though I'm still debating the actual name of the site. I've been brainstorming, and having a few close friends brainstorm some other possibilities on what to call it.

I will hopefully have that prototype done by the end of the month. It's going to be ugly, but at least I can have an actual version of what I envision will be an amazing site. It won't have any good framework behind it, but that's something I'll save and fix on the real release version.

Friday, February 9, 2007

The Beginning

I'm not exactly the most widely available person, nor do I have much leftover time to sit down and really write out blog posts, but I figure that this will give me something to vent my frustrations and excitements to, without having to worry about dealing with a live person!

My social life right now is getting better, I'm slowly getting to where I would envision it being. I've got a great girlfriend who understands my passion for everything computers (not necessarily understands, but accepts), and who shares in my sentiment of just sometimes needing alone time, or time with other people.

Work has been slowly dwindling, it seems. I've been finishing up a lot of my projects, so I'm slowly getting bored of not having 5 things I can potentially be working on at once. I do have a personal project of mine that I need to really get a jump on, but I seem to end up going out instead of actually starting it. I've got the basic concept and a few details drawn out, and the initial foundation of the database structure has been designed and written down, and actually partially created.

I'd love to tell everyone the idea behind my project, but it's my baby, and I can't risk someone stealing the idea and beating me to the punch! It's definitely unique, and I could see it as something really taking off if given the proper chance (and if it's designed right).