Jump to content

OOP Questions


The Little Guy

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/157404-oop-questions/#findComment-829857
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/157404-oop-questions/#findComment-830072
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.