Simon,

Thanks for the information. Ordering the book at this moment.



On 30 June 2016 at 02:35, Simon Ritchie <simonritchie...@gmail.com> wrote:

> By the way, this is covered by in Donovan & Kernighan's new book The Go
> Programming Language.  On pages 197 and 198 of the first edition, they
> describe an interface Expr, representing an expression, then five concrete
> types that satisfy that interface and contain different sorts of
> expressions and sub expressions.  Since they all implement the Expr type,
> you can write a method that can receive and return any or all of them.
>
> However, there are some subtleties which can trip you up.  Once you start
> using interfaces rather than concrete types, you are pretty quickly forced
> into using pointers rather than objects.  Go does a pretty good job of
> hiding some of the details of this, but not a complete job.
>
> Interfaces are also crucial to a lot of testing strategies, because using
> them allows you to easily mock up objects with the values that you need for
> your tests.
>
> Unfortunately, this means that somebody new to Go has to get their head
> around quite a few tricky ideas before they can do anything useful.  They
> are all explained in the book, but you need to read the relevant sections
> carefully, do a few experiments and then read them again and again until it
> becomes clear.
>
> The great thing about Kernighan's writing style is that he says everything
> he needs to say exactly once and using the minimum of words.  The thing
> that often causes his readers problems is that he says everything he needs
> to say exactly once and using the minimum of words.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/OnRivRrXE40/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to