TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-22-2008, 05:47 AM   #1 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default You must get worse, before you get better!

For.. f.. sakes...

I wish I had never started this.

The first 'major' script I decided to undertake since getting back into PHP was a user authentication system. I figured this would be a good idea, for a bunch of reasons. First and foremost, for the site I want to build, it would be the most basic building block I needed for everything else to function. Secondly, it would incorporate a wide variety of subjects I've been learning about, and wanted to improve upon... security, forms, sessions, et al.

So I wrote the basics, and it went great. I was impressed. Then I learned about OOP, and I built some classes, and everything was going fine. Everything worked. It was a bit messy, but somehow, I could register, log in, log out, track users, and have a bit of fun with it.

Then, it happened.

The singleton.

Uh oh.

Now that I've started to learn about design patterns, and more in depth about OOP, my brain has fried. Everything I once had mastered, has fallen apart, and none of it makes sense anymore. Why oh why, did I have to push myself? Why do I feel the need to try and learn new things every day?

I nearly threw everything out three times tonight to start over from scratch. I've come so far, but now that I have this stupid stupid idea in my head that I need to loosely couple my classes and develop some kind of design model and methodology to make sure that I can continually expand and increase the power of my lil baby, it all just looks so messy... how do I clean up the mistakes of my early days... how do I utilize what I've come so far on, and somehow turn it into the beast I envision?

WHO ARE YOU PEOPLE, AND HOW DO YOU MAKE ALL MY FUN TURN INTO MY NIGHTMARE? The problem is, it's still fun. Sorry, I just had to rant a little.

Anywho... back to studying.
-m
delayedinsanity is offline  
Reply With Quote
Old 04-22-2008, 11:01 AM   #2 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

okay.. But, I think you should lay off the coffee, lol.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-22-2008, 11:27 AM   #3 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Trying to tackle such a major paradigm shift is certainly enough to confuse the noggin for a while. Take your time and don't try and become a super-duper OOP expert overnight; it just doesn't happen like that.

Keep learning little things and implementing them as best you can. Sooner or later it'll hit you without even realising it: "whoa, I'm doing it!"
Salathe is offline  
Reply With Quote
Old 04-22-2008, 11:29 AM   #4 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
Trying to tackle such a major paradigm shift is certainly enough to confuse the noggin for a while. Take your time and don't try and become a super-duper OOP expert overnight; it just doesn't happen like that.

Keep learning little things and implementing them as best you can. Sooner or later it'll hit you without even realising it: "whoa, I'm doing it!"
It took me about 2 months to start any Interfaces in oop, and it took me about a year to even understand abstract classes :P.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 04-22-2008, 02:41 PM   #5 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

Buuuuuuuut ittt shoooooooooUUUuuuUuuld.

I'm not expecting it completely overnight, but I mean c'mon. Two nights at most.

I was really frustrated with all of it last night, but I realized afterwards all I need to do is slow down and work with what I already know. If, by the time I get done, it isn't extensible in the way I had hoped, so be it, then I'll take what I learned and start over at that point and build it better.

Sorry about that rant. Not really useful to the forums but I had to get it out somewhere.
-m
delayedinsanity is offline  
Reply With Quote
Old 04-22-2008, 03:18 PM   #6 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

Actually, if you think about it, it could help serve as a warning to novice programmers....
that being...

Slow down, use what you know, don't try to force yourself, and with patience everything will come together in the end...
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Old 04-22-2008, 03:39 PM   #7 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

It came together. I'm not a novice, I'm a freakin Jedi.

I figured out what I was doing wrong trying to implement the singleton - I was still thinking in a fairly linear fashion of includes and global variables, and even though I have the proper functionality built into my parent class, I was still using it just like I would an included class.

Now I've got a bunch of work, but it's all syntax. Gotta go through and remove all references to global $database, $form, $etc; and replace it with $database =& kePhoto::getInstance('database');. Something just clicked this morning, and I'm liking this a LOT. Even if it's not being fully implemented properly, it's a damn sight better than what I had before. Now it only calls objects as needed, instead of calling every object, every time, like I had it before. Woo Wooooo.
-m
delayedinsanity is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 09:32 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design