Writing Solid Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • 100

    #1

    Writing Solid Code

    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


  • Bob Grommes

    #2
    Re: Writing Solid Code

    "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" <100@100.com> wrote in message
    news:uUMDsi5TDH A.560@TK2MSFTNG P10.phx.gbl...[color=blue]
    > Has anybody read Steve Maguire's book "Writing solid code"?
    > Do you think that the ideas in this book are not applicable in c#[/color]
    language?[color=blue]
    > 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[/color]
    is[color=blue]
    > bringing c/c++ *idioms* in the c# language?"
    >
    > B\rgds
    > 100
    >
    >[/color]


    Comment

    • Jon Skeet

      #3
      Re: Writing Solid Code

      100 <100@100.com> wrote:

      <snip>
      [color=blue]
      > 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#?[/color]

      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 - <skeet@pobox.co m>
      Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

      If replying to the group, please do not mail me too

      Comment

      • Jon Skeet

        #4
        Re: Writing Solid Code

        Jon Skeet <skeet@pobox.co m> wrote:[color=blue][color=green]
        > > 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#?[/color]
        >
        > Note that I've never suggested that *none* of the ideas in the book
        > aren't applicable to C#[/color]

        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 - <skeet@pobox.co m>
        Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

        If replying to the group, please do not mail me too

        Comment

        • 100

          #5
          Re: Writing Solid Code

          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" <100@100.com> wrote in message
          news:uUMDsi5TDH A.560@TK2MSFTNG P10.phx.gbl...[color=blue]
          > Has anybody read Steve Maguire's book "Writing solid code"?
          > Do you think that the ideas in this book are not applicable in c#[/color]
          language?[color=blue]
          > 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[/color]
          is[color=blue]
          > bringing c/c++ *idioms* in the c# language?"
          >
          > B\rgds
          > 100
          >
          >[/color]


          Comment

          • 100

            #6
            Re: Writing Solid Code

            ;))))) 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" <skeet@pobox.co m> wrote in message
            news:MPG.198625 e9cfe56fe098a18 e@news.microsof t.com...[color=blue]
            > Jon Skeet <skeet@pobox.co m> wrote:[color=green][color=darkred]
            > > > So, do you think just because this book was writen several years ago,[/color][/color][/color]
            when[color=blue][color=green][color=darkred]
            > > > c# wasn't there this makes the ideas in the book not applicable in c#?[/color]
            > >
            > > Note that I've never suggested that *none* of the ideas in the book
            > > aren't applicable to C#[/color]
            >
            > 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 - <skeet@pobox.co m>
            > http://www.pobox.com/~skeet/
            > If replying to the group, please do not mail me too[/color]


            Comment

            • Jon Skeet

              #7
              Re: Writing Solid Code

              100 <100@100.com> wrote:[color=blue]
              > 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.[/color]

              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 "Refactorin g" - 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.
              [color=blue]
              > I think I've been long enough in the programing (my first program was for an
              > 8-bit computer)[/color]

              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 - <skeet@pobox.co m>
              Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

              If replying to the group, please do not mail me too

              Comment

              • gerry

                #8
                Re: Writing Solid Code

                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" <100@100.com> wrote in message
                news:ut3cpZ6TDH A.2420@TK2MSFTN GP10.phx.gbl...[color=blue]
                > 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[/color]
                an[color=blue]
                > 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[/color]
                about[color=blue]
                > this particular one) I've got the impression that I think too much when
                > writing my programs.
                >
                > B\rgds
                > 100
                > "100" <100@100.com> wrote in message
                > news:uUMDsi5TDH A.560@TK2MSFTNG P10.phx.gbl...[color=green]
                > > Has anybody read Steve Maguire's book "Writing solid code"?
                > > Do you think that the ideas in this book are not applicable in c#[/color]
                > language?[color=green]
                > > 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[/color][/color]
                makes[color=blue][color=green]
                > > 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[/color][/color]
                book[color=blue]
                > is[color=green]
                > > bringing c/c++ *idioms* in the c# language?"
                > >
                > > B\rgds
                > > 100
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • Robert Hooker

                  #9
                  Re: Writing Solid Code

                  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" <100@100.com> wrote in message
                  news:uUMDsi5TDH A.560@TK2MSFTNG P10.phx.gbl...[color=blue]
                  > Has anybody read Steve Maguire's book "Writing solid code"?
                  > Do you think that the ideas in this book are not applicable in c#[/color]
                  language?[color=blue]
                  > 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[/color]
                  is[color=blue]
                  > bringing c/c++ *idioms* in the c# language?"
                  >
                  > B\rgds
                  > 100
                  >
                  >[/color]


                  Comment

                  • 100

                    #10
                    Re: Writing Solid Code

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

                    "Robert Hooker" <rhooker@rhooke r.com> wrote in message
                    news:O01O1L7TDH A.2316@tk2msftn gp13.phx.gbl...[color=blue]
                    > 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[/color]
                    below[color=blue]
                    > 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[/color]
                    find[color=blue]
                    > 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[/color]
                    different[color=blue]
                    > "hows" to acheive his "whys".
                    >
                    > My 2cents,
                    > Rob.
                    >
                    > "100" <100@100.com> wrote in message
                    > news:uUMDsi5TDH A.560@TK2MSFTNG P10.phx.gbl...[color=green]
                    > > Has anybody read Steve Maguire's book "Writing solid code"?
                    > > Do you think that the ideas in this book are not applicable in c#[/color]
                    > language?[color=green]
                    > > 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[/color][/color]
                    makes[color=blue][color=green]
                    > > 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[/color][/color]
                    book[color=blue]
                    > is[color=green]
                    > > bringing c/c++ *idioms* in the c# language?"
                    > >
                    > > B\rgds
                    > > 100
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    Working...