Marshall Schor wrote:
...
What's the benefit of prefixing member refs with "this"? I find it makes the code harder to read. Eclipse can be set up to "color" member refs, in any case.

It's essentially a matter of taste. The knock-down argument for me is: there's a Java language construct for designating member variables, so let's use it instead of everybody making up their own prefixes, postfixes or what have you. It also helps you to discover problems because you can tell Eclipse to create a warning for references to member variables without the prefix: you suddenly notice you accidentally referenced a member variable instead of a local variable. My philosophy is, whatever can be checked by the compiler, should be checked by it.

So here's a list of code conventions that I think we should get agreement on:

- where to put the braces; I have an opinion, but it's more important to me that we're consistent than that the decision goes my way. I find it important because it changes the readability of the file, and I'd like to be able to get used to one of the styles. I've moved between the styles myself, actually, but it's time to settle down ;-)

- where to put member variables. Our code is the only code I've ever seen that sometimes has member variable declarations after method definitions. Even after years of working on UIMA, that still sometimes throws me off as it just doesn't occur to me to look at the end of the file for variable declarations. Can we agree to follow the Sun guidelines here?

- line length. I have my line length set to 80, that may by a bit conservative nowadays. 100, anyone?

- no tabs. Every programmer's editor can be configured to write spaces for tabs, there is simply no excuse.

The following are less important to me:

- indentation. As long as it's consistent within a file, I personally don't care if the indentation is 2, 3 or 4. I can live with any of those values. Marshall and Adam have already expressed a preference for 2, and that's fine with me.

- some people have an opinion on how to structure import declarations. I never use package imports, but that's mostly because Eclipse makes it so easy to manage them.

If can't come to an agreement on some of those, that's fine with me, too. However, if we agree to disagree, then can we agree that it's ok to reformat files we're working on according to our own preferences?

--Thilo

Reply via email to