+ 1

Should you prefix interfaces with I in C#?

Microsoft suggests you should as a naming convention but Robert Martin in the book Clean Code says that you shouldn't use Hungarian notation anymore as it is outdated and no longer needed. What do people think and do in their own code?

18th May 2019, 12:03 PM
Roy Marler
2 Réponses
+ 2
You should use I for interfaces. Interfaces are shown to the outside world. Being able to differ a class from a interface is important. Robert Martin talks about variables. So Use I for interface And do not use any prefixes for variables. According to Robert Martin interfaces are bad any way https://blog.cleancoder.com/uncle-bob/2015/01/08/InterfaceConsideredHarmful.html
18th May 2019, 12:59 PM
sneeze
sneeze - avatar
0
I have a naming convension I stick to. I inherited it from Python's pep8 Basically: - normal_variables are lowercase. With underscore if more than one word - temporary variables are a single lowercase letter - function names use PascalCase and no underscores - similar functions use the same parameter names I think this about sums it up🤔
18th May 2019, 12:38 PM
Trigger
Trigger - avatar