lördag 15 juli 2017

Book review: Programming in Lua, Fourth edition

I have read a book called Programming in Lua, fourth edition to learn how to code using Lua. My aim has been to integrate Lua with other languages, in particular C++. Because when you code in C++ things quickly become messy and you must write a lot of redundant code that also pollute the project file tree. In C++, you are sometimes forced to create two files for a class, one header file and one source file. In most other languages that I know of you only need one single file to store a class. Lua also offers an automatic garbage collector so that one doesn’t have to fiddle with freeing up memory in a program. I should of course mention that it is usually favorable to divide objects into two files in C++ by default. Lua should in theory simplify things and let me make modifications to a program while it is running.

I have therefore read the book cover to cover to learn about Lua. Presumably I have some insights about the book that could be good to know before reading it. I did not read the last 2 or so chapters properly however. This book has provided me with a solid overview regarding lots and lots of important details about the language and how to implement it. The book also has exercise tasks that are good to do to get an even better grasp, but I didn’t do any of those. Yet I feel like I’ve learned a lot. Personally, I have already from my past have had quite extensive experience of programming and computer science in general, as well as math. This book is like an information shotgun with tricky code examples to explain some of the info. Not only does it tell you everything at once but it also does so in a way that can be hard to read unless you really pay attention and focus. And even then, it can be difficult. Out of the blue this book often assumes deep insights of specific areas in mathematics or computer science without providing any details, which all piles up to the difficulty of reading the book. Luckily though for the reader is that Lua supposedly is an easy programming language. Some parts of the book are easy to read, probably because there is no need to over complicate simple and straight-forward information. I guess that is also the case when people in a normal context would teach Lua.

To stay motivated to keep reading this book and not stopping after the 1st chapter, you need a true interest for learning Lua. But even that might not be enough so you need to make a deal with yourself to read at least one chapter a day. Or else you may never finish the book. Now why is motivation a problem for this book? The answer is that this book is all about difficultly presented information without exception. I read this book as mentioned cover to cover and I did not come across one single joke in the entire book. Some books at least have an inspirational quote at the beginning of each chapter. Here it’s all about having a serious face all the time.


To sum up: this book was difficult to read. On the flipside, I might not have learned as much if it wasn’t difficult to read.  If you want to make sense of this book you also should make sure to read the chapters in chronological order starting with chapter 1. Each chapter pretty much assumes that you know everything written in previous chapters. So, make sure that you at least decently understand a chapter before you read on. I am glad that I read this book because it provided me with so much information. When I started reading I knew basically nothing at all about Lua. When I finished reading it I felt like I was a pro at Lua, despite not doing the exercises. It goes without saying that this book is not for everyone. Although I believe everyone can understand the most basic and fundamental topics about Lua explained in the book. As mentioned I really don’t recommend continuing reading upcoming chapters if you don’t understand the one you’ve just read.

Inga kommentarer:

Skicka en kommentar