Quality Code

As I think closing subjects is not a good habit I’ll quote the message I wanted to anwer to cause it’s really interesting and I don’t want to censor people (at least not blah^3)

Thanks for sharing your knowledge.

We use SVN (@ sourceforge.net) and it does support check-in hooks. It may be interesting to set up a formatting check-in… The code standard for Xith3D is Java Sun Standard Convention (and this time, a link : http://java.sun.com/docs/codeconv/). Do you know any formatter for SVN ? (I guess Eclipse’s internal one doesn’t run command line).

I wonder what unit tests could we do on rendering software… maybe getting some pixels color (or simply checking there is no exception thrown). But tell me, do sf.net servers have 3D hardware-accelerated graphic cards ? How could we run Java there… ?

I agree completely. And I repeat code conventions for Xith is Sun’s one. Marvin, you can use your style for you game e.g. and if I ever write some code for it I will conform to it but I guess if I ever work on a Java project I’ll have to follow Sun’s conventions so good habits first.

I closed the topic becouse it was talked about enough and everyone seemed to be happy to not talk about it anymore.

I guess this isn’t a server job but a client’s one, but I don’t know. So Eclipse was the one to do.

It will also certainly be a client’s job.

Well, as a result of the whole discussion, I disagree, that Xith’s conventions are Sun’s ones. I thought we agreed, that everyone can have his own style as long as it is readable. Just as it was usus before.

I don’t consider Sun’s conventions as a good habit. I repeat, that the opening-brace-at-same-line is not best for today’s displays. So brace-at-next-line is in any way the better one nowadays. Many people may have got used to the “old” style, but apart from that I like it next-line, being objective, next-line is the better one today.

I totally agree, that a common coding style is important. But I made this thread to discuss about it, nobody objected and I made “nails with heads”. And after it some pople came around to start the discussion. This cannot be. As far as I see it, the decision was made. And you cannot see the discussion imbalanced in preference of same-line-style, if mostly people having nothing to do with xith development argumenting against next-line-style.

So ignoring these people I voted next-line, cylab did. You had agreed to it previously, but switched during the discussion. kev-glass agrumented same-line, but told me to not ask, just do, because he is not developing xith anymore. c_lilian voted same-line.

So the discussion is about balanced. And so you cannot come around and pronounce Sun’s style to be the one to be used, when the discussion does not clearly show this result.

Grabbing the conclusion of the last posts I repeat, that it is ok, if we grant people the right to use an own style as long as it’s readable. But one should either prefer to use Sun’s convention or mine.

Is this ok for you?

Marvin

I disagree. modern-day displays have increased more in width than they have in height (hence widescreen LCDs), so why waste vertical space for 1 measly character when you can tack it onto the extended horizontal space?

Because of readability. So space is not wasted. And we do have more than 24 line to display, which is the old value, that caused people to compress code this way.

code formatting is a religious thing. i personally am not going to waste a whole line for one silly character, it’s bad enough my closing braces already do this.

to each is own

Wow :o. Then just write everything into one long line :wink:

It is clear, that blank lines, separating logical blocks, improve visibility. And separating the method signature from the body by one line also does, never mind if there is an opening brace in it or not. Many people put a blank line after the signature, so why not use this to put the brace there and further improve visibility ???

Yes I know… it’s just religious. But then I’m a god’s man :wink:

Marvin

I’m religious too, but putting a new line for a bracket or not doesn’t really change visibility for me at all, but that’s me. my use of tabs makes it visible enough to find where the opening bracket began o_O;

Now here we go again… . ;D

Rafael

I may not have work on it, but I am learning ;D

Well acutally you can save the different code styles in Eclipse… and once you are done typing your code, you can just use eclipse Auto-Style key to make it in the style you want… ^^

Actually I think that’s a dangerous thing (we tried this at work, but reverted to semi-manual formatting), since one false setting will screw your Versioning history completely, leaving you with conflicts on every update.

I think the easiest sollution would be to adhere to the SUN coding style, where it makes sense and suites your needs, but allow for a bit looser convention where the religous feelings of a developer might be hurt ;). We do so at work and surprisingly our code is still readable despite of slightly different code-styles and everyone is happy.

Agreed.

And I repeat, Marvin, that it was stated clearly in the wiki that the code formatting conventions which should be followed for Xith core and toolkit code was Sun’s one…

A page has been added (by me) to precise some things : http://www.xith.org/pages/developers_infos.html

The page as a whole is really cool. But as you may expect I’m not totally happy with the phrasing of the coding guidelines part. In principle I could live with it. But if you’re receptive for a slightly different phrasing, I would like to tell you. But let’s do it by PM, ok?

Marvin

Hmm I could add “In specific cases when a specific formatting fits specificly well for a specific piece of code, you may be specificly allowed to violate a bit Sun’s conventions. But these cases have to remain exceptions”

You don’t have to be sarcastic :-.

I’ll send you my suggestion by PM. But I first need to do some other things. So in an hour maybe…

Marvin

Because of readability.

Did you try it yourself? For a few years?

I did. (As I already said I used 3 popular styles for a couple of years each.) And it really doesnt make any difference… after you’ve used one for a while. And (as I also already said) most java people are used to hugging brackets. So, thats the most readable (and writable) one for em (w/o any extra training).

I don’t consider Sun’s conventions as a good habit.

I do. And I think its awesome that Java has such a thing. Java code is much more consistant thanks to that. Its also great that there are guidelines for documentation.

At the end of the year you save countless hours thanks to that. (Seriously.)

I agree with Onyx.

Huh okay it was a bit sarcastic but the core message is here, isn’t it ?

Err in an hour time I’ll be in bed probably.

Well. I finished the work on the OBJLoader, which was an important task to do. Now I’ll write the suggestion text and send it to you. So if you have 10 minutes…

Marvin

Well okay.

it was a bit sarcastic

No, it wasnt. I just tried to be clear. :slight_smile:

And I do actually think those conventions (doc+code) are the biggest strength of java. It improves productivity like being memory managed does, but unlike that its not a given.

I was talking about what I said ;D

Well I agree totally but if you could only convince marvin…