Amy Blankenship
1 min readAug 17, 2024

--

I think there's a good argument to be made for putting the pattern name in the Class name in OO languages (and sometimes file or other names in other languages). When I see a pattern name in code, I at least have some idea behind the intent of the code. For example SomeStragegyThing tells me that this is either a class where significant parts of its guts can be injected in and change its function or that it is the piece that gets injected in to change the function of the other Class.

If I see SomeSingleton, I know to expect it will be a long slog with technical debt and a team that has really bad habits and it may have been a mistake to accept this job.

I also feel like I in interface names has its place. It tells me right off the bat that whatever is occupying that variable is not going to be a specific implementation, so I may need to look in multiple places to figure out what could happen when running that code or tracking down a bug. It is easy to find out it's an interface in other ways, so it's not critical, but I look at "I" naming for interfaces as a place where reasonable people can see it either way and not worth fighting over.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (2)