473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

IDesign C# coding std 1.81, topic 3.21

Hi

Topic 3.21 in <http://www.idesign.net/idesign/download/IDesign%20CSharp%20Coding%20Standard.zip> claims the following

"Release build should contain debug symbols

I wonder why. Doesn't this make the executable larger, and slower

Thanks
Tom.
Nov 16 '05 #1
16 1861
TT (Tom Tempelaere) <"=?Utf-8?B?VFQgKFRvbSBUZW1wZWxhZXJlKQ==?=" <_N_
0SPA|/\|t*******@hotmail.com|/\|APS0_N_>> wrote:
Topic 3.21 in
<http://www.idesign.net/idesign/downl...arp%20Coding%2
0Standard.zip> claims the following:

"Release build should contain debug symbols"

I wonder why. Doesn't this make the executable larger, and slower?


It's a shame it doesn't explain things, really.

Mind you, I have to wonder about the usefulness of it when I read:

<quote>
17. Maintain strict indentation
a) Use 3 spaces for indentation
b) Do not use tabs or non-standard indentation like 1, 2 or 4 spaces
</quote>

In what world is 4 spaces *less* standard than 3?

Similarly, separating all member variables from all properties isn't a
good idea, IMO (number 20). If a property is backed by a member in a
simple fashion, it makes sense to declare the two together.

(Still reading the rest...)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
TT (Tom Tempelaere) <"=?Utf-8?B?VFQgKFRvbSBUZW1wZWxhZXJlKQ==?=" <_N_
0SPA|/\|t*******@hotmail.com|/\|APS0_N_>> wrote:
Indeed he doesn't explain things enough. A rationale per topic would
come in handy.
Yup - it would also make it easier to argue against specific points.
Personally, I use tabs, and each tab is 2 spaces. I haven't seen
anyone use 3 spaces. I have seen people using tabs with a tab being a
single space charachter. Plain ugly when you decide tab to be 2
spaces later on, because you can't see spaces from tabs when 1 tab ==
1 space.
I think I've seen *one* person use 3 spaces before, but it's hardly
standard. A lot of people use 4 spaces, however.
Perhaps he wishes to avoid code layout changes for people who decide
they do not wish a tab to be 2 spaces, but 3 or 4 spaces instead. I
don't know.


The argument of "tabs vs spaces" is a separate one from how much
indentation to use, of course. Personally I use spaces instead of tabs,
so that everyone will see the code in the same way. However, that's an
argument with lots of good reasons on both sides, and not one I
particularly want to get into here.

I don't even really want to comment on whether 3 is a good number of
spaces to use or not. It was the bizarre way that it implied that 3 was
a standard which stunned me.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #3
> 2.1.4
Every 5th Line should contain an Debug.Assert();
Oh my god!
2.3.5
Mark every Public and Protected method as virtual
Stupid.
2.5.55
Always provide a static constructor when providing static member variables
Why? Providing a static ctor means you will have no beforefieldinit set in
the class which means that on first
access of any field, *all* static fields are initialized. But what if I
require lazy initialisation?
2.5.60
Do not use "this"-reference unless you are invoking a ctor from another

ctor

He must be gone crazy. Some other people say you _always_ have to use this.

After reading this sosaid coding standard I created one rules for writers of
coding standards:

1.1.1
Never declare your personal preferences as official standard if over 50% of
other experts have another opinion.

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
Nov 16 '05 #4
Hi,

I'm 4-indent-space-maniac.
I think that 3 spaces of indent are used to kill using a tab character
that are usually visualised as 8 spaces.
There's no other common number other than 24 factor. So how many of Your
code has more than 7 indents?
Maybe it looks sily... but i don't see any other reason :)

Marcin
TT (Tom Tempelaere) <"=?Utf-8?B?VFQgKFRvbSBUZW1wZWxhZXJlKQ==?=" <_N_
0SPA|/\|t*******@hotmail.com|/\|APS0_N_>> wrote:
Indeed he doesn't explain things enough. A rationale per topic would
come in handy.

