accessibility file naming convention

119 views
Skip to first unread message

Alexander Surkov

unread,
Nov 25, 2020, 12:36:00 PM11/25/20
to Chromium Accessibility, Dominic Mazzoni, aleve...@chromium.org
Hi. Here's a follow up from the issue [1] about naming convention for accessibility related files.

Apparently Chromium project sticks with an implicit rule to give a file name matching its class name (with a number of exceptions for example unit test files). The rule is also encouraged by Google C++ Style guide [2]:

"In general, make your filenames very specific. For example, use http_server_logs.h rather than logs.h. A very common case is to have a pair of files called, e.g., foo_bar.h and foo_bar.cc, defining a class called FooBar."

This is a reasonable recommendation since it links class names and file names. However it has an unpleasant side effect in accessibility. Accessibility doesn't have its own namespace and thus most of the a11y files are prefixed by either by accessibility_ or by ax_, which makes literally all file names starting from those prefixes in certain folders. I think it obscures folder structure and makes it harder to spot a needed file when you look at a folder.

Long story short as part of a11y inspect refactoring, all inspect related files are moved under ui/accessibility/platform/inspect folder; all classes get AX prefix, but no ax_ prefix for the file names there [4]. It seems that this is not very aligned with existing practices though. I wonder though if this case makes a good exemption from the rule.

So I'm eager to hear your opinion on how file names should be schemed in accessibility, whether it'd be good (or bad) to omit ax_/accessibility_ prefixes in folders containing accessibility files only.

Thanks!
Alexander.

Alexander Surkov

unread,
Dec 2, 2020, 10:47:27 AM12/2/20
to Aaron Leventhal, Chromium Accessibility, Dominic Mazzoni, Aaron Leventhal


On Mon, Nov 30, 2020 at 1:01 PM Aaron Leventhal <aleve...@google.com> wrote:
I would like to stick to the rule where the class name strictly matches the file name. In addition, I agree with Nektarios that we should almost always have one class per-file. Chrome doesn't always stick to this, but I think it makes more sense most of the time.

Regarding ax_ in front causing extra work — I actually prefer ax_ in front of names because I am not usually visually browsing for files/classes. I'm usually typing in part of a name in either a global or local search. For example, in my editor or in code search, I can type axeventgen to get AXEventGenerator. I don't need to worry about any of the other EventGenerator classes in Chromium.

I see. It is a valid scenario.

When I find myself in a situation when I don't recall the exact class/file name, and thus search doesn't give me anything relevant, I rely on folders hierarchy and scan files visually in a folder; it gives me a quick match in most cases when file names are short and clear. So I thought it should be a good idea to improve folder readability by tossing out ax_ prefixes. Having said that if everybody prefers to keep them, then I suppose I can live with that.
 

- Aaron

--
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-accessib...@chromium.org.
Reply all
Reply to author
Forward
0 new messages