phpSensei Posted August 24, 2007 Share Posted August 24, 2007 People keep talking about OOP, and I just can't see the ligth. Why use classes, and in all my php projects, I was successful without using php classes. I have made an entire forum, and I have it on my site, and I havnt used classes at all. If it is for the ease of it then show me. I just don't understand... Considere this question a help in php. Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/ Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 It just helps to create logical groupings for similar code. It also gives you the ability to create complex datatypes. The other big advantage is its reusability. With classes you can drop your code on a new application and take off knowing it works and not rewriting code. That being said OOP is still procedural programming in a lot of ways. Yes you have objects that represent things and perform special actions but it's still down pretty sequentially as opposed to an event driven environment like .NET. Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332625 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 Wouldnt that make you lazier in php? I mean you create a class for a file upload, then whenever you make a site with a file upload, you just drag and drop the code. Coding over and over again makes good practice.. Correct me if I am wrong though... Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332630 Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 You're wrong. Why would you ever want to rewrite code? You do it right the first time and then you forget the details of how it works. This gives you the ability to drive out efficiencies in your own development processes in methodologies so that you can more quickly develop complex applications. Furthermore, having a set of classes makes maintenance easier moving forward because you're always working from a common framework/environment. Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332633 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 Ah, Getting closer to the light.... Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332635 Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 Step into it Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332637 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 When I was reading Sam's Teach Yourself PHP, I skipped The hole Class Chapter. Lol, I guess I need to go back. Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332639 Share on other sites More sharing options...
dbo Posted August 24, 2007 Share Posted August 24, 2007 That's okay. It's all part of the learning process. I've been writing PHP for years and years and I don't claim to have it all figured out. You just take the concepts you pick up and expand on them as you go. Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332640 Share on other sites More sharing options...
phpSensei Posted August 24, 2007 Author Share Posted August 24, 2007 thanks for the advice. Quote Link to comment https://forums.phpfreaks.com/topic/66443-solved-help-me-see-the-light/#findComment-332645 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.