There is a lot of sense in this idea. If we have just spent several
pages talking about strings and the string API then it feels very
natural to continue with actual recipes for string manipulation. And
the same would go for tables.
However, consider functions. There are some recipes for using
functions (e.g. functional patterns) but this would be a minor section
as a _recipes chapter_; actually giving some serious background on
functions is important, because everything leans on this - recipes are
usually functions.
Or modules - key concept, but probably poor way to organize recipes.
So some introduction is useful; what it should cover, and what the
level should be, are other questions.
steve d.
That depends on what is intended with a Cookbook. I treat ist
as a bunch of informations and recipes regarding common tasks,
idioms and pitfalls, not as intro into the language. That is
covered by PIL quite well. Hence the intro schould wet the
appetite (Keyword: small, fast, embaddable, etc) and give an
overview of the book, not more. May be a condensed description
can be placed into an appendix.
That would mean that the cookbook ist located somewhere between
PIL(intro) and LPG (Lua programming Gems), aimed more to the
width and not that much the depth of the language.
Well, that is what I would expect from a cookbook. But
that are basic design decisions and may be seen very
different by others.
my 2 cents
Peter
steve donovan wrote:
So some introduction is useful; what it should cover, andwhat the level should be, are other questions.
That depends on what is intended with a Cookbook. I treat ist
as a bunch of informations and recipes regarding common tasks,
idioms and pitfalls, not as intro into the language. That is
covered by PIL quite well. Hence the intro schould wet the
appetite (Keyword: small, fast, embaddable, etc) and give an
overview of the book, not more. May be a condensed description
can be placed into an appendix.
That would mean that the cookbook ist located somewhere between
PIL(intro) and LPG (Lua programming Gems), aimed more to the
width and not that much the depth of the language.
This book isn't meant to be a complete reference book for Perl, although we do describe some parts of Perl previously undocumented. Having a copy of Programming Perl handy will allow you to look up the exact definition of an operator, keyword, or function. Alternatively, every Perl installation comes with over 1,000 pages of searchable, online reference materials. If those aren't where you can get at them, see your system administrator.
Neither is this book meant to be a bare-bones introduction for programmers who've never seen Perl before. That's what Learning Perl , a kinder and gentler introduction to Perl, is designed for. (If you're on a Microsoft system, you'll probably prefer the Learning Perl on Win32 Systems version.)
Instead, this is a book for learning more Perl. Neither a reference book nor a tutorial book, the Perl Cookbook serves as a companion book to both. It's for people who already know the basics but are wondering how to mix all those ingredients together into a complete program. Spread across 20 chapters and more than 300 focused topic areas affectionately called recipes, this book contains thousands of solutions to everyday challenges encountered by novice and journeyman alike.
Well, that is what I would expect from a cookbook.
But that are basic design decisions and may be seen very
different by others.
my 2 cents
Peter
On Sat, Jan 29, 2011 at 3:34 PM, Humberto S. N. dos AnjosThere is a lot of sense in this idea. If we have just spent several
<h.a...@gmail.com> wrote:
> What do you guys think?
pages talking about strings and the string API then it feels very
natural to continue with actual recipes for string manipulation. And
the same would go for tables.
However, consider functions. There are some recipes for using
functions (e.g. functional patterns) but this would be a minor section
as a _recipes chapter_; actually giving some serious background on
functions is important, because everything leans on this - recipes are
usually functions.
Or modules - key concept, but probably poor way to organize recipes.
So some introduction is useful; what it should cover, and what the
level should be, are other questions.
I do think that these things need to be put in an introduction, the
question is does that introduction sit in the appropriate recipes
chapter? Can a core concept be explained using a recipe, given that a
recipe has to be useful? For me, a recipe does a job, no matter how
simple, for instance, 'copy a table'. So a recipe that uses a
particular technique to do OOP (such as metatables) must provide a
class that people can copy into programs and use.
I still think that it's sometimes useful to write first and think
second ;) This sounds terribly unscientific - think of it as
'bottom-up' development if it helps. I aim to keep writing, since I
find this more entertaining than talking about structure. Since I am a
professional, I don't particularly mind the content being subsequently
re-arranged into another structure. If there remains introductory
material that doesn't fit, well then it can be put somewhere else.
The relation PiL <= cookbook < LPG is a useful starting point,
however. But there are people who find PiL hard-going in places ...
these are not us, of course, but neither are they fools that shouldn't
be allowed near a computer.
steve d.
Of course, those who finally make and write the book
have to decide, I'm not one of these. But some feedback
as well as brainstorming was requested, that's all.
Peter
Sorry, Peter I am not being very helpful. Such brainstorming and
discussions about level & structure are important.
At the moment I like writing, I find it relaxing ;) Nothing more than
that. The order-out-of-chaos part of my brain will probably return in
a few days.
I am interested in how to define the level of the book, because it's
not as easy as saying 'Go away and read PiL and then come back!'. But
on the other hand, we have to assume
people come from _somewhere_.
steve d.
I do think that these things need to be put in an introduction, the
question is does that introduction sit in the appropriate recipes
chapter? Can a core concept be explained using a recipe, given that a
recipe has to be useful? For me, a recipe does a job, no matter how
simple, for instance, 'copy a table'. So a recipe that uses a
particular technique to do OOP (such as metatables) must provide a
class that people can copy into programs and use.
local foo, bar-- function foo() end is the same as foo = function () end, remember?function foo() return bar() endfunction bar() return foo() end
The relation PiL <= cookbook < LPG is a useful starting point,
however. But there are people who find PiL hard-going in places ...
these are not us, of course, but neither are they fools that shouldn't
be allowed near a computer.
I am interested in how to define the level of the book, because it's
not as easy as saying 'Go away and read PiL and then come back!'. But
on the other hand, we have to assume
people come from _somewhere_.
Relax Steve! :-)
> I am interested in how to define the level of the book, because it's
> not as easy as saying 'Go away and read PiL and then come back!'.But on
> the other hand, we have to assume people come from _somewhere_.
I think you should assume that people had read PIL before or
at least had a deep look into the manual and already got a
first impression of the language. Probably they have already
tinkered a bit with it and are now looking for *more* infos.
Hence I see no need to introduce into the very basics. I also
think that topics like installation are superfluous for the
same reason.
Personally I find it annoying when I buy a computer book and
1/4 or more of it repeats what other books I have already cover.
To actually sell a book you have to place it carefully
IMHO of course...
Peter
I also think that topics like installation are superfluous for the
same reason.
That's a nice example, and does illustrate your point, and I agree.
It's just a question of how much introductory material, then.
> recipes can have. Entry-level recipes can be used to demonstrate interesting
> consequences of how the core concepts work. Lua 5.2's _ENV definitely allows
> some cool tricks...
By necessity we are going to have to highlight the differences - _ENV
versus setfenv, etc. Lua 5.1 remains the main target, if only because
LuaJIT is increasingly going to be the power implementation of Lua,
particularly in production.
> Which places? That's something a cookbook could definitely help smooth out.
I wish I knew! Here we need to canvas the opinion of people who are
new to Lua but no stranger to other languages (Mr Litt, you out there?
;)) There is an (apparently) true story about a Nobel laureate
physicist visiting a biology lab and saying 'assume zero knowledge and
infinite intelligence'. Which says a lot about the arrogance of
physicists, but also indicates a style of introduction where the idea
is to map Lua concepts onto the concepts of other languages.
A survival course, if you like ...
steve d.
Good, because maybe I was coming across as being high and mighty!
> I think you should assume that people had read PIL before or
> at least had a deep look into the manual and already got a
> first impression of the language.
Yes, you have to assume _something_ about the level. It is certainly
not an introduction to programming! People already come knowing about
the basic data structures, and we show how tables can cover the lot.
Terms like 'array' or 'dictionary' are foreign terms to Lua, but well
established concepts in computer science.
> Personally I find it annoying when I buy a computer book and
> 1/4 or more of it repeats what other books
Yes, we all know those - I think if one is going to introduce a topic
it has to be rigorous. The goal is achieved when the explanation is
mostly about concrete recipes and does not dominate.
Although, something to think about: we are probably not the core
audience for the book...
steve d.
Саn someone please update this page with the aftermath of this discussion?
https://github.com/lua-cookbook/lua-cookbook/wiki/The-Purpose
(It will later be transformed into abstract or foreword or whatever.)
Thanks,
Alexander.
Please do continue to provide feedback and brainstorming, it is very useful!
Alexander.
Alexander.
Wasn't it Feynman?
Alexander.
It does sound like the kind of thing he would say...
Feynman of course is also famous for loving bongo drums and Brazil.
He was one of the first concurrent programmers in his young days on
the Manhattan project, although his instruction pipelines consisted of
girls with mechanical calculators.
steve d.
> It does sound like the kind of thing he would say...
Right, Google tells me that it was Leo Szilard. The accurate quote is:
"Assume infinite intelligence and zero prior knowledge". (But Leo
Szilard is not Nobel laureate, according to Wikipedia.)
Feynman could not say this because he did some biology before he got
Nobel prize, so his knowledge could not be zero.
> Feynman of course is also famous for loving bongo drums and Brazil.
> He was one of the first concurrent programmers in his young days on
> the Manhattan project, although his instruction pipelines consisted of
> girls with mechanical calculators.
I like the concurrent punchcards case more. :-)
Alexander.