Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

23. March 2012



Have you ever read a technical book and thought to yourself “Man, the author of this book must be a gigantic jerk!”?  I can honestly say, I never have until now!



This review of sorts covers two different Javascript books I’ve read recently; two very different books with two very different goals.  As I have been working with Node and more recently Appcelerator, I decided I needed to polish up my Javascript skills, as things are much different these days than the DOM manipulation I traditionally used Javascript for.  I started out by searching for “Javascript closure” on Safari Books Online and it brought me to Javascript: The Good Parts, it was short and I was suffering insomnia so I read it that evening.  The book left me with so many questions that I ended up reading/contrasting it against Javascript: The definitive guide.  Aside from both books being about Javascript and both having colons in their titles, these two books couldn’t be further apart!




Let’s start with the Javascript: The Good Parts review.



First off, it’s worth mentioning the author, Douglas Crockford.  If you’ve never heard of him, he is the guy originally responsible for drafting the JSON standard and Yahoo’s head JavascriptJavascriptTheGoodParts guy, responsible for projects like the yUI library.  Simply put, this man knows his stuff when it comes to the topic.  Sadly, he knows it too and doesn’t let you forget it.  Many times in the book he pushes his opinion as fact, and often on very odd things ( like never use ++ operators ).  He often makes sweeping statements that really don’t work in a black and white world.  That said, if you can get over the personality ( or you aren’t sensitive to such things ), this is a wonderful little book.



I do mean little too, as this book weighs in at a mere 176 pages.  Amazingly enough there is a ton packed in to those 176 pages and even more amazingly, a great deal of it could be pruned and would make this a superior book ( such as the regular expressions chapter ).  A good example of what could be pruned out completely are the absolutely bizarre charts this book is littered with.  Here is one for example:






That chart was meant to explain Javascripts whitespace rules… did it help you, even slightly?  You could have more concisely and effectively conveyed all of that information in a sentence or two.  I found that over and over, the author being overly clever or complicated leaves the reader baffled on what should be a pretty simple concept.  He does the exact same thing with code examples too, consider this code sample regarding inheritance:


var Cat = function (name) { = name; this.saying = 'meow'; }; // Replace Cat.prototype with a new instance of Mammal Cat.prototype = new Mammal( ); // Augment the new prototype with // purr and get_name methods. Cat.prototype.purr = function (n) { var i, s = ''; for (i = 0; i < n; i += 1) { if (s) { s += '-'; } s += 'r'; } return s; }; Cat.prototype.get_name = function ( ) { return this.says( ) + ' ' + + ' ' + this.says( ); }; var myCat = new Cat('Henrietta'); var says = myCat.says( ); // 'meow' var purr = myCat.purr(5); // 'r-r-r-r-r' var name = myCat.get_name( ); // 'meow Henrietta meow'



Notice how half of it is taken up by a purr() method which is overly convoluted and has nothing to do with the lesson at hand.  It simply causes the reader to have to dedicate a few more cycles to deciphering an example ( which is completely irrelevant to the topic at hand ), while allowing the author to feel just a little bit more clever. 


These kinds of things happen over and over and it makes reading the book more difficult than it should be, for no good reason.  The other major problem with trying to decipher the code samples in this book are the errors, my god the errors!  See every technical book is going to have a certain number of errors, but for a 176 page book, this one has far more then it’s share.  Just take a look at the errata.  Nothing makes learning a new concept more difficult than following code that doesn’t work!  When you are new to a subject, you assume the code you are working from is correct and it’s your newbishness that is the source of the problem.  That often simply isn’t true with this book, when you read it, if you encounter problems be sure to check the errata before you bash your head off the wall with frustration.



Next up is determining who this book’s audience is, which is a problem the author obviously struggled with.  Consider the following two paragraphs taken from the preface:


This is a book about the JavaScript programming language. It is intended for            programmers who, by happenstance or curiosity, are venturing into JavaScript for the   first time. It is also intended for programmers who have been working with JavaScript at a novice level and are now ready for a more sophisticated relationship with the language. JavaScript is a surprisingly powerful language. Its unconventionality presents some challenges, but being a small language, it is easily mastered.


