473,385 Members | 1,218 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,385 software developers and data experts.

Writing Solid Code

100
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
Nov 15 '05 #1
9 2919
"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

Nov 15 '05 #2
100 <10*@100.com> wrote:

<snip>
So, do you think just because this book was writen several years ago, when
c# wasn't there this makes the ideas in the book not applicable in c#?


Note that I've never suggested that *none* of the ideas in the book
aren't applicable to C# - I've just argued against taking them
wholesale, when the reasons for some are no longer applicable.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #3
Jon Skeet <sk***@pobox.com> wrote:
So, do you think just because this book was writen several years ago, when
c# wasn't there this makes the ideas in the book not applicable in c#?


Note that I've never suggested that *none* of the ideas in the book
aren't applicable to C#


Oops - double negative there. I've never suggested that none of the
ideas in the book *are* applicable to C#. Sorry about that typo :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #4
100
Thank you guys.
I see that I wasn't express my intention in a right way.
Actually I wasn't lookin for any help. This was most like a survey.
I wanted to find out if there still people like me that believe reading
theoretical books are as good as reading more practical ones.
I think I've been long enough in the programing (my first program was for an
8-bit computer) and long time ago I found that progamming is not like
writing a poetry.
Unfortuantely, reading the posts in the news groups (I'n not speeking about
this particular one) I've got the impression that I think too much when
writing my programs.

B\rgds
100
"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

Nov 15 '05 #5
100
;))))) Don't worry about typos, Jon. I won't note them. In my language
double negatives are legal and they are the only way to to make negatice
sentances. To avoid them, when I speak English, is realy hard to me.

B\rgds
100
"Jon Skeet" <sk***@pobox.com> wrote in message
news:MP************************@news.microsoft.com ...
Jon Skeet <sk***@pobox.com> wrote:
So, do you think just because this book was writen several years ago, when c# wasn't there this makes the ideas in the book not applicable in c#?


Note that I've never suggested that *none* of the ideas in the book
aren't applicable to C#


Oops - double negative there. I've never suggested that none of the
ideas in the book *are* applicable to C#. Sorry about that typo :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

Nov 15 '05 #6
100 <10*@100.com> wrote:
Actually I wasn't lookin for any help. This was most like a survey.
I wanted to find out if there still people like me that believe reading
theoretical books are as good as reading more practical ones.
But you didn't ask that - you asked whether it was worth using a
specific C idiom in C#.

I have nothing against reading theoretical books - two of my favourites
are "Design Patterns" and "Refactoring" - but that doesn't mean I can't
think it's a bad idea to use an idiom which gets round a specific C/C++
issue in C#, where the issue doesn't apply.
I think I've been long enough in the programing (my first program was for an
8-bit computer)


The latter bit is true for me as well, and I suspect I'm younger than
most on this group. (I'm certainly younger than most regulars on the
Java newsgroups, or was when we last took a straw poll.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #7
I don't think that the problem is that you 'think too much' when writing
your programs
the problem is with others who are of the belief that their way of thinking
is gospel and that anyone who strays from the true path must be converted
at all cost.
"100" <10*@100.com> wrote in message
news:ut**************@TK2MSFTNGP10.phx.gbl...
Thank you guys.
I see that I wasn't express my intention in a right way.
Actually I wasn't lookin for any help. This was most like a survey.
I wanted to find out if there still people like me that believe reading
theoretical books are as good as reading more practical ones.
I think I've been long enough in the programing (my first program was for an 8-bit computer) and long time ago I found that progamming is not like
writing a poetry.
Unfortuantely, reading the posts in the news groups (I'n not speeking about this particular one) I've got the impression that I think too much when
writing my programs.

B\rgds
100
"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


Nov 15 '05 #8
I think other replies have indicated that C# is a world away from C++, and
so some of Maguires "how" examples, such as the "if" examples you give below
are no longer relevant.

*However* - I think Maguires original "why" concepts are just as valid as
ever. Generally, he talks about concepts such as:
- Find bugs early, not later (testers find bugs by luck, developers can find
bugs intentionally)
- Let the compiler find bugs for you (the if's etc)
- Developers should know what they mean, and mean what the know (ASSERTs,
contracts, error trapping-not error hiding)

I'm a project lead for a fairly large C# application, and Maguires book is
almost required reading for all developers (we currently only 'highly
encourage' people to read it).

His general concepts are spot on - C# developers just need to find different
"hows" to acheive his "whys".

My 2cents,
Rob.

"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

Nov 15 '05 #9
100
Thanks Robert,
I couldn't express my thoughts as well as you did.
Thanx a lot.
B\rgds
100

"Robert Hooker" <rh*****@rhooker.com> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...
I think other replies have indicated that C# is a world away from C++, and
so some of Maguires "how" examples, such as the "if" examples you give below are no longer relevant.

*However* - I think Maguires original "why" concepts are just as valid as
ever. Generally, he talks about concepts such as:
- Find bugs early, not later (testers find bugs by luck, developers can find bugs intentionally)
- Let the compiler find bugs for you (the if's etc)
- Developers should know what they mean, and mean what the know (ASSERTs,
contracts, error trapping-not error hiding)

I'm a project lead for a fairly large C# application, and Maguires book is
almost required reading for all developers (we currently only 'highly
encourage' people to read it).

His general concepts are spot on - C# developers just need to find different "hows" to acheive his "whys".

My 2cents,
Rob.

"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


Nov 15 '05 #10

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

Similar topics

40
by: post400 | last post by:
Hi, there is another famous book 'Writing solid code' but does it apply to Python ? Or it's usable only by Microsoft C programmers ? The author seems to be an ex-Microsoft guy ! Thanks ,...
7
by: The Directive | last post by:
How do you make your code bulletproof? For example, I make my function bulletproof by validating every argument passed to the function. I ensure the arguments are within the expected ranges. This...
6
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and help me finding the reason why this rabish is being...
7
by: John Pote | last post by:
Hello, help/advice appreciated. Background: I am writing some web scripts in python to receive small amounts of data from remote sensors and store the data in a file. 50 to 100 bytes every 5 or...
4
by: slahiri | last post by:
I am writing an I/O utility in C that accepts requests over a socket connection and persists the data that can be read by other processes. There could be data coming from hundreds of client...
15
by: Tommy B | last post by:
I was wondering if there was a way to take a txt file and, while keeping most of it, replace only one line. See, I'd have a file like: Tommy 555 Bob 62 Joe 529 And I'd want to set it to be:...
3
by: planetthoughtful | last post by:
Hi All, I'm building a Windows Form application that will use a Microsoft Access mdb file as a data store. I have a section of code that is executed when the main form is closed that _should_...
34
by: Victor Kryukov | last post by:
Hello list, our team is going to rewrite our existing web-site, which has a lot of dynamic content and was quickly prototyped some time ago. Today, as we get better idea of what we need, we're...
7
by: jacob navia | last post by:
There are some people here (let's call them "regulars" for short) that are always giving lessons to people about how easy is to write portable code, etc. They always point fingers at you telling...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.