[ADV] New Beta of PickAxe3

Discussion in 'Ruby' started by Dave Thomas, May 28, 2008.

  1. Dave Thomas

    Dave Thomas Guest

    I've been thinking long and hard about the tutorial section of the
    PickAxe. It's the section of the book that seems to create the most
    emotion in readers: most folks seem to like the unconventional style
    (starting with classes and objects and working down) and some folks
    hate it. A while back, I asked here what people thought, and used what
    was said to guide me.

    So this new beta of the PickAxe keeps the same overall structure for
    the tutorial. But I'm rewriting it to do two things:

    1. I'm getting rid of the jukebox (loud cheers were heard throughout
    the land). The jukebox was always no more than a skeleton project on
    which to hang sample code illustrating points in the tutorial. But it
    never really went anywhere in the book. So now I'll be using smaller,
    self contained code fragments. Some of them are just targeted to show
    a particular Ruby feature, and others do (at least vaguely) useful work.

    2. I'm being more opinionated when it comes to the ways you should
    write code. So, for example, I'm pushing class inheritance way back,
    and instead focusing on mixins as the preferred way of structuring the
    sharing of functionality. (Obviously, inheritance still has a place,
    but I'd like to see less instances of code like "class Product <
    ActiveRecord::Base')

    Along the way I'm dropping in more 1.9 goodies.

    So, if you're an existing beta reader, log in to your account and
    refresh your PDF. Be patient though, there's already a backlog...

    "Thank you" to everyone who helped by expressing an opinion.

    (If you'd like information on the book, it's at http://pragprog.com/titles/ruby3/programming-ruby-3)


    Cheers



    Dave
    Dave Thomas, May 28, 2008
    #1
    1. Advertising

  2. Dave Thomas

    Ryan Davis Guest

    On May 28, 2008, at 09:07 , Dave Thomas wrote:

    > 2. I'm being more opinionated when it comes to the ways you should
    > write code. So, for example, I'm pushing class inheritance way back,
    > and instead focusing on mixins as the preferred way of structuring
    > the sharing of functionality. (Obviously, inheritance still has a
    > place, but I'd like to see less instances of code like "class
    > Product < ActiveRecord::Base')


    How about you just push against nonsensical names like Base?

    class Product < ActiveRecord

    makes _plenty_ of sense by itself. :p
    Ryan Davis, May 28, 2008
    #2
    1. Advertising

  3. Dave Thomas

    Dave Thomas Guest

    On May 28, 2008, at 12:36 PM, Ryan Davis wrote:

    >
    > On May 28, 2008, at 09:07 , Dave Thomas wrote:
    >
    >> 2. I'm being more opinionated when it comes to the ways you should
    >> write code. So, for example, I'm pushing class inheritance way
    >> back, and instead focusing on mixins as the preferred way of
    >> structuring the sharing of functionality. (Obviously, inheritance
    >> still has a place, but I'd like to see less instances of code like
    >> "class Product < ActiveRecord::Base')

    >
    > How about you just push against nonsensical names like Base?
    >
    > class Product < ActiveRecord
    >
    > makes _plenty_ of sense by itself. :p


    class Product
    include ActiveRecord

    end


    makes even more... After all, a Product is not an ActiveRecord--it
    uses the functionality.


    Dave
    Dave Thomas, May 28, 2008
    #3
  4. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1


    On May 28, 2008, at 8:01 PM, Dave Thomas wrote:

    >
    > On May 28, 2008, at 12:36 PM, Ryan Davis wrote:
    >
    >>
    >> On May 28, 2008, at 09:07 , Dave Thomas wrote:
    >>
    >>> 2. I'm being more opinionated when it comes to the ways you should
    >>> write code. So, for example, I'm pushing class inheritance way
    >>> back, and instead focusing on mixins as the preferred way of
    >>> structuring the sharing of functionality. (Obviously, inheritance
    >>> still has a place, but I'd like to see less instances of code like
    >>> "class Product < ActiveRecord::Base')

    >>
    >> How about you just push against nonsensical names like Base?
    >>
    >> class Product < ActiveRecord
    >>
    >> makes _plenty_ of sense by itself. :p

    >
    > class Product
    > include ActiveRecord
    >
    > end
    >
    >
    > makes even more... After all, a Product is not an ActiveRecord--it
    > uses the functionality.
    >
    >
    > Dave


    Actually - to extend the example - i really like the way DataMapper
    reads:

    ===
    class Product
    include DataMapper::persistence
    end
    ===

    Uses Persistence, provided by DataMapper.

    That includes both the Task of the Module and the Source where it
    comes from.

    The main problem of ActiveRecord::Base is that Base is such a generic
    name. And it implies that every object that has to do with AR is based
    on it.

    Regards,
    Florian Gilcher
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.8 (Darwin)

    iEYEARECAAYFAkg9qLQACgkQJA/zY0IIRZYLvgCfUebEiapDHM9hW6IZAaj97ql0
    45sAmQH6Z5LzxrFTfcx/huRrFp+XWWnV
    =6HvQ
    -----END PGP SIGNATURE-----
    Florian Gilcher, May 28, 2008
    #4
  5. On Wed, May 28, 2008 at 10:36 AM, Ryan Davis <> wrote:
    >
    > On May 28, 2008, at 09:07 , Dave Thomas wrote:
    >
    >> 2. I'm being more opinionated when it comes to the ways you should write
    >> code. So, for example, I'm pushing class inheritance way back, and instead
    >> focusing on mixins as the preferred way of structuring the sharing of
    >> functionality. (Obviously, inheritance still has a place, but I'd like to
    >> see less instances of code like "class Product < ActiveRecord::Base')

    >
    > How about you just push against nonsensical names like Base?
    >
    > class Product < ActiveRecord
    >
    > makes _plenty_ of sense by itself. :p


    ActiveRecord, though, is a module, and for good reason. The problem
    isn't really with Base, but ActiveRecord, which would have been a much
    better name for the class within the module than the module. (Sequel,
    with Sequel::Model, is better than ActiveRecord in naming, among other
    things.)
    Christopher Dicely, May 29, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Thomas

    ADV: Rail Beta Book now available

    Dave Thomas, May 27, 2005, in forum: Ruby
    Replies:
    12
    Views:
    206
    Zach Dennis
    May 29, 2005
  2. Dave Thomas
    Replies:
    0
    Views:
    102
    Dave Thomas
    Nov 2, 2005
  3. Dave Thomas
    Replies:
    2
    Views:
    88
    Dave Thomas
    Mar 9, 2006
  4. Dave Thomas
    Replies:
    10
    Views:
    182
    Gene Tani
    Oct 22, 2006
  5. Dave Thomas

    [ADV] Pushed a new beta of PickAxe 3

    Dave Thomas, Mar 19, 2008, in forum: Ruby
    Replies:
    8
    Views:
    99
    Tobias Weber
    May 27, 2008
Loading...

Share This Page