Followed a paragraph later by:


This is not a book for beginners. Someday I hope to write a JavaScript: The First Parts book, but this is not that book. This is not a book about Ajax or web programming. The focus is exclusively on JavaScript, which is just one of the languages the web developer must master.


Let me put this in the simplest terms possible This is not a book for beginners!  If you are “venturing into Javascript for the first time”, well frankly you are absolutely screwed if this is the book you chose!



So I’ve dumped on this book pretty good, it’s short, the author comes across arrogant and I seem to hate at least half of it, so why the hell am I bothering to mention it to you?  That’s because the remaining half of this book is downright excellent.  It basically is the Javascript equivalent of Effective C++, which is one of the best technical books ever written.



Javascript as a language is an absolute minefield waiting to explode killing ( or at least mentally scaring ) the developer.  It lacks the data hiding facilities that basically every other language in existence has.  More so, it has extremely dangerous but seemingly benign constructs like new and == that are just waiting there to attack you.  Finally, the scoping rules are almost as byzantine as you’d expect from C++! It is far too easy to make a variable global, or mute out an existing variable leading to undesired behavior ( bugs ).  This book helps you to navigate that minefield, probably better than any other book in existence.



More to the point, most people simply use Javascript wrong ( now there I go sounding arrogant! Winking smile ).  But simple fact is, years of browser based DOM manipulation code written to mimic traditional OO code has lead to many people forming extremely bad habits, myself included.  This book does a very good job of showing you the intricacies of the language, as well as effective work arounds for perceived faults.  Some of these “faults” I disagree with, but I certainly did learn from the exercises anyways.



So in the end, do I recommend this book?  That’s a tricky one.  I really don’t like the way it is written, I am not keen on the way he teaches ( the choice of illustrations and code examples ), the excessive errors certainly don’t help.  That said, I learned a ton reading this book, in a very short period of time.  Besides, it’s less than 20 bucks!  So in the end, yes I do recommend you read it, much like Effective C++, it will make you a better Javascript programmer.  But for learning the language or as a first book, certainly not.  Fortunately in the regard, we have another book!




Javascript: The Definitive Guide review.



If Javascript has a bible ( like K&R C for the C Programming Language ), it’s this book.  The Definitive Guide is a much more traditional book, much longer at 1032 pages and with a much more traditional price tag.  This part of the review is going to be much shorter, as essentiallyJavascriptTheDefinitiveGuide there is a lot less to say.  The authors writing style in much more approachable than Javascript:The Good Parts and the code examples are far easier to digest.



One up or downside to this book, depending on your needs, is the amount of browser/DOM related content.  While Good parts effectively had no content pertaining to using Javascript in the browser ( an area extremely well documented in books and online ), the same is not true for this book.  Fully half of this book is on “client side” Javascript programming.  Then again, even at 50%, this is still a 1000+ page book, so you still got another 500 pages of non-client side Javascript.  Just remember, if you are using Javascript outside of the browser, if it starts with document. it probably isn’t supported.



The book is basically broken down into 4 sections.  The first is Core Javascript, which covers the language itself, regardless to how it is used.  This section is where you cover concepts like reserved words, objects, arrays etc.  The second is Client Side Javascript, which basically covers using Javascript in the browser, covering topics such as the DOM, jQuery, HTML5, etc.  The final two sections are reference sections for both the core and client side libraries.  These sections are strictly for reference.  Truth is though, with the sad state of the internet on this subject, a handy book reference is quite a useful thing.



For learning the language and your goto reference book, it’s really hard to beat Javascript: The Definitive Guide.  Taken in tandem, these two books are all you would need to succeed at Javascript development.  The Definitive Guide to get you started, and as a reference as you go along.  Then read Best Parts, to make you a better developer… if you are willing to put up with some annoying attitude that is!

Programming ,

22. March 2012



Adobe has recently made Photoshop CS 6 available as beta, which will last until CS6 is PSCS6released.  In order to activate, you need to have an Adobe ID ( freely available ) within 7 days of installing.  The Mac installer is now 64bit only and weighs in at just under 1GB, while the Windows install is closer to 1.7GB.




