How to enforce coding style conventions | | |
Hi,
As my company is moving into C# they are enforcing the use of styling
convention in the source code, such as methods naming conventions, newlines,
etc.
Does someone know of products that are good at this job? (free and/or
commercial) | | | | re: How to enforce coding style conventions
Ron Burd <rburd@hexacta.com> wrote:[color=blue]
> As my company is moving into C# they are enforcing the use of styling
> convention in the source code, such as methods naming conventions, newlines,
> etc.
>
> Does someone know of products that are good at this job? (free and/or
> commercial)[/color]
Have you tried FxCop? http://www.gotdotnet.com/team/fxcop/
--
Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too | | | | re: How to enforce coding style conventions
I am aware of FxCop, but AFAIK it does its chking through introspection
(reflection) of the Exe or Dll.
How can I make FxCop check my source code?
Per example (note the braces):
If we want to ensure that the code is written in the following style:
if ( something == true) {
...
}
instead of
if (something ==true)
{
...
}
or that constants are named using All-Caps letters.
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1afc67346335611e98a7e0@msnews.microsoft.c om...[color=blue]
> Ron Burd <rburd@hexacta.com> wrote:[color=green]
> > As my company is moving into C# they are enforcing the use of styling
> > convention in the source code, such as methods naming conventions,[/color][/color]
newlines,[color=blue][color=green]
> > etc.
> >
> > Does someone know of products that are good at this job? (free and/or
> > commercial)[/color]
>
> Have you tried FxCop?
>
> http://www.gotdotnet.com/team/fxcop/
>
> --
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too[/color] | | | | re: How to enforce coding style conventions
>As my company is moving into C# they are enforcing the use of styling[color=blue]
>convention in the source code, such as methods naming conventions, newlines,
>etc.
>
>Does someone know of products that are good at this job? (free and/or
>commercial)[/color]
Microsoft FxCop is quite good at pointing out cases where programmers
don't follow the conventions. And it can be extended to include your
own rules and checks. And it's FREE ! http://www.gotdotnet.com/team/fxcop/
Marc
================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch | | | | re: How to enforce coding style conventions http://www.flexisoftsolutions.com/Pr...M2004.aspx?m=3
"Ron Burd" <rburd@hexacta.com> wrote in message
news:ufJcjarLEHA.808@tk2msftngp13.phx.gbl...[color=blue]
> Hi,
>
> As my company is moving into C# they are enforcing the use of styling
> convention in the source code, such as methods naming conventions,[/color]
newlines,[color=blue]
> etc.
>
> Does someone know of products that are good at this job? (free and/or
> commercial)
>
>[/color] | | | | re: How to enforce coding style conventions
I am aware of FxCop, but AFAIK it does its chking through introspection
(reflection) of the Exe or Dll.
How can I make FxCop check my source code?
Per example (note the braces):
If we want to ensure that the code is written in the following style:
if ( something == true) {
...
}
instead of
if (something ==true)
{
...
}
or that constants are named using All-Caps letters. THIS_IS_A_CONSTANT
"Ron Burd" <rburd@hexacta.com> wrote in message
news:ufJcjarLEHA.808@tk2msftngp13.phx.gbl...[color=blue]
> Hi,
>
> As my company is moving into C# they are enforcing the use of styling
> convention in the source code, such as methods naming conventions,[/color]
newlines,[color=blue]
> etc.
>
> Does someone know of products that are good at this job? (free and/or
> commercial)
>
>[/color] | | | | re: How to enforce coding style conventions
Ron Burd <rburd@hexacta.com> wrote:[color=blue]
> I am aware of FxCop, but AFAIK it does its chking through introspection
> (reflection) of the Exe or Dll.
> How can I make FxCop check my source code?
>
> Per example (note the braces):
>
> If we want to ensure that the code is written in the following style:
>
> if ( something == true) {
> ...
> }
>
> instead of
>
> if (something ==true)
> {
> ...
> }[/color]
I don't believe it can do that, no. I don't know of a .NET tool which
does allow that.
[color=blue]
> or that constants are named using All-Caps letters.[/color]
That one *can* be done in FxCop, as constants are available through
reflection.
--
Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too | | | | re: How to enforce coding style conventions
Try out FxCop (free): http://www.gotdotnet.com/team/fxcop/
--
Scott http://www.OdeToCode.com
On Fri, 30 Apr 2004 10:23:35 -0300, "Ron Burd" <rburd@hexacta.com>
wrote:
[color=blue]
>Hi,
>
>As my company is moving into C# they are enforcing the use of styling
>convention in the source code, such as methods naming conventions, newlines,
>etc.
>
>Does someone know of products that are good at this job? (free and/or
>commercial)
>[/color] | | | | re: How to enforce coding style conventions
OK, I know this is Off-Topic, but why would ANYONE prefer the former to
the latter?
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!)
"Ron Burd" <rburd@hexacta.com> wrote in message
news:Oq2G$wrLEHA.3712@TK2MSFTNGP11.phx.gbl...[color=blue]
> Per example (note the braces):
>
> If we want to ensure that the code is written in the following style:
> if ( something == true) {
> ...
> }
>
> instead of
>
> if (something ==true)
> {
> ...
> }
>[/color] | | | | re: How to enforce coding style conventions
James Curran wrote:
[color=blue]
> OK, I know this is Off-Topic, but why would ANYONE prefer the former to
> the latter?
>[/color]
Why does anyone prefer Country music to the Blues?
--
mikeb | | | | re: How to enforce coding style conventions
James,
in the mid '80s, there were two equally popular styles (at least in the
group of 100 or so programmers that I was a member of)
[color=blue]
> if ( something == true) {
> ...
> }[/color]
and
[color=blue]
> if (something ==true)
> {
> ...
> }[/color]
The later wastes space - one line with ONE character on it!
You've been around a while - I find it hard to believe that you have not
seen it, or used it, or worked on a job and knew someone that used to know a
programmer that used to do it that way! I've known programmers that would
spend 30 minutes or so reformatting substantial portions of a project from
one style to the other before they would touch a line of code.
regards
roy fine
"James Curran" <JamesCurran@mvps.org> wrote in message
news:eImk6LvLEHA.3944@tk2msftngp13.phx.gbl...[color=blue]
> OK, I know this is Off-Topic, but why would ANYONE prefer the former[/color]
to[color=blue]
> the latter?
>
> --
> Truth,
> James Curran
> Home: www.noveltheory.com Work: www.njtheater.com
> Blog: www.honestillusion.com Day Job: www.partsearch.com
> (note new day job!)
> "Ron Burd" <rburd@hexacta.com> wrote in message
> news:Oq2G$wrLEHA.3712@TK2MSFTNGP11.phx.gbl...[color=green]
> > Per example (note the braces):
> >
> > If we want to ensure that the code is written in the following style:
> > if ( something == true) {
> > ...
> > }
> >
> > instead of
> >
> > if (something ==true)
> > {
> > ...
> > }
> >[/color]
>
>[/color] | | | | re: How to enforce coding style conventions
James Curran wrote:
[color=blue]
> OK, I know this is Off-Topic, but why would ANYONE prefer the former to
> the latter?[/color]
I prefer it as it places less emphasis on individual code blocks within
a method.
Here's an example of the _K&R bracing style_ in use:
void Foo()
{
if (something) {
DoSomething();
} else {
DoSomethingElse();
}
} | | | | re: How to enforce coding style conventions
[quote=The later wastes space - one line with ONE character on it!
[/quote]
ROFLOL - this is funny stuff! Are you sure you're not a ghost writer
for Dilbert? I can just hear the pointy-haired boss now: "We've
going to start allocating lines of code - use them wisely". | | | | re: How to enforce coding style conventions
Jimi <jimi_with_an_i@yahoo-dot-ca.no-spam.invalid> wrote:[color=blue]
> [quote=The later wastes space - one line with ONE character on it!
> [/quote]
>
> ROFLOL - this is funny stuff! Are you sure you're not a ghost writer
> for Dilbert? I can just hear the pointy-haired boss now: "We've
> going to start allocating lines of code - use them wisely".[/color]
Well, one of the reasons I believe K&R became popular was because it
was used in books - and in books, vertical space *is* a relatively
precious commodity. People copy what's written in books, and thus a
tradition is born...
--
Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too | | | | re: How to enforce coding style conventions
Jon Skeet [C# MVP] wrote:
[color=blue]
> Well, one of the reasons I believe K&R became popular was because it
> was used in books - and in books, vertical space *is* a relatively
> precious commodity. People copy what's written in books, and thus a
> tradition is born...[/color]
Personally, I don't know much about K&R's coming into being, but it's
interesting to note that Linus Torvalds states the rationale of using
K&R bracing style in the Linux source code as: "K&R", but goes on to say:
"Also, note that this brace-placement also minimizes the number of empty
(or almost empty) lines, without any loss of readability. Thus, as the
supply of new-lines on your screen is not a renewable resource (think
25-line terminal screens here), you have more empty lines to put
comments on." http://pantransit.reptiles.org/prog/CodingStyle.html
Sure, Linus most likely didn't invent this bracing style, but I'd bet
that he's influenced many a person with his work ;-)
Also, in my opinion, the K&R bracing style makes C-like code more
similar to code from other languages that don't have the flexible block
begin/end markers that C has. Consider the following BASIC code:
If Something Then
DoSomething
Else
DoSomethingElse
End If
This is more equivalent to:
if (something) {
DoSomething();
} else {
DoSomethingElse();
}
.... than:
if (something)
{
DoSomething();
}
else
{
DoSomethingElse();
}
Due to this, I'd imagine that K&R would feel somewhat normal to BASIC
programmers who are picking up a C-like language. | | | | re: How to enforce coding style conventions
"Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
news:eCRxXGyLEHA.3956@TK2MSFTNGP10.phx.gbl...[color=blue]
> James,
>
> in the mid '80s, there were two equally popular styles (at least in the
> group of 100 or so programmers that I was a member of)
>[color=green]
> > if ( something == true) {
> > ...
> > }[/color]
>
> and
>[color=green]
> > if (something ==true)
> > {
> > ...
> > }[/color]
>
> The later wastes space - one line with ONE character on it![/color]
I, personally, prefer the latter. In this day and age, nobody
really worries much about disk space, etc., and if I worked
for a company that enforced the former, I would just write my
own tools to format the code either way. That way I could
write mine so that it is readable to me, then just convert it
to their (horrible) format before anyone else had a look at it.
I could also format anyone else's to the way I like to see it
until I was done examining it, then delete my copy of the code.
In fact, one of the first things I challenged myself to do in C#
was to do this very thing. I refuse to work with code that is
written like the former. Period!
Just my two cents... | | | | re: How to enforce coding style conventions
Gary Morris wrote:
[color=blue]
> I, personally, prefer the latter. In this day and age, nobody
> really worries much about disk space, etc., and if I worked
> for a company that enforced the former, I would just write my
> own tools to format the code either way. That way I could
> write mine so that it is readable to me, then just convert it
> to their (horrible) format before anyone else had a look at it.
> I could also format anyone else's to the way I like to see it
> until I was done examining it, then delete my copy of the code.
>
> In fact, one of the first things I challenged myself to do in C#
> was to do this very thing. I refuse to work with code that is
> written like the former. Period!
>
> Just my two cents...[/color]
It seems that people here have a strong dislike for K&R-style bracing.
Before I'd ever tried the style, I felt much the same about it. I used
to wonder why anyone would ever want to use such a style. It just
seemed to make code hard-to-read. The style I was accustomed to would
make code look so much nicer.
Anyway, one day I was interested in submitting code to a particular
open-source project. K&R bracing style was used throughout the project.
I decided that my dislike for the style wouldn't get in the way of my
desire to add to the project, so I grinned and beared it.
I then got used to K&R style and, having done so, felt that it actually
makes code more readable.
The point I'm trying to make here is that I hated it until I really had
to try it and get used to it. However, it's still probably not for
everyone.
This is just my counter two cents :-) | | | | re: How to enforce coding style conventions
"Gary Morris" <gwmorris1@hotpop.com> wrote in message
news:O$jPbA8LEHA.2676@TK2MSFTNGP10.phx.gbl...[color=blue]
> "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
> news:eCRxXGyLEHA.3956@TK2MSFTNGP10.phx.gbl...[color=green]
> >
> > The later wastes space - one line with ONE character on it![/color]
>
> I, personally, prefer the latter. In this day and age, nobody
> really worries much about disk space, etc., and if I worked
> for a company that enforced the former, I would just write my
> own tools to format the code either way. That way I could
> write mine so that it is readable to me, then just convert it
> to their (horrible) format before anyone else had a look at it.
> I could also format anyone else's to the way I like to see it
> until I was done examining it, then delete my copy of the code.
>
> In fact, one of the first things I challenged myself to do in C#
> was to do this very thing. I refuse to work with code that is
> written like the former. Period!
>
> Just my two cents...
>
>[/color]
It is NEVER about disk space - it is about code maintenance and general
coding style. Depending on the font that you use, you get a fixed number of
lines of code on the screen. There are some recommendations about by
leaders in the field indicating that you should try to get individual code
units down to one screen of code - and a very strong suggestion of no more
than two.
Once you get over petty presonal differences, some white space is needed for
readability, all other is just wasted space. But as many who eschew any
Style at all would intimate, all style rules are but petty presonal
preferences.
roy fine | | | | re: How to enforce coding style conventions
I used to think K&R was satanically insipired as well, but once you are forced to use it a while you find that it has some distinct advantages
Especially when you abstract them to other structures beign spread across lines
if(blah)
isn't really much different
but when you start doin
if
bla
|| bla
|| blah
and
public int Foo ( int blah
int blah
int blah
You'll find that K&R is easier to keep a single "style" that fits more than just {}
Of course in the end, it's a purely religious arguemnt for most people, I.E. mine is great and your sucks, but with no ratinnal thought involved
Caladin | | | | re: How to enforce coding style conventions
Agreed, and duly noted :)
I just cannot stand to try and read code like that. Again,
period.
"Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
news:u6UgQEGMEHA.3292@TK2MSFTNGP11.phx.gbl...[color=blue]
>
> "Gary Morris" <gwmorris1@hotpop.com> wrote in message
> news:O$jPbA8LEHA.2676@TK2MSFTNGP10.phx.gbl...[color=green]
> > "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
> > news:eCRxXGyLEHA.3956@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > >
> > > The later wastes space - one line with ONE character on it![/color]
> >
> > I, personally, prefer the latter. In this day and age, nobody
> > really worries much about disk space, etc., and if I worked
> > for a company that enforced the former, I would just write my
> > own tools to format the code either way. That way I could
> > write mine so that it is readable to me, then just convert it
> > to their (horrible) format before anyone else had a look at it.
> > I could also format anyone else's to the way I like to see it
> > until I was done examining it, then delete my copy of the code.
> >
> > In fact, one of the first things I challenged myself to do in C#
> > was to do this very thing. I refuse to work with code that is
> > written like the former. Period!
> >
> > Just my two cents...
> >
> >[/color]
>
> It is NEVER about disk space - it is about code maintenance and general
> coding style. Depending on the font that you use, you get a fixed number[/color]
of[color=blue]
> lines of code on the screen. There are some recommendations about by
> leaders in the field indicating that you should try to get individual code
> units down to one screen of code - and a very strong suggestion of no more
> than two.
>
> Once you get over petty presonal differences, some white space is needed[/color]
for[color=blue]
> readability, all other is just wasted space. But as many who eschew any
> Style at all would intimate, all style rules are but petty presonal
> preferences.
>
> roy fine
>
>
>[/color] | | | | re: How to enforce coding style conventions
"C# Learner" <csharp@learner.here> wrote in message
news:OKRmdoCMEHA.2068@TK2MSFTNGP11.phx.gbl...
[color=blue]
> Anyway, one day I was interested in submitting code to a particular
> open-source project. K&R bracing style was used throughout the project.
> I decided that my dislike for the style wouldn't get in the way of my
> desire to add to the project, so I grinned and beared it.[/color]
My experience is the exact opposite. Learning C in the early 80's, I
used the K&R style, because everyone did --- it was just the way things were
done.
A few years later, a changed companies, and the new one mandated the
other code style. I resisted for about 2 days. Then I realized that the
code was so much easier to follow then you didn't have to pause to mentally
unwrap it.
(I had a similar revelation a bit later, when I discovered it's far easier
to read an if() statement, if you don't include an assignment in it, that
is,
prefer:
x = GetValue();
if (x!=0)
{....
over:
if ((x=GetValue())!=0)
and by far over:
if (x=GetValue())
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!) | | | | re: How to enforce coding style conventions
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1afdee8692fa069e98a7fd@msnews.microsoft.c om...[color=blue]
> Well, one of the reasons I believe K&R became popular was because it
> was used in books - and in books, vertical space *is* a relatively
> precious commodity. People copy what's written in books, and thus a
> tradition is born...
>[/color]
The problem with the "save a line" argument is that it just don't hold
up.
Given the code:
if (x==y) {
ThisFunc();
thatFunc();
OtherFunc();
}
it could still be written as:
if (x==y)
{ ThisFunc();
thatFunc();
OtherFunc();
}
In exactly the same number of lines, and you still get the advantage of the
braces line up.
--
Truth,
James Curran
Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
(note new day job!) | | | | re: How to enforce coding style conventions
James,
read your post again -- it does hold the save a line, and does it quite well
this is the "wasted-line" example
[color=blue]
> if (x==y)
> {
> ThisFunc();
> thatFunc();
> OtherFunc();
> }[/color]
these two show the "save-a-line" :
1)[color=blue]
> if (x==y)
> { ThisFunc();
> thatFunc();
> OtherFunc();
> }[/color]
2)[color=blue]
> if (x==y) {
> ThisFunc();
> thatFunc();
> OtherFunc();
> }[/color]
I am not at all a fan or advocate of style 1 - the world does not need
another style to further split the community.
For what it worth - Visual Studio 2003 editor preferences has an option in
Text Editor | C# | Formatting | Indentation that reads : "Leave open braces
on same line as construct", effectively helping enforce style 2 of above.
My guess is that appeared because of either:
a) someone on the MS VS/C# team wanted that option
b) significant customer requests for the feature
regards
roy fine
"James Curran" <JamesCurran@mvps.org> wrote in message
news:ePWfpmUMEHA.624@TK2MSFTNGP11.phx.gbl...[color=blue]
> "Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
> news:MPG.1afdee8692fa069e98a7fd@msnews.microsoft.c om...[color=green]
> > Well, one of the reasons I believe K&R became popular was because it
> > was used in books - and in books, vertical space *is* a relatively
> > precious commodity. People copy what's written in books, and thus a
> > tradition is born...
> >[/color]
>
> The problem with the "save a line" argument is that it just don't hold
> up.
>
> Given the code:
> if (x==y) {
> ThisFunc();
> thatFunc();
> OtherFunc();
> }
>
> it could still be written as:
> if (x==y)
> { ThisFunc();
> thatFunc();
> OtherFunc();
> }
>
> In exactly the same number of lines, and you still get the advantage of[/color]
the[color=blue]
> braces line up.
>
> --
> Truth,
> James Curran
> Home: www.noveltheory.com Work: www.njtheater.com
> Blog: www.honestillusion.com Day Job: www.partsearch.com
> (note new day job!)
>
>[/color] | | | | re: How to enforce coding style conventions
James Curran wrote:
[color=blue]
> The problem with the "save a line" argument is that it just don't hold
> up.
>
> Given the code:
> if (x==y) {
> ThisFunc();
> thatFunc();
> OtherFunc();
> }
>
> it could still be written as:
> if (x==y)
> { ThisFunc();
> thatFunc();
> OtherFunc();
> }
>
> In exactly the same number of lines, and you still get the advantage of the
> braces line up.
>[/color]
I am a newbie and from my point of view, the latter (2nd) option looks
more pleasing...
Regards
Skc | | | | re: How to enforce coding style conventions
[top-posting fixed][color=blue]
> "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
> news:u6UgQEGMEHA.3292@TK2MSFTNGP11.phx.gbl...[color=green]
> >
> > "Gary Morris" <gwmorris1@hotpop.com> wrote in message
> > news:O$jPbA8LEHA.2676@TK2MSFTNGP10.phx.gbl...[color=darkred]
> > > "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
> > > news:eCRxXGyLEHA.3956@TK2MSFTNGP10.phx.gbl...
> > > >
> > > > The later wastes space - one line with ONE character on it!
> > >
> > > I, personally, prefer the latter. In this day and age, nobody
> > > really worries much about disk space, etc., and if I worked
> > > for a company that enforced the former, I would just write my
> > > own tools to format the code either way. That way I could
> > > write mine so that it is readable to me, then just convert it
> > > to their (horrible) format before anyone else had a look at it.
> > > I could also format anyone else's to the way I like to see it
> > > until I was done examining it, then delete my copy of the code.
> > >
> > > In fact, one of the first things I challenged myself to do in C#
> > > was to do this very thing. I refuse to work with code that is
> > > written like the former. Period!
> > >
> > > Just my two cents...
> > >
> > >[/color]
> >
> > It is NEVER about disk space - it is about code maintenance and general
> > coding style. Depending on the font that you use, you get a fixed[/color][/color]
number[color=blue]
> of[color=green]
> > lines of code on the screen. There are some recommendations about by
> > leaders in the field indicating that you should try to get individual[/color][/color]
code[color=blue][color=green]
> > units down to one screen of code - and a very strong suggestion of no[/color][/color]
more[color=blue][color=green]
> > than two.
> >
> > Once you get over petty presonal differences, some white space is needed[/color]
> for[color=green]
> > readability, all other is just wasted space. But as many who eschew any
> > Style at all would intimate, all style rules are but petty presonal
> > preferences.
> >
> > roy fine
> >
> >[/color][/color]
"Gary Morris" <gwmorris1@hotpop.com> wrote in message
news:e%23jatOLMEHA.2628@TK2MSFTNGP12.phx.gbl...[color=blue]
> Agreed, and duly noted :)
> I just cannot stand to try and read code like that. Again,
> period.[/color]
Then you can imagine how the rest of us feel about your top-posting!
--
Mabden | | | | re: How to enforce coding style conventions
FXCOP
On Wed, 05 May 2004 01:45:17 GMT, Mabden <mabden@sbcglobal.net> wrote:
[color=blue]
> [top-posting fixed][color=green]
>> "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
>> news:u6UgQEGMEHA.3292@TK2MSFTNGP11.phx.gbl...[color=darkred]
>> >
>> > "Gary Morris" <gwmorris1@hotpop.com> wrote in message
>> > news:O$jPbA8LEHA.2676@TK2MSFTNGP10.phx.gbl...
>> > > "Roy Fine" <rlfine@twt.obfuscate.net> wrote in message
>> > > news:eCRxXGyLEHA.3956@TK2MSFTNGP10.phx.gbl...
>> > > >
>> > > > The later wastes space - one line with ONE character on it!
>> > >
>> > > I, personally, prefer the latter. In this day and age, nobody
>> > > really worries much about disk space, etc., and if I worked
>> > > for a company that enforced the former, I would just write my
>> > > own tools to format the code either way. That way I could
>> > > write mine so that it is readable to me, then just convert it
>> > > to their (horrible) format before anyone else had a look at it.
>> > > I could also format anyone else's to the way I like to see it
>> > > until I was done examining it, then delete my copy of the code.
>> > >
>> > > In fact, one of the first things I challenged myself to do in C#
>> > > was to do this very thing. I refuse to work with code that is
>> > > written like the former. Period!
>> > >
>> > > Just my two cents...
>> > >
>> > >
>> >
>> > It is NEVER about disk space - it is about code maintenance and[/color]
>> general[color=darkred]
>> > coding style. Depending on the font that you use, you get a fixed[/color][/color]
> number[color=green]
>> of[color=darkred]
>> > lines of code on the screen. There are some recommendations about by
>> > leaders in the field indicating that you should try to get individual[/color][/color]
> code[color=green][color=darkred]
>> > units down to one screen of code - and a very strong suggestion of no[/color][/color]
> more[color=green][color=darkred]
>> > than two.
>> >
>> > Once you get over petty presonal differences, some white space is[/color]
>> needed
>> for[color=darkred]
>> > readability, all other is just wasted space. But as many who eschew[/color]
>> any[color=darkred]
>> > Style at all would intimate, all style rules are but petty presonal
>> > preferences.
>> >
>> > roy fine
>> >
>> >[/color][/color]
>
> "Gary Morris" <gwmorris1@hotpop.com> wrote in message
> news:e%23jatOLMEHA.2628@TK2MSFTNGP12.phx.gbl...[color=green]
>> Agreed, and duly noted :)
>> I just cannot stand to try and read code like that. Again,
>> period.[/color]
>
> Then you can imagine how the rest of us feel about your top-posting!
>[/color]
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ | | | | re: How to enforce coding style conventions
Wow!!! I can't believe how this thread has evolved!
Anyway, thank you guys for the help!
"Ron Burd" <rburd@hexacta.com> wrote in message
news:ufJcjarLEHA.808@tk2msftngp13.phx.gbl...[color=blue]
> Hi,
>
> As my company is moving into C# they are enforcing the use of styling
> convention in the source code, such as methods naming conventions,[/color]
newlines,[color=blue]
> etc.
>
> Does someone know of products that are good at this job? (free and/or
> commercial)
>
>[/color] | | | | re: How to enforce coding style conventions
Roy Fine wrote:[color=blue][color=green]
> > if (something ==true)
> > {
> > ...
> > }[/color]
>
> The later wastes space - one line with ONE character on it![/color]
Are you referring to the "{" or the "}"? If you want to at least be
consistent, you should propose:
if (something) {
DoStuff ();
Do MoreStuff(); }
Hilton | | | | re: How to enforce coding style conventions
Hilton wrote:
[color=blue]
> Roy Fine wrote:
>[color=green][color=darkred]
>>>if (something ==true)
>>>{
>>> ...
>>>}[/color]
>>
>>The later wastes space - one line with ONE character on it![/color]
>
> Are you referring to the "{" or the "}"? If you want to at least be
> consistent, you should propose:
>
> if (something) {
> DoStuff ();
> Do MoreStuff(); }[/color]
So I guess that VB programmers aren't being consistent unless they write:
If Something Then
DoSomething End If
Right? ;-) |  | Similar C# / C Sharp bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,383 network members.
|