SchweppesAle Posted September 15, 2009 Share Posted September 15, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/174361-static-functions/ Share on other sites More sharing options...
mikesta707 Posted September 15, 2009 Share Posted September 15, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/174361-static-functions/#findComment-919068 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.