The biggest new features in Abobe’s own words are:


  • Content-Aware Patch — Patch images with greater control using the newest member of the Content-Aware family of technologies. Choose the sample area you want to use to create your patch, and then watch Content-Aware Patch magically blend pixels for a stunning result.
  • Blazingly fast performance and a modern UI — Experience unprecedented performance with the Mercury Graphics Engine, which gives you near-instant results when you edit with key tools such as Liquify, Puppet Warp, and Crop.* Plus, a refined, fresh, and elegant Photoshop interface features dark background options that make your images pop.
  • New and re-engineered design tools — Create superior designs fast. Get consistent formatting with type styles, create and apply custom strokes and dashed lines to shapes, quickly search layers, and much more.



The content aware tools are easily the biggest new feature, and look pretty impressive as demonstrated in this video:

Another good video showing off the new features is Russel Brown's 6 favorite new features: have also made a number of tutorials freely available for CS6.

So, if you are interested in Photoshop CS6, or just want a free copy for a limited time, head on over to and give it a download.

News, Art

21. March 2012



As my journey with Appcelerator continues, I’ve run into another annoyance, and the fix wasn’t immediately obvious.  Titanium Studio ships with an Android 2.2 image pre-configured, although I am trying to develop for Ice Cream Sandwich ( Android 4 ).  The problem is, every time I launch my application, it would ignore the running emulator ( launched using AVD Manager ) and launch it’s own. This is really irritating, as the Android emulator takes forever to load.  ( About a minute for 2.2, and well over 5-10 minutes for ICS, on an i7 machine with 12GB of RAM! ) to say nothing of the fact their emulator image is for a phone, not a tablet.



It seemed no matter what I did, it would still load a new instance of the emulator, regardless to if I had one running already.  The answer isn’t as intuitive as you would think.  My first thought was it would be under Debug Configurations, which can be accessed by right clicking tiapp.xml in your project, choosing Debug As –> Debug Configurations…  which brings up the screen below:







Ah, this looks promising, change Android API level to Android 4.0, click Apply then debug.   Still loads the pre-configured 2.2 emulator. Sad smile  Ok, so that wasn’t it.



In the end, it comes down to how you build your project.  In Project or Package Explorer, double click tiapp.xml to bring the property editor up.  Search for the “Deployment Targets” section, then click the configure link, like this:






In the dialog that pops up, there is a selection for “Default Android SDK:”.  This is the value you need to change:





Now I click debug and behold!  Ice Cream Sandwich goodness!






Well… that was intuitive.  Not really something you can blame Appcelerator for, nor Titanium Studio ( although again Eclipse/Google Android tools make things far too complicated! ) in the end.  That said, if I could debug on a physical device, I wouldn’t have to deal with the terrible Android emulator in the first place!



Anyways, finally after a few days of messing about with configuration and install issues, finally, time for some coding!


21. March 2012



Hey, I’m on time this time! Well, almost…



This weeks cool thing is in an area where there aren’t too many options, audio capture and manipulation tools.  On the “pro” side, the dominant player is probably Pro-Tools, which is in a word expensive.  With pricing starting at 700$ and going up from there, it is out of the reach of many peoples budget.  Truth of the matter is, it’s probably overkill for most people too.



In the mid range you have other, slightly cheaper options such as Adobe's SoundBooth or if you are the Mac type, Apple’s Logic Pro.  Both of these apps sell for about 200$.  If you’ve noticed one thing about me though, it’s I like free stuff, I really like free stuff.



Thankfully there is a free option, and it’s pretty damned good.  This weeks CTofW is Audacity.  In addition to being a rather clever pun, it is also a “free, open source, cross-platform software for recording and editing sounds.  It is available on Windows, Linux and Mac. 



Audacity in action editing a Wav file:




As is pretty typical of open-source projects, it’s a bit on the ugly side, although compared to it’s open-source peers, it is the belle of the ball.  However, unlike most open sourced projects, it’s incredibly well documented.  In addition to the included documentation, there are actually a few published books including Getting Started with Audacity 1.3 and The book of Audacity.  It’s a good thing too, even though Audacity is pretty simple to get started with, it’s an amazingly deep program.  The short form description for their site goes as follows:


