Jump to content

Static Functions


SchweppesAle

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

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.