Yup - it would also make it easier to argue against specific points.

Personally, I use tabs, and each tab is 2 spaces. I haven't seen
anyone use 3 spaces. I have seen people using tabs with a tab being a
single space charachter. Plain ugly when you decide tab to be 2
spaces later on, because you can't see spaces from tabs when 1 tab ==
1 space.

I think I've seen *one* person use 3 spaces before, but it's hardly
standard. A lot of people use 4 spaces, however.

Perhaps he wishes to avoid code layout changes for people who decide
they do not wish a tab to be 2 spaces, but 3 or 4 spaces instead. I
don't know.

The argument of "tabs vs spaces" is a separate one from how much
indentation to use, of course. Personally I use spaces instead of tabs,
so that everyone will see the code in the same way. However, that's an
argument with lots of good reasons on both sides, and not one I
particularly want to get into here.

I don't even really want to comment on whether 3 is a good number of
spaces to use or not. It was the bizarre way that it implied that 3 was
a standard which stunned me.

Nov 16 '05 #5
codymanix <no****************@gmx.net> wrote:
2.3.5
Mark every Public and Protected method as virtual
Stupid.


Indeed, although I've been arguing about this with someone else in
another place. Seems very odd to me.
2.5.55
Always provide a static constructor when providing static member variables


Why? Providing a static ctor means you will have no beforefieldinit set in
the class which means that on first
access of any field, *all* static fields are initialized. But what if I
require lazy initialisation?


In fact, having a static constructor will probably end up giving you
lazier access - from what I've seen, the current CLR is likely to call
the type initializer when it first enters a method which uses any part
of the class.

Note that the idea of different static fields being initialized at
different times just isn't going to happen - there's only one type
initializer per type. (You could manually do it, of course, but that's
a different level from the type initialization one.)
2.5.60
Do not use "this"-reference unless you are invoking a ctor from another

ctor

He must be gone crazy. Some other people say you _always_ have to use this.


Indeed. I'm lazier - I say "Use this when you have to" and I use
variable names which mean that on constructors I usually have to.
Elsewhere I rarely end up using "this" - although there are times when
you want to use it for entirely different reasons, of course.
After reading this sosaid coding standard I created one rules for writers of
coding standards:

1.1.1
Never declare your personal preferences as official standard if over 50% of
other experts have another opinion.


:) Of course, it's very difficult to gauge that "50% of other experts".
Writing a "personal standard" seems to be a better bet, really. Maybe I
should have a go at doing that some time...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
> <quote>
17. Maintain strict indentation
a) Use 3 spaces for indentation
b) Do not use tabs or non-standard indentation like 1, 2 or 4 spaces
</quote>

In what world is 4 spaces *less* standard than 3?


Probably in IDesign's world. I've always approached a coding standards
document as simply a way to make all the code in a particular shop or
project internally consistent. Many decisions have multiple correct choices
and the standards document simply states which correct choice will be used.
It would have been nice if the author had included a preamble to explain the
philosophy and purpose of the document.

