How to name you're interface

twitter logo github logo ・1 min read

What's you're naming convention on implementing interfaces

You can do it on different ways:

example 1

interface Person { /**define you're method**/}

class PersonImpl implements Person { /**define you're method**/}

example 2

interface IPerson { /**define you're method**/}

class Person implements IPerson { /**define you're method**/}

example 3

interface IPerson { /**define you're method**/}

class PersonImpl implements IPerson { /**define you're method**/}

this list of examples can be extended, feel free to share you're opinion

twitter logo DISCUSS (1)
markdown guide

When looking into books that teach OOO, I remember that the I for interface before the name was always taught as a (good) practice. In reality, I haven't come across any application where this naming pattern is actually used.

Usually the interface has a very generic name, Report.

interface Report { /**define you're method**/}

class AReport implements Report { /**define you're method**/}
class BReport implements Report { /**define you're method**/}

To my mind this seems sufficient and perfectly fine. That said, as long as you stay consistent with your naming strategy almost all patterns are fine.

Classic DEV Post from Aug 30

SELECT Post FROM Stack Overflow Questions WHERE Topic = "git" ORDER BY Votes DESC;

Bo Vandersteene profile image
Frontend Software Engineer & Mentor, works with Angular, Typescript, Javascript. If I have some time over,I like to blog

Do you prefer sans serif over serif?

You can change your font preferences in the "misc" section of your settings. ❤️