"Writing Solid Code" is a superb book; I read it a few years ago and it's
still in my library. Although it's written with C in mind, not C#, it
describes many principles that would apply to any language or development
environment. Obviously in those cases where a recommendation is a
workaround for a language issue that's very specific to C, you have to adapt
it to C# or whatever you're using; it's just a matter of common sense. In
some cases the adaptation may be to not use it at all.
As for bringing C/C++ idioms into the C# language, *if* you are looking for
some kind of ideological "language purity" you are missing the point, IMO.
If it's an idiom that makes C# code more "solid", then it is appropriate for
C#, whether or not it happens to also be appropriate for C/C++. Again, use
common sense. And as with any author, use what you agree with from the
book, and don't use what you aren't comfortable with. No one, especially
Mr. Maguire, is holding a gun to your head ;-)
By the way, assertions are natively supported in C# -- see the
Debug.Assert() and Trace.Assert() methods. They are not a "trick" or
gimmick and are not language-specific, though some languages have better
built-in support for them than others. Asserts are a great tool for bug
prevention.
--Bob
"100" <10*@100.com> wrote in message
news:uU*************@TK2MSFTNGP10.phx.gbl...
Has anybody read Steve Maguire's book "Writing solid code"?
Do you think that the ideas in this book are not applicable in c#
language? Does anybody find
if(2 == i)
istead of
if(i == 2)
as unnetural and does it lead to more bugs in the code because of it makes
programms hard to read.
And my last question is: "Do you think that using boolean expressions
written in this way, asserts and all other *tricks* mentioned in the book
is bringing c/c++ *idioms* in the c# language?"
B\rgds
100