Naming: objectAction or actionObject?

Posted by DocSalvage on Programmers See other posts from Programmers or by DocSalvage
Published on 2013-06-26T11:06:30Z Indexed on 2013/06/26 16:29 UTC
Read the original article Hit count: 290

The question, Stored procedure Naming conventions?, and Joel's excellent Making Wrong Code Look Wrong article come closest to addressing my question, but I'm looking for a more general set of criteria to use in deciding how to name modules containing code (classes, objects, methods, functions, widgets, or whatever).

English (my only human language) is structured as action-object (i.e closeFile, openFile, saveFile) and since almost all computer languages are based on English, this is the most common convention.

However, in trying to keep related code close together and still be able to find things, I've found object-action (i.e. fileClose, fileOpen, fileSave) to be very attractive. Quite a number of non-English human languages follow this structure as well.

I doubt that one form is universally superior, but when should each be used in the pursuit of helping to make sure bad code looks bad?

© Programmers or respective owner

Related posts about programming-practices

Related posts about naming