You can use Audacity to:

  • Record live audio.
  • Convert tapes and records into digital recordings or CDs.
  • Edit Ogg Vorbis, MP3, WAV or AIFF sound files.
  • Cut, copy, splice or mix sounds together.
  • Change the speed or pitch of a recording.
  • And more!




Instead of going into depth here about what this program can do, I’ll refer you to their feature list.  And I promise you, that list just scratches the surface.



So, if you are looking for a audio capture and manipulation application and are doing things on a budget, you really can’t do better than Audacity.  Seeing as it’s free and only a 20MB download, what have you got to lose?

Cool Thing of the Week

20. March 2012



As you might have noticed from my previous post I am currently evaluating Appcelerator and I have to say, the early frustrations are far too common.  In the future I may do a full review, if I don’t give up on it completely.  For now though, let me share a few of the issues I’ve run into, beyond the one described in the previous post.



Failed to find Javac.

I got an error the first time I tried to compile my code, stating that it failed to find javac. So I opened a command prompt, CD to %JAVA_HOME% and there it is.  WTF?  Some Googling later and I discover it doesn’t support file paths with spaces!  Seriously?  What, is this 1994?  Moved Java to c:\jdk and problem went away.  Seriously, when was the last time you ran into an app that didn’t support spaces?



Blackberry Support

A big part of why I chose Appcelerator in the first place is support for iOS, Android AND Blackberry, as I have all three tablets in my house.  I go to make a Mobile application in Appcelerator and Blackberry is grayed out.  I click through to a “Get SDK” link, download 500mb of Blackberry stuff, restart Appcelerator Studio and… Blackberry is still grayed out.  Turns out this is a “pro only” feature…  and that’s only discovered by reading a forum post, their own documentation says nothing of the sort!  Disappointing, not only that it’s a premium feature, but because they didn’t indicate this anywhere, the UI suggests otherwise, causing me to waste a couple hours of my life.



Android device support

So, native blackberry support isnt a huge deal, now that you can bundle Android apps as Blackberry Playbook apps, so I continue on targeting just Android.  I configure and setup the Android SDK, create a demo app, launch it on by Transformer, all good so far.  So I set a breakpoint, hit debug and…….. the emulator launches.  If you’ve done any Android development, you know using this emulator is somewhere between an 8 and 9 out of 10 on the “Things that hurt” scale.  It is sloooooooooooooooow.  But get this, Appcelerator can’t debug on device, emulator only.   This.  Sucks.  Hard.





So, let’s just say, after two days I am extremely unimpressed, and I haven’t even got around to coding yet!



Anyone out there have prior experience with Appcelerator?  Am I just hitting all the bad stuff up front, or is this what I should expect as the norm?


Month List

Popular Comments

Corona SDK Mobile Game Development added to Safari
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

27. April 2012



The LUA based Corona SDK is one of those things I have really been intending to check out forCoronaBook a very long time now.  One of the biggest reasons I haven’t looked closer ( other than time ) was the complete lack of published materials.  Today however, I logged in to Safari and low and behold, Corona SDK Mobile Game Development is right there in the new releases section.



This is perhaps the worst timing ever, I am still throwing myself quite fully at PlayStation SDK development as well as working on a Titanium based app… but, but… this is shiny and new! (well, the book is new anyways…)



Actually, Corona and more specifically LUA are two products I have heard nothing but rave reviews of, so this certainly is of interest to me.  I’ve skim read the book and it seems quite impressive.  If I dive in, I will be sure to put up a review.  I have to say, I am quite impressed with Packt press lately and the range of books they are putting out.  The book is also available on Amazon but oddly enough shows a May 31st publish date( it’s April 27th at the time of this post), but also lists it as being in stock so I am guessing it’s available to order.



Have you worked with LUA/Corona?  Is the hype justified? Is it substantially better than the free Moai SDK, which is also LUA based?


blog comments powered by Disqus

Month List

Popular Comments