Jump to content

Recommended Posts

Hi, I was looking some advice on implementation of static functions vs a more Object Oriented Approach. 

 

When exactly is the best time to create Static Functions?  Currently I'm working on an API. 

 

At it's core it really only queries an external database, however I also added additional clases which "extend" the original object allowing each of them to inherit the same querying functionality while adding a few of their own(like a function which adds entries to that database). 

 

It works fine...but now i'm thinking that I might have just gone a little overboard when having decided to use OOP. 

 

In a professional environment, would you normally just say "screw that" and create a few static functions to handle each additional operation, or would you in fact have taken a similiar approach? 

 

Just looking for some more experienced feedback, thanks.

Link to comment
https://forums.phpfreaks.com/topic/174361-static-functions/
Share on other sites

I would have, and actual do take a similar approach at my job. With class extension you have to added bonus of data encapsulation that you don't have with static functions, and since you get the same functionality, but can customize it with inheritance, and function overriding, etc. I would say you made a wise choice.

Link to comment
https://forums.phpfreaks.com/topic/174361-static-functions/#findComment-919068
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.