Book recomendation?

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

    #16
    Re: Book recomendation?

    yes, but then folk who read that book without the benefit of this
    explanation now take up the mantra that objects are passed by reference
    which isn't correct. i agree a primer shouldn't go this deep but as a matter
    of nothing else but familiarity, the facts should be noted to prevent the
    loss of souls.

    "Jesse Liberty" <jliberty@liber tyassociates.co m> wrote in message
    news:O1N9c3qjDH A.2416@TK2MSFTN GP10.phx.gbl...[color=blue]
    > I won't argue the point with you (it becomes a matter of religion) but
    > depending on the audience, I often say that "objects are passed by
    > reference."
    >
    > Yes, everything in C# is passed by value, and yes a copy of a reference to
    > the unnamed object in memory is passed, but that creates the semantics of
    > pass by reference and the effect is (nearly all the time) identical. The
    > distinction should be covered in a note, and then forgotten, as far as I'm
    > concerned.
    >
    > Similarly, if I declare
    >
    > Dog fido = new Dog("fido");
    >
    > I will often refer to fido as a Dog, or as a Dog object or even as an
    > instance of a Dog, none of which is technically correct, because of course
    > fido is just a reference to an (unnamed) Dog object on the heap.
    >
    > It is important in a primer to be correct, but it is also important to be
    > clear, and pointless legalistic distinctions often just get in the way.
    >
    > Guess you'll hate my books <smile>.
    >
    > -j
    >
    > --
    > Jesse Liberty, President
    > Liberty Associates, Inc.
    > http://www.LibertyAssociates.com
    >[color=green]
    > > Personally, I think of a few bits that I know about but which are often
    > > misrepresented, and have a look for them. For instance, the first thing
    > > I do is check whether or not the author claims that "objects are passed
    > > by reference". If so, that's one strike.[/color]
    >
    >[/color]


    Comment

    • Stu Banter

      #17
      Re: Book recomendation?

      What a nice opportunity to thank you for writing it! As you may have seen
      elsewhere here I have bought an older version 2nd hand, and judging the way
      it looks now I bet the previous owner thoroughly used it too. A big thumbs
      up from me to you!

      Is there a lot of change in the 3d edition worth considering ? (I use VS
      2002, .NET 1.0 still)
      I'm not rich enough to buy new stuff every time unfortunately =(

      Again thanks for writing a great book. And forgive me for having peeked the
      e-version online first...

      Best!,
      Stu


      Comment

      • Jon Skeet [C# MVP]

        #18
        Re: Book recomendation?

        Jesse Liberty <jliberty@liber tyassociates.co m> wrote:[color=blue]
        > I won't argue the point with you (it becomes a matter of religion) but
        > depending on the audience, I often say that "objects are passed by
        > reference."
        >
        > Yes, everything in C# is passed by value, and yes a copy of a reference to
        > the unnamed object in memory is passed, but that creates the semantics of
        > pass by reference and the effect is (nearly all the time) identical. The
        > distinction should be covered in a note, and then forgotten, as far as I'm
        > concerned.[/color]

        I disagree strongly (as I'm sure you'd guessed :) - I've seen lots of
        people who've been confused precisely because people are inexact in
        this kind of thing. You may not confuse people who don't actually know
        what pass-by-reference semantics are in the first place, but you'll
        certainly confuse those who do. If you really believe this inaccuracy
        doesn't do any harm, I'm sure I can easily dig up a whole stack of
        posts by people on both the Java and C# groups who've been confused by
        this but have then been "unconfused " by the correct view. I've never
        seen anyone (AFAICR) end up being confused by the correct view

        It's not just that the semantics of pass-by-reference and pass-
        reference-by-value are different when the parameter's value is changed
        - it's that if you've got the right idea of references to start with,
        passing a reference by value is actually a far more natural thing to
        talk about anyway.

        The difference between a reference and an object is absolutely vital to
        understanding C#, and once that difference is understood, things like
        assignment, parameter passing, garbage collection, reference identity
        versus object equality etc are *so* much easier to understand. The idea
        of passing an object by reference gets very strange when things like
        nulls get involved, and certainly when you then *do* pass the reference
        by reference things get even more complicated. Why choose the
        complicated and technically inaccurate way of describing parameter
        passing rather than the simple and technically accurate way?
        [color=blue]
        > Similarly, if I declare
        >
        > Dog fido = new Dog("fido");
        >
        > I will often refer to fido as a Dog, or as a Dog object or even as an
        > instance of a Dog, none of which is technically correct, because of course
        > fido is just a reference to an (unnamed) Dog object on the heap.[/color]

        (In fact, fido is just a variable. The *value* of fido is a reference
        to a Dog object on the heap. But never mind that...)

        I hope that if you were talking about the topic of assignment itself,
        you'd be accurate. It's okay (IMO) to be technically slightly
        inaccurate when the point you're actually making is unrelated to the
        technical inaccuracy. When you're actually trying to explain parameter
        passing though, being inaccurate about parameter passing is a really
        bad idea.
        [color=blue]
        > It is important in a primer to be correct, but it is also important to be
        > clear, and pointless legalistic distinctions often just get in the way.[/color]

        Agreed - but bearing in mind the point above, I believe on this matter
        it's easy to be correct *and* clear. At least, that's my experience
        over the last few years of "crusading" to get this inaccuracy cleared
        up - it's one of my pet peeves. Fortunately the C# books I've read have
        tended to be much more accurate about this than the early Java books,
        so there's less confusion out there this time around, although it still
        happens.
        [color=blue]
        > Guess you'll hate my books <smile>.[/color]

        Maybe I'll find out one of these days :)

        --
        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

        • Jesse Liberty

          #19
          Re: Book recomendation?

          Thank you for the very kind words. If you are still using 1.0 then there is
          no reason for you to go to the third edition. You can learn more about the
          new book, however, and find supporting materials and a link to my private
          support discussion group on my web site (
          http://www.LibertyAssociates.com ) - click on books.

          Thanks again.

          --
          Jesse Liberty, President
          Liberty Associates, Inc.



          "Stu Banter" <x22048spambego ne@westerterp.c om> wrote in message
          news:3f85e4e1$0 $58700$e4fe514c @news.xs4all.nl ...[color=blue]
          > What a nice opportunity to thank you for writing it! As you may have seen
          > elsewhere here I have bought an older version 2nd hand, and judging the[/color]
          way[color=blue]
          > it looks now I bet the previous owner thoroughly used it too. A big thumbs
          > up from me to you!
          >
          > Is there a lot of change in the 3d edition worth considering ? (I use VS
          > 2002, .NET 1.0 still)
          > I'm not rich enough to buy new stuff every time unfortunately =(
          >
          > Again thanks for writing a great book. And forgive me for having peeked[/color]
          the[color=blue]
          > e-version online first...
          >
          > Best!,
          > Stu
          >
          >[/color]


          Comment

          • Jesse Liberty

            #20
            Re: Book recomendation?

            Your points are both well written and well taken. I do make the distinction
            you urge in my book, I just don't get as worked up about it as you do;
            though, again, I take your point.

            -j

            --
            Jesse Liberty, President
            Liberty Associates, Inc.



            "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message ...[color=blue]
            >I've seen lots of
            > people who've been confused precisely because people are inexact in
            > this kind of thing. ...> The difference between a reference and an object[/color]
            is absolutely vital to[color=blue]
            > understanding C#, and once that difference is understood, things like
            > assignment, parameter passing, garbage collection, reference identity
            > versus object equality etc are *so* much easier to understand. The idea
            > of passing an object by reference gets very strange when things like
            > nulls get involved, and certainly when you then *do* pass the reference
            > by reference things get even more complicated. Why choose the
            > complicated and technically inaccurate way of describing parameter
            > passing rather than the simple and technically accurate way?[/color]


            Comment

            • Jon Skeet [C# MVP]

              #21
              Re: Book recomendation?

              Jesse Liberty <jliberty@liber tyassociates.co m> wrote:[color=blue]
              > Your points are both well written and well taken. I do make the distinction
              > you urge in my book, I just don't get as worked up about it as you do;
              > though, again, I take your point.[/color]

              Goodo. For what it's worth, I didn't used to get very worked up about
              it either - but after you've answered the same question which is
              inspired by bad wording in books/posts about 20 times, it's easy to get
              worked up about it :)

              --
              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

              Working...