Month: March 2007

Programming in Lua

(cover to the left here, refers to 4th edition of the book, I read the 1st edition). It is somewhat difficult, in writing this review, to distinguish the language from the book. The book teaches about Lua, so my opinions in favor or against this language could interfere with my opinions about the book. Anyway I’ll try to accomplish this hard task.When writing a book about a programming language you could follow either an hands-on approach or a more formal one. Both ways have their pros and cons. The first approach helps language novices to grasp quickly language fundamentals, while latter provide a convenient reference for those already using the language.
For example Bjarne Stroustrup’s “The C++ Language” belongs to the second set. It is very formal and descriptive; learning the language by this book it is definitely the hard way to do that (aside from the fact that C++ is a very complex and huge language). “Programming in Lua” is from the first camp. It features an easy to follow, example-ridden way into the language. It doesn’t pretend to give a thorough reference for the language or the library, demanding other books for this specific purpose.
I have to say that the writer does quite a good job. The text reads smoothly, examples are always fit to the chapter scope, prose is clean and clear. In theory I should have practiced with the language itself in order to state whether the book covers the matter adequately or not, but I have a limited amount of free time and no suitable project for a Lua application, not even a toy one.

Anyway while I didn’t fell in love with the language (quite the opposite as you may have read) I appreciated the book. Also I found an interesting reading the last chapters on how interfacing and extending lua with C code.
What I didn’t like is the author bias toward the language; I feel a vein of naivety. For example Lua supports only floating point values. Not the “float” kind, but the “double” variety. No integers, just doubles. The author advocates that there is no reason for integers since “double” works fine for just everything. Although I have not much experience with doubles (just floats), this appears quite a bold statement, at least from what I have skimmed through. The dumbest consideration I could think of is that doubles still have the usual precision problems that affect floating point arithmetic. It just depends on how many iterations you have to do.
On a whole I found this book a worth reading either if you want to learn a new programming language or you are just curious (like me). Just be sure to buy the 2nd edition that came out just few days after I ordered the book (I ordered the book few days after having read the, now disappeared, slashdot review… maybe you see a connection)… or to read the first one online for free.

Antipatterns at work

It is an odd sensation. I am puzzled about some decisions that are quite unanimously recognized in literature as bad, or, if you prefer the buzzword, as anti-patterns. Forests have been sacrificed for books on the matter. Given the current (poor) state of the planet I would urge management to read them, not just having them to preserving their libraries from dust.
You have this project late, the customer is coming screaming at you because you didn’t made it for the milestone, the product is still alpha quality when it ought be on the shelves. Sounds familiar? If not either you don’t work in any technologically advanced sector or you have been unbelievably lucky (or good… or both). So it is clear that the project needs extra time to achieve the goal set. I understand that there are contracts and politics involved, but for the sake of the project there is just to plan and move the milestone ahead WITHOUT adding new features. Leave them for another project. The customer could be disappointed from this refusal but she will be a lot more disappointed when you’ll told her that you didn’t made it another time.
Disclaimer: I have to be honest, this is not my project, I don’t know exactly what has been agreed on, the only thing I know is what a coworker told me in about a single line: milestone postponed, new features added. So basically I don’t know what I’m speaking of.

Copying

No, I haven’t forget my last post. I had a look at Engineering without Frontiers, a no-profit NGO, which should be the engineer answer to medical initiatives like Medecins Sans Frontieres. Although their magazine is interesting, and their statute is agreeable, I find the overall association a bit loose, somewhat too tied in the academic world and too abstract. Apparently the prompt answer to the question “How can I help?” is just “Send money here”. Maybe I have to dig further.The topic of the day is copying. When talking about this issue, I usually agree with content owners that deplore the act of copying for money and for personal use. My favourite example is that if you like a Ferrari, you don’t steal it only because you cannot afford it. The same goes for music, movies, software and so on. There are people who worked to create that content and it is their right to be paid for their work.
I could agree on some special cases such as when you are looking for something that’s not available or even out of print. But this should represent the exception, not the rule.
Sometimes ago I skimmed through Carlo Gubitosa’s Praise of Piracy, without being convinced at all about the point of the right to copy.
Although, during these days, I’ve been hit by a sort of revelation. There’s actually a practice of legally accessing content, without paying for it. More, you could actually access content any time you want with no restrictions. And this practice has been available for centuries to human kind… public libraries the name.
Some public library lends VHS/DVD movies, maybe this practice is discourages by video rental business. But from my point of view, what’s the difference in borrowing a book from the public library or downloading it via eMule?
From one side I think it is worth noticing that the book industry is not suffering from the free availability of books in public library. It may suffer from the fact that people read less and less, but not from the fact that I could chose to borrow a book rather than buying it.
From the other side I wonder how could it be legal? 🙂 After all if everyone would go to the library, then no one would buy the book and the writer would be starving. Would it be enough for the authors to receive the payment just from public libraries? In that case authors could be payed directly from our taxes cutting the public library service costs, the media costs, by letting everyone access everything online.