You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Arved Sandstrom <Ar...@chebucto.ns.ca> on 2001/07/17 01:22:38 UTC

Code Style, was Re: PDF serialization

At 09:26 PM 7/16/01 +1000, Mark wrote:
> As an aside: is there a style guide for FOP code? I must say I find the
>style and layout very confusing and I'm happy to clean things up as I go.
>At the moment I can't even work out what tab stop size people are using.
>(In my own work I use 8 character tabs with 2 character indenting).

Yep. http://xml.apache.org/source.html references the Sun Java coding 
conventions, at http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html.

An interesting point that comes out of the coding conventions is that while 
Sun instructs us that tabs must be 8 spaces, they also state that the unit 
of indentation is 4 spaces.

Seems to me that the easiest way to avoid problems is never to leave tabs in 
the code - I use a text editor that is set to 4 spaces per tab and 
immediately translates tabs to spaces.

We are well past the point where we should take a style tool to the whole 
codebase, strip out all tabs, and re-commit the whole thing. :-)

Regards,
Arved Sandstrom

Fairly Senior Software Type
e-plicity (http://www.e-plicity.com)
Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by "Peter B. West" <pb...@powerup.com.au>.

Arved Sandstrom wrote:

> At 09:26 PM 7/16/01 +1000, Mark wrote:
> 
>>As an aside: is there a style guide for FOP code? I must say I find the
>>style and layout very confusing and I'm happy to clean things up as I go.
>>At the moment I can't even work out what tab stop size people are using.
>>(In my own work I use 8 character tabs with 2 character indenting).
>>
> 
> Yep. http://xml.apache.org/source.html references the Sun Java coding 
> conventions, at http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html.
> 
> An interesting point that comes out of the coding conventions is that while 
> Sun instructs us that tabs must be 8 spaces, they also state that the unit 
> of indentation is 4 spaces.
> 
> Seems to me that the easiest way to avoid problems is never to leave tabs in 
> the code - I use a text editor that is set to 4 spaces per tab and 
> immediately translates tabs to spaces.
> 
> We are well past the point where we should take a style tool to the whole 
> codebase, strip out all tabs, and re-commit the whole thing. :-)


Arved,

Agreed.  From my own point of view, it would also be nice if, once the 
cleanup were done, committers could gradually re-arrange code to fit on 
an 79 column page (1 column is sacrificed to (X)Emacs.)  I appreciate 
that this is kind of old fashioned, but more often than not, I work with 
multiple 80 column windows rather than a full-screen editor.

Peter
-- 
Peter B. West  pbwest@powerup.com.au  http://powerup.com.au/~pbwest
"Lord, to whom shall we go?"


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Jeremias Maerki <je...@outline.ch>.
May I suggest to put up a code convention section in involved.xml? I
think a short notice with the most important rules (tabs to spaces, 4
spaces for tab etc.) will suffice. That will make it easier to encourage
people to follow the conventions.

Jeremias Märki

mailto:jeremias.maerki@outline.ch

OUTLINE AG
Postfach 3954 - Rhynauerstr. 15 - CH-6002 Luzern
Fon +41 (41) 317 2020 - Fax +41 (41) 317 2029
Internet http://www.outline.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Tore Engvig <te...@manamind.com>.

On Thu, 19 Jul 2001, Mark Lillywhite wrote:

> >Sure. Monday the 23rd evening (GMT) is codeformatting day unless somebody
> >protests.
> >
> Would it be possible to wait for a day or two before setting a firm
> date? I hope to have my pipelining stuff completed today and I would
> like to at least get an opinion on their suitability for inclusion
> before this goes ahead. While the changes aren't very big they will be
> very difficult to apply after the code is reformatted.

I guess it'll take more than a few days to look at it, better postone it a
week. So monday the 30th is codeformatting day!


Tore


>
> I'm just asking for a couple of day's grace, and the time of a committer
> to take a look at them and let me know if they are suitable or not.
>
> Regards
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Mark Lillywhite <ma...@inomial.com>.
>
>
>Sure. Monday the 23rd evening (GMT) is codeformatting day unless somebody
>protests.
>
Would it be possible to wait for a day or two before setting a firm 
date? I hope to have my pipelining stuff completed today and I would 
like to at least get an opinion on their suitability for inclusion 
before this goes ahead. While the changes aren't very big they will be 
very difficult to apply after the code is reformatted.

