Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Although I know there are several who frequent this site that also cross over to Java, let's forget about the Java in the title and replace it with "Object Oriented Programming." Despite programming with OO technologies for for several years, I picked up so much information from this book that it was almost embarasing.

The author, Joshua Bloch, is definately not a slouch as an author for this book. One of the core architects of Java, he has definately had experience in OO design and implementation issues. This, for me, was a minor part in establishing credibility. Its when he criticizes the poor design of certain parts of the Java libraries, even areas that he worked on, that he scored points with me.

The first three chapters are pretty much Java specific, so I will not cover them here, but they are definately worth knowing if you program with Java.

In Chapter 4 - Classes and Interfaces, the book turns more general OO topics that I found useful not only for Java, but for other languages, including Perl. The discusions regarding favoring immutable classes, compositions, and avoiding inheritance are lessons I had learned the hard way, but I had not seen in print. It was very nice to see someone smarter than I saying that inheritance breaks encapsulation, and that years of avoiding inheritance on my part was justified.

Chapter 5 - Substitutes for C Constructs was also a very useful chapter for the OO Perl programmer. The examples are fairly straight forward, but the section on enums is worth its weight in gold. Bloch successfully pounds many enum-based designs I've seen in the past (including my own) into the dirt. While some of it gets a bit heavy on the Java side when discussing typesafe, serializable enums, Bloch gives enough advice that the information is usable for just about any programmer.

Chapter 6 - Methods is a chapter full of practical advice that I rarely find in practice, until bugs start creeping in. Advice such as "Check parameters for validity", "Make defensive copies when needed" (especially important when using references), documenting your exposed API can not be stressed enough to new (and many old) programmers.

Chapter 7 - General Programming contains a lot of advice that again can be transfered to just about any language. The advice to "Know and use the libraries" is one that I am reminded of every day. Some of the ideas regarding avoiding strings made me think a lot about my own use of string. The section on limiting the scope of local variables caused me a lot of grief since I came into programming through Pascal and COBOL.

The remaining topics go back towards a Java related scope discussing threads, serialization, and exceptions. The one piece of advice that would apply elsewhere ties into the discussions throughout the book regarding immutable classes. Since immutable classes are, well, immutable, they are thread safe.

Essential Java has quickly become one of my most refered to books on my bookshelf. It should be required reading for any Java programmer, and much of the information in the book would be a benefit to any programmer.

Update: Fixed Title. Aaargh! That's what I get for writing this at 2 am after two pots o' coffee.


In reply to Effective Java by Steve_p

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (4)
    As of 2020-05-24 23:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      If programming languages were movie genres, Perl would be:















      Results (142 votes). Check out past polls.

      Notices?