Is class interface a lost art?


I have been a programmer for 5-6 years, and during the new year review, I do a quick look at the code that I have done and guess what? I hardly do any class interfacing!

An interface is a contract specifying a set of methods which will be available on any implementing object. It is to ensure that classes that implements an interface follows a template on how the methods are named. How the methods are run is up to how the programmers fill up what is between the curly brackets.

Curiously the last time I do an interface is because the developers under me is coming up with their own report class using naming at their own convenience. I sort of have to bang tables to get them on the same page. Chances are I can actually ignore them and let the code runs out of control, but I choose to take ownership

Then I did a search in 2 of my favorite frameworks: CakePHP and Codeigniter. Surprisingly Codeigniter DID NOT use any interface at all whereas Cakephp has numerous interface in their lib folder

Why is it so? My guess is compared to extend, interface is a lot more work. You need to create an interface before you start to craft up the classes to link them. Hence the lack of usage of interface. What would be your reasons then? Feel free to add in the comments below.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s