w1zzerd Posted July 23, 2014 Share Posted July 23, 2014 So I have been writing PHP constantly for a few months now, and have a pretty good grasp on OOP coming from other languages. One thing I never really use is interfaces, I get it when a class implements an interface, that class is required to have implemented methods from a interface, or a constant that is required by an interface. Seems like the kinda thing you would need when you are on a large team mainly for naming consistency? Is this something I should be using? I know I can get away with not using it, but should I use it to be up to modern php standards? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/290070-how-often-do-you-use-interfaces/ Share on other sites More sharing options...
requinix Posted July 23, 2014 Share Posted July 23, 2014 Naming consistency? Hardly. That's a job for coding standards and IDEs that can automatically (re)format code for you. Rather than rehash something that is a fairly complicated subject, let me point you to, honestly, the first four results I found in Google that looked decent: - Why you should always use PHP interfaces - Understanding and Applying Polymorphism in PHP - Design Pattern Principles for PHP: Program to an Interface; not an implementation - When should I use an interface/abstract class? 1 Quote Link to comment https://forums.phpfreaks.com/topic/290070-how-often-do-you-use-interfaces/#findComment-1485970 Share on other sites More sharing options...
trq Posted July 23, 2014 Share Posted July 23, 2014 It's pretty hard to write SOLID code without interfaces. 1 Quote Link to comment https://forums.phpfreaks.com/topic/290070-how-often-do-you-use-interfaces/#findComment-1485972 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.