Personally the number of spaces people choose for their tabs (as long as it
isn't 1) doesn't drive me nuts nearly as much as old-style ASP programmers
who write code like this:

if b = 1 THEN
' do something
end IF

Unfortunately, that isn't some contrived example. I've actually worked with
code like that (including the variable name 'b' which just happened to be a
global variable).

Colin
Nov 16 '05 #7
Hi CodyManix

----- codymanix wrote: ----
2.1.
Every 5th Line should contain an Debug.Assert()
Oh my god

He writes, "On average, ...". His intent is probably to encourage people to use Debug.Assert to check invariants. He should rephrase that suggestion
2.3.
Mark every Public and Protected method as virtua
Stupid

Indeed, I completely agree. IMHO it is a serious flaw in Java that every method is virtual by default. C# designers made the right decision not to make methods virtual by default
2.5.6
Do not use "this"-reference unless you are invoking a ctor from anothe

cto

He must be gone crazy. Some other people say you _always_ have to use this

Agreed, yet I don't think Juval has gone crazy (just check his books, they are good)

After reading this sosaid coding standard I created one rules for writers o
coding standards

1.1.
Never declare your personal preferences as official standard if over 50% o
other experts have another opinion

Juval never said that this is official, it is the IDesign C# coding standard. It reflects his personal opinions, nothing else. Some are good, others are questionable

-
cod

Freeware Tools, Games and Humou
http://www.deutronium.de.vu || http://www.deutronium.t

Tom Tempelaere.
Nov 16 '05 #8
Jon Skeet [C# MVP] wrote:
[...]
Writing a "personal standard" seems to be a better bet, really. Maybe I
should have a go at doing that some time...


I'd be interested to read it :-)
Nov 16 '05 #9
> In fact, having a static constructor will probably end up giving you
lazier access - from what I've seen, the current CLR is likely to call
the type initializer when it first enters a method which uses any part
of the class.

Note that the idea of different static fields being initialized at
different times just isn't going to happen - there's only one type
initializer per type.
Now I understand. Beforefieldinit does not mean to initialize only fields
that have been accessed but instead
means nothing other than "The system is allowed to call the class
initializer before the first field of that class is accessed"
2.5.60
Do not use "this"-reference unless you are invoking a ctor from
another ctor
He must be gone crazy. Some other people say you _always_ have to use

this.
Indeed. I'm lazier - I say "Use this when you have to" and I use
variable names which mean that on constructors I usually have to.
Elsewhere I rarely end up using "this" - although there are times when
you want to use it for entirely different reasons, of course.


But he is consistent is his Standard. If one always use m_* to mark member
variables,
using "this" is never neccessary. I very often use "this" because of
intellisense so I do not have to type in the "long descriptive names" :)

But I was always wondering why they doesn't have introduced a symbol instead
of "this". $ or @ or ven # would be great.

class Numba
{
int n;
public void Numba(int n)
{
@n=n;
}
}

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #10
cody wrote:

<snip>
Indeed. I'm lazier - I say "Use this when you have to" and I use
variable names which mean that on constructors I usually have to.
Elsewhere I rarely end up using "this" - although there are times when
you want to use it for entirely different reasons, of course.
But he is consistent is his Standard. If one always use m_* to mark member
variables,
using "this" is never neccessary. I very often use "this" because of
intellisense so I do not have to type in the "long descriptive names" :)


No need :-) In VS.NET or C# Builder, just start typing the name then
press CTRL-SPACE.
But I was always wondering why they doesn't have introduced a symbol instead
of "this". $ or @ or ven # would be great.


<snip>

This would've alienated C++ programmers :P
Nov 16 '05 #11
cody <pl*************************@gmx.de> wrote:
Note that the idea of different static fields being initialized at
different times just isn't going to happen - there's only one type
initializer per type.
Now I understand. Beforefieldinit does not mean to initialize only fields
that have been accessed but instead
means nothing other than "The system is allowed to call the class
initializer before the first field of that class is accessed"


Yes, basically - and also, it *doesn't* have to call the type
initializer *unless* a static field is accessed, even if you call a
static method.
Indeed. I'm lazier - I say "Use this when you have to" and I use
variable names which mean that on constructors I usually have to.
Elsewhere I rarely end up using "this" - although there are times when
you want to use it for entirely different reasons, of course.


But he is consistent is his Standard. If one always use m_* to mark member
variables, using "this" is never neccessary.


Actually, it can be - if, say, you want to add "this" to a Hashtable.
That was what I meant by the "entirely different reasons".
But I was always wondering why they doesn't have introduced a symbol instead
of "this". $ or @ or ven # would be great.


Bad for readability, IMO.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #12
> >>Indeed. I'm lazier - I say "Use this when you have to" and I use
variable names which mean that on constructors I usually have to.
Elsewhere I rarely end up using "this" - although there are times when
you want to use it for entirely different reasons, of course.


