The Little Guy Posted May 8, 2009 Share Posted May 8, 2009 I interviewed for a job, and they use mainly OOP, so... a few questions for you OOP programmers: [*]Why is this better than procedural programming? [*]In what types of situations would you use OOP [*]How would you use it? (to build an entire page?) [*]Anything else... Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 8, 2009 Share Posted May 8, 2009 1. I wouldn't say it's better. It's more like preferred because it makes your gigantic database of code more organized and easier to manage. 2. Almost any type. 3. By writing it. 4. Google it. Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted May 8, 2009 Share Posted May 8, 2009 I interviewed for a job, and they use mainly OOP, so... a few questions for you OOP programmers: [*]Why is this better than procedural programming? [*]In what types of situations would you use OOP [*]How would you use it? (to build an entire page?) [*]Anything else... 1. To expand on what Ken said, OOP facilitates the creation of flexible and reusable code. If used correctly, OOP code leads to a modular design. You can extend existing code, and add new capabilities without killing the existing application. Similarly, you can use the objects you create in a variety of projects, because they're decoupled from the main program/script. 2. I think it's useful in just about any situation. If something needs to be done quickly, where consideration of the future isn't necessary, then it's possible to write a quick and dirty procedural script that gets the job done. In virtually all other situations, I'd use OOP. 3. I'd think that in most cases, a page would be the end result of a specific script process. Even then, the template could call some simple methods in order to retrieve and possibly display dynamic content. 4. Google it, or ask here. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted May 9, 2009 Author Share Posted May 9, 2009 another thing... When I have viewed OOP, I usually see it where it performs a task, such as do mysql, math, exec, etc. I usually don't see it generating dynamic HTML, is this usually true? Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 9, 2009 Share Posted May 9, 2009 Not necessarily, but it can get very confusing depending on how dynamic you make it. You can use OOP to generate some HTML, but there's really no point to it. I just write up some chunks (which are HTML + PHP) files and include them as needed. I don't use OOP to build a whole page if that's what you're asking. Quote Link to comment 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.