Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.
superdezign wrote:Is there something that I'm missing?
Uhhhhhh .... the benefits of inheritance?
Well, I haven't seen a time where I'd have use for inheritance, yet.
Hockey wrote:I'm trying to understand what your doing here, doesn't sound OOP. Instead of inheritence you add conditional logic in your object?
Yes, that's exactly what I'm saying, but I've never done it yet. I've done it JavaScript once, but that's because I barely know how JavaScript makes classes (prototype this and that), so I'm clueless as to the syntax.
Well, I haven't seen a time where I'd have use for inheritance, yet.
Perhaps you have not had to write a particularly large project but you haven't understood some of the most important principles of OO.
Your code will be depending on concretes instead of abstractions and you won't be able to achieve any polymorphism. Polymorphism replaces a lot of logic which means less work and fewer bugs. And depending on concretes is bad because your classes will be tightly coupled and you'll be performing shotgun surgery (making changes to several classes in order to achieve something) all over the place to get them to work. Nor will you be able to implement "code closed to modification but open to extension" which means a doddle of a task to a proper OO programmer will be a real head ache for you.
Wow... I just got to thinking about it and reading through some of my longer, function-heavy classes, and have realized how right you are. Luckily, I've started from scratch just recently, so I can do something about it from the get-go.
I never really noticed it till it took my longer than a few second to scroll down a file. There are so many functions specific to different things, and I've got them all in one base class. Silly stubborn me. :-p
Honestly, all of us have much to learn -- which is why we are here. I read something from a smart guy like ole and it clicks for me. I may have heard it before, but the combination of how he said it and things I have been working on help it finally click. I give his idea a go and write about that worked for me ... and hopefully that helps someone else.
You want to learn PHP? Read the posts in these forums thoughtfully and ask questions. Plus use the web -- go to planet-php.net and see what PHP bloggers are are talking about.
For me its rewarding to learn something but it pales into insignificance to the warmth I feel when people really advance as I result of something I say.
I think I'm destined to be a teacher some day.
Read the posts in these forums thoughtfully and ask questions. Plus use the web -- go to planet-php.net and see what PHP bloggers are are talking about.
Forums are great for when you get in a silly mindset and you need someone to pull you out or you just don't get something that is supposed to be relatively simple; I certainly get plenty of these when I try and learn something new. Web tutorials are dangerous because they aren't always accurate, but as long as you have the ability to judge the reliability of a website they are definitely valuable and there's nothing faster. But for me there's nothing better than a critically acclaimed book. This must be the forth time I've posted this title here but it's really great.
ole wrote:For me its rewarding to learn something but it pales into insignificance to the warmth I feel when people really advance as I result of something I say.
I think I'm destined to be a teacher some day.
I'd love to be a teacher! And to teach programming... That'd be a job I'd love.
ole wrote:
Read the posts in these forums thoughtfully and ask questions. Plus use the web -- go to planet-php.net and see what PHP bloggers are are talking about.
Forums are great for when you get in a silly mindset and you need someone to pull you out or you just don't get something that is supposed to be relatively simple; I certainly get plenty of these when I try and learn something new. Web tutorials are dangerous because they aren't always accurate, but as long as you have the ability to judge the reliability of a website they are definitely valuable and there's nothing faster. But for me there's nothing better than a critically acclaimed book. This must be the forth time I've posted this title here but it's really great.
I feel as though the the forum is, possibly, the best resource. There's a natural system of checks and balances here and everyone here knows something worth discussing.