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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.