I'm just asking for a couple of day's grace, and the time of a committer 
to take a look at them and let me know if they are suitable or not.

Regards
Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Tore Engvig <te...@manamind.com>.

On Tue, 17 Jul 2001, Arved Sandstrom wrote:

> Hi, Tore
>
> Well, how about _you_ set the day, since you're the volunteer? :-)

Sure. Monday the 23rd evening (GMT) is codeformatting day unless somebody
protests.

Everyone who have some uncomitted code should commit it by then as the
diffs in your local copy after the codeformat will mismatch and cvs will
scream conflict.

I will tag the repository before beautifying the code (eg PRE_CODEFORMAT)
and also take a look at the long-form/short-form license.


Tore

>
> I tend to agree with your comments about cvswrappers, and you're right, why
> not try the logical first approach, which is that all committers make a
> point of running the code beautifier of their choice before making commits?
> We have not in a long time, if ever, put our foot down and said that this is
> the way it will be - it's been pretty lackadaisical so far. So, once you
> have reformatted everything, and recommitted, all committers would be on
> notice to adhere to code conventions.
>
> It would be useful if you can work in license long-form -> short-form
> translation also.
>
> A tag is a good idea, I agree. Who knows what might happen?
>
> Thanks in advance for doing this.
>
> Regards,
> Arved
>
> Fairly Senior Software Type
> e-plicity (http://www.e-plicity.com)
> Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
At 11:25 PM 7/17/01 +0200, Tore Engvig wrote:
[ SNIP ]
>I guess we have to use codeformatters (eg astyle) before we check in our
>code.
>
>I happend to grab a copy of jIndent while it still was free. jIndent does
>more than just codeformatting, it parses the code and is able to change a
>lot of things (eg bracket style, set a max linelength, etc).
>
>I could reformat the whole repository with jIndent, then we could continue
>with using astyle or some other free codeformatter as we go.
>
>Just pick a day. It would be best if everybody have checked in their
>changes before reformatting the whole source (and I guess I should tag
>the repository before reformatting).

Hi, Tore

Well, how about _you_ set the day, since you're the volunteer? :-)

I tend to agree with your comments about cvswrappers, and you're right, why 
not try the logical first approach, which is that all committers make a 
point of running the code beautifier of their choice before making commits? 
We have not in a long time, if ever, put our foot down and said that this is 
the way it will be - it's been pretty lackadaisical so far. So, once you 
have reformatted everything, and recommitted, all committers would be on 
notice to adhere to code conventions.

It would be useful if you can work in license long-form -> short-form 
translation also.

A tag is a good idea, I agree. Who knows what might happen?

Thanks in advance for doing this.

Regards,
Arved

Fairly Senior Software Type
e-plicity (http://www.e-plicity.com)
Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style

Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
At 12:09 PM 7/17/01 +0200, Keiron Liddle wrote:
>
>I think that would be better to do it all at once and use the wrappers. The
>only problem is what style formatter to use.
>
>jstyle - has at least 3 bugs (one that will cause compile errors)
>astyle - I think it's ok (but there was something I didn't like about, I
>can't remember what it was)
>
>any other choices...?

Straight high-powered UNIX shell script. Things like jstyle and astyle try 
to accommodate everyone; in this case we know exactly what we want. In any 
case, 90% of it has to do with removing tabs and adjusting indents.

However, my first choice would be astyle. It's C++ and not Java, so it's 
self-contained. And why re-invent the wheel? The main advantage of shell 
scripts is that it is guaranteed to be something we can do, in the event 
that the maintainers of Icarus (? the new CVS box?) aren't keen on 
introducing new binaries. I'll check into this, though, and see what our 
options are.
 
This is also an excellent opportunity to also clean up our license references.

Regards,
Arved

Fairly Senior Software Type
e-plicity (http://www.e-plicity.com)
Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Tue, 17 Jul 2001 11:36:00 Arved Sandstrom wrote:
> I should have said, _one_ of the text editors I use does that. :-) Using 
> another text editor I am as guilty as the next fellow (although I have to
> 
> look more closely; the editor may be able to do the conversion).
> 
> We should, in theory, be able to use the cvswrappers mechanism (or module
> 
> options) to run a style tool on a file when it is committed (or in a
> number 
> of other cases). I can investigate this. I'd suggest that we divvy up the
> 
> existing code, and use style tools of our choice, in our working copies,
> to 
> clean up the code, and re-commit; future commits can be adjusted using
> the 
> cvswrappers mechanism.

I wasn't trying to pick on anyone, it just seems to be a non-improving
situation.

I think that would be better to do it all at once and use the wrappers. The
only problem is what style formatter to use.

jstyle - has at least 3 bugs (one that will cause compile errors)
astyle - I think it's ok (but there was something I didn't like about, I
can't remember what it was)

any other choices...?




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Tore Engvig <te...@manamind.com>.

On Tue, 17 Jul 2001, Arved Sandstrom wrote:

> We should, in theory, be able to use the cvswrappers mechanism (or module
> options) to run a style tool on a file when it is committed (or in a number
> of other cases). I can investigate this. I'd suggest that we divvy up the
> existing code, and use style tools of our choice, in our working copies, to
> clean up the code, and re-commit; future commits can be adjusted using the
> cvswrappers mechanism.

I tried that on the repository at work once but found it troublesome.
Don't quite remember what the problem was, but remembers vaguely that it
wasn't straightforward for cvswrapper to (read/write)access the actual
file that's committed.

Another thing is that it's just a little scary to have something which
possibly destroys what you commit to cvs - I would prefer that what I
commit to cvs goes there unaltered (on the other hand it would be A Good
Thing to have some codeformatter to blame my bugs on :)

I guess we have to use codeformatters (eg astyle) before we check in our
code.

I happend to grab a copy of jIndent while it still was free. jIndent does
more than just codeformatting, it parses the code and is able to change a
lot of things (eg bracket style, set a max linelength, etc).

I could reformat the whole repository with jIndent, then we could continue
with using astyle or some other free codeformatter as we go.

Just pick a day. It would be best if everybody have checked in their
changes before reformatting the whole source (and I guess I should tag
the repository before reformatting).


Tore


 >
> Regards,
> Arved
>
> Fairly Senior Software Type
> e-plicity (http://www.e-plicity.com)
> Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
> For additional commands, email: fop-dev-help@xml.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Arved Sandstrom <Ar...@chebucto.ns.ca>.
At 08:29 AM 7/17/01 +0200, Keiron Liddle wrote:
>>>From what I have seen so far we are never going to get a common code style.
>I usually format the code but that doesn't mean it will stay that way and
>there are a lot of files. eg. Arved committed in some of the Marker code
>with tabs to replace the spaces (musn't have been using the right text
>editor).

I should have said, _one_ of the text editors I use does that. :-) Using 
another text editor I am as guilty as the next fellow (although I have to 
look more closely; the editor may be able to do the conversion).

We should, in theory, be able to use the cvswrappers mechanism (or module 
options) to run a style tool on a file when it is committed (or in a number 
of other cases). I can investigate this. I'd suggest that we divvy up the 
existing code, and use style tools of our choice, in our working copies, to 
clean up the code, and re-commit; future commits can be adjusted using the 
cvswrappers mechanism.

Regards,
Arved

Fairly Senior Software Type
e-plicity (http://www.e-plicity.com)
Wireless * B2B * J2EE * XML --- Halifax, Nova Scotia


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Code Style, was Re: PDF serialization

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Tue, 17 Jul 2001 01:22:38 Arved Sandstrom wrote:
> At 09:26 PM 7/16/01 +1000, Mark wrote:
> > As an aside: is there a style guide for FOP code? I must say I find the
> >style and layout very confusing and I'm happy to clean things up as I
> go.
> >At the moment I can't even work out what tab stop size people are using.
> >(In my own work I use 8 character tabs with 2 character indenting).
> 
> Yep. http://xml.apache.org/source.html references the Sun Java coding 
> conventions, at http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html.
> 
> An interesting point that comes out of the coding conventions is that
> while 
> Sun instructs us that tabs must be 8 spaces, they also state that the
> unit 
> of indentation is 4 spaces.
> 
> Seems to me that the easiest way to avoid problems is never to leave tabs
> in 
> the code - I use a text editor that is set to 4 spaces per tab and 
> immediately translates tabs to spaces.
> 
> We are well past the point where we should take a style tool to the whole
> codebase, strip out all tabs, and re-commit the whole thing. :-)

>From what I have seen so far we are never going to get a common code style.
I usually format the code but that doesn't mean it will stay that way and
there are a lot of files. eg. Arved committed in some of the Marker code
with tabs to replace the spaces (musn't have been using the right text
editor).



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org