But he is consistent is his Standard. If one always use m_* to mark member variables,
using "this" is never neccessary. I very often use "this" because of
intellisense so I do not have to type in the "long descriptive names" :)


No need :-) In VS.NET or C# Builder, just start typing the name then
press CTRL-SPACE.


Interesting, I didn't know that. This renders the keyword "this" almost
useless..
But I was always wondering why they doesn't have introduced a symbol instead of "this". $ or @ or ven # would be great.


<snip>

This would've alienated C++ programmers :P


Who cares...Who isn't able to learn new stuff is not worth to be a
programmer..

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #13
> > But he is consistent is his Standard. If one always use m_* to mark
member
variables, using "this" is never neccessary.


Actually, it can be - if, say, you want to add "this" to a Hashtable.
That was what I meant by the "entirely different reasons".
But I was always wondering why they doesn't have introduced a symbol instead of "this". $ or @ or ven # would be great.


Bad for readability, IMO.

You just are not used to it. In lots of other languages like Basic or Perl
or PHP
or whatever it is common to prefix variables with a single character.
Is m_Number or this.Number really easier readable than $Number or #Number or
@Number?

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #14
cody <pl*************************@gmx.de> wrote:
You just are not used to it. In lots of other languages like Basic or Perl
or PHP
or whatever it is common to prefix variables with a single character.
Is m_Number or this.Number really easier readable than $Number or #Number or
@Number?


Well, my immediate reaction is "yes", but then I prefer braces to
"begin" and "end", so you certainly have a point.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #15
> > You just are not used to it. In lots of other languages like Basic or
Perl
or PHP
or whatever it is common to prefix variables with a single character.
Is m_Number or this.Number really easier readable than $Number or #Number or @Number?


Well, my immediate reaction is "yes", but then I prefer braces to
"begin" and "end", so you certainly have a point.

It is just the thing that we are used to it :)
When I switched from Pascal to C++ I hated it using & instead of @ and c->r
instead of ^c.r. But I got used to it.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 16 '05 #16
Jon Skeet [C# MVP] wrote:
cody <pl*************************@gmx.de> wrote:
You just are not used to it. In lots of other languages like Basic or Perl
or PHP
or whatever it is common to prefix variables with a single character.
Is m_Number or this.Number really easier readable than $Number or #Number or
@Number?


Well, my immediate reaction is "yes", but then I prefer braces to
"begin" and "end", so you certainly have a point.


;-)
Nov 16 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bruno R. Dias | last post by:
Perhaps it would be interesting to program a virtual machine simulating an ancient computer (such as the pdp-7). Then, it would be rather interesting to code for it (porting gcc to it maybe?). I...
55
by: Jonas Smithson | last post by:
I've seen a few attractive multi-column sites whose geometry is based on pure CSS-P, but they're what you might call "code afficionado" sites, where the subject matter of the site is "coding...
2
by: Leveridge Systems INC | last post by:
We're in desperate need of contract help for c++/ linux or Unix based talent. 6 month need .. we have budget for a serious coder.. so the dollars are there. anyways.. may be of help to a...
4
by: Mikkel christensen | last post by:
Hi there I wonder if any of you could point me in a direction where I can find some usefull information about coding standarts. I have some generel experiense in programming but I lack many...
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
16
by: TT (Tom Tempelaere) | last post by:
Hi Topic 3.21 in <http://www.idesign.net/idesign/download/IDesign%20CSharp%20Coding%20Standard.zip> claims the following "Release build should contain debug symbols I wonder why. Doesn't...
50
by: Konrad Palczynski | last post by:
I am looking for tool to validate conformity to defined coding standard. I have already found Parasoft's C++ Test, but it is quite expensive. Is there any Open Source alternative? I do not need...
2
by: editormt | last post by:
A recent poll asked if programming standards are used by development organisations... and if they are controlled. None: 20% Yes, but without control: 49% Yes, with control: 31% Participants:...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.