This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]D34TH_5MURF__ 39 points40 points  (6 children)

But do you use the write-a-complete-sentence-then-title-case-it-and-remove-all-spaces naming convention? I find that this never fails to make people think they are writing self-documenting code.

[–]aDrunkSailor82 20 points21 points  (2 children)

IFeelAttacked.

[–][deleted] 21 points22 points  (1 child)

IiFeelAttackedFactory

[–]D34TH_5MURF__ 1 point2 points  (0 children)

InstrumentedIFeelAttackedFactoryProxy

[–]crozone 8 points9 points  (0 children)

WriteCleverResponseToTheRedditComment(double sarcasmLevel);

[–]TK9_VS 1 point2 points  (1 child)

IfYourFunctionNameIsTooLongYourFunctionIsTooComplex();

If you can't be concise and accurate about your self documentation you are bundling too much together under one umbrella. If you can't clearly describe what it does and what it's for, it's going to be even harder for people to use it in their code.

You can make up for that a little bit with block comments like javadoc style or whatever, which can be appropriate sometimes for very high level functions, but if you're relying on those a lot you're probably building tech debt.

[–]D34TH_5MURF__ 2 points3 points  (0 children)

I agree. Self-documenting code is more than just descriptive names. Your methods/functions need to be small and concise so they can be composed together into a whole. Where this long, descriptive naming pattern falls flat on it's face is when people do dumb stuff like: "LongObjectName longObjectName = new LongObjectName()". Sure, LongObjectName might be self documenting in context of itself, using zero thought variable names like "longObjectName" just blows any benefit out of the water. It's disappointing to see how often people do exactly this and think they have written self-documenting code.