Anyone else find naming classes and methods one of the most difficult parts in programming? [closed]

So I’m working on this class that’s supposed to request help documentation from a vendor through a web service. I try to name it DocumentRetriever, VendorDocRequester, DocGetter, but they just don’t sound right. I ended up browsing through dictionary.com for half an hour trying to come up with an adequate word.

Start programming with bad names is like having a very bad hair day in the morning, the rest of the day goes downhill from there. Feel me?

42 Answers
42

What you are doing now is fine, and I highly recommend you stick with your current syntax, being:

context + verb + how

I use this method to name functions/methods, SQL stored procs, etc. By keeping with this syntax, it will keep your Intellisense/Code Panes much more neat. So you want EmployeeGetByID() EmployeeAdd(), EmployeeDeleteByID(). When you use a more grammatically correct syntax such as GetEmployee(), AddEmployee() you’ll see that this gets really messy if you have multiple Gets in the same class as unrelated things will be grouped together.

I akin this to naming files with dates, you want to say 2009-01-07.log not 1-7-2009.log because after you have a bunch of them, the order becomes totally useless.

Leave a Comment