Showing posts with label web development. Show all posts
Showing posts with label web development. Show all posts

Saturday, December 3, 2011

Review of CoffeeScript: Accelerated JavaScript Development

It's been awhile since I've sunk my teeth into a good book review so I'm finally glad to get my appetite back and start consuming Trevor Burnham's CoffeeScript: Accelerated JavaScript Development book. I'm actually just as interested in trying out CoffeeScript itself as in having a look at what the book has to offer. Well then, let's get started.

First off, before even getting into the book, what is "CoffeeScript"? For a quick and dirty definition, I hit up Wikipedia:
CoffeeScript is a programming language that transcompiles to JavaScript. The language adds syntactic sugar inspired by Ruby, Python and Haskell to enhance JavaScript's brevity and readability, as well as adding more sophisticated features like array comprehension and pattern matching. CoffeeScript compiles predictably to JavaScript and programs can be written with less code (typically 1/3 fewer lines) with no effect on runtime performance. Since March 16, 2011, CoffeeScript has been on GitHub's list of most-watched projects.
I suppose I could say that if you don't know what CoffeeScript is, you shouldn't be reading Burnham's book, but that's probably not true. According to the "Who This Book Is For" section in the Preface:
If you're interested in learning CoffeeScript, you've come to the right place! However, because CoffeeScript is so closely linked to JavaScript, there are really two languages running through this book - and not enough pages to teach you both. Therefore, I'm going to assume that you know some JavaScript."
The author goes on to say that even if you know just a bit of JavaScript, you should be OK, but rank novices at the language might want to get to know a bit of JavaScript before tackling CoffeeScript. Also, since Ruby inspired a lot of the features in CoffeeScript, having a bit of Ruby background is a plus.

A couple of other "support" features before diving into the book and CoffeeScript. The sample code used in the book can be found on the book's official page at Pragmatic along with links to the errata, the discussion forums and of course, how to buy the book in hardcopy, ebook, or both formats.

How to get CoffeeScript.

I chose to use Ubuntu for my "testing platform" but was running Ubuntu's last LTS version, which doesn't support installing CoffeeScript, even in an exceptionally painful manner. Therefore, I upgraded my Ubuntu box to 11.10 (Oneiric Ocelot), opened the Ubuntu Software Center, and searched for CoffeeScript. It was discovered in no time and I installed it with no difficulty. Notice that this means I completely blew off the instructions for installing CoffeeScript as found in the first chapter, but since the book was published last August and the production version of 11.10 didn't become available until October, I figured, "what the heck". We'll see if my impatience will come back to bite me in the rear.

So now I have CoffeeScript. How am I going to use it? Oh, yeah. I have this book.

Anxious to "meet coffee", I opened a terminal window and just for giggles, typed "coffee -v" to see what version I had. So far, so good, I have version 1.1.1, the same version used in the book (the latest version as I write this blog post is 1.1.3).

There are all kinds of text editors you can use with CoffeeScript, but the author, apparently being a Mac guy, prefers textmate. Fine and dandy, but I use Ubuntu and prefer Vim. Apparently, there are textmate plugins for a wide variety of text editors including Emacs, gedit, jEdit, and of course, Vim. You can choose to go through the time and effort of adding the plug-in but you don't have to. As it says in the book, any text editor will do.

I have to say two very good things about this book. First off, the author obviously knows CoffeeScript. This is evidenced by the apparent ease at which he explains the concepts and the whirlwind tour he takes the reader through. The whirlwind tour is the second good thing since the reader gets started programming right away and dives into a practical project. If you are a beginning web developer, this book is well suited to your experience level. Unfortunately, for the beginner (and probably more advanced readers), the book has some drawbacks. I'm not sure Burnham knew exactly who to write the book for. At some points, you need to understand some JavaScript to know what's going on and at others, the author goes to some length to explain aspects of HTML and CSS (which I would presume the reader should know if they're taking on a web development programming language).

I don't mind books for beginners and in fact, I encourage them, and as an author, I can certainly understand when a publisher asks that you limit your page count to under 150 and thus limit the scope of your book, but it's as if Burnham couldn't decide how to best make use of his 138 pages. While it's good not to overwhelm novice programmers with a lot of details, beginners also tend to get confused easily if tasks and concepts are not sufficiently explored. Based on his writing style and presentation, it seems like Burnham is probably a very likable and knowledgable person, so I hate to give his book a less than stellar rating, but with CoffeeScript, JavaScript as well as jQuery, HTML, and CSS all tossed into the middle of the salad, it was hard to see the overall focus of this small text.

I do like that the book devoted itself to creating a single product (a simple game) throughout the chapters and allowed the reader to make and refine this game as a way to learn basic CoffeeScript, but in my opinion, the book is as frustrating as it is illuminating. If you're interested in learning CoffeeScript and you have at least a little programming experience, I won't say not to buy Pragmatic's CoffeeScript book, but I would recommend also spending a lot of time at coffeescript.org which, in and of itself, isn't a bad way to learn this language.

Wednesday, September 16, 2009

The CSS Anthology: 101 Essential Tips, Tricks & Hacks

Author: Rachel Andrew
Paperback: 400 pages
Publisher: SitePoint; 3rd edition (July 28, 2009)
ISBN-10: 0980576806
ISBN-13: 978-0980576801

I previously reviewed the 2nd edition of this book, so I was interested in what was changed and/or added in its current incarnation. Of course, the release of Firefox 3 and IE 8 are enough to warrant an updating of "tips and tricks" relative to CSS and web design, but was there more? The back cover blurb didn't indicate such, but I looked further.

The Preface seemed a likely place to start. There is no What has changed in this book section. The What's Covered in this Book? portion is a detailed summary of the TOC, but doesn't mention how chapters here compare to those in the prior edition. The Who Should Read this Book? piece is as you might expect: aimed at people who need to use CSS, such as designers and developers, and who don't need a lot of hand holding. Sorry if that sounds "snarky", but this book has always been about getting up to speed fast and dispensing with high level explanations and theory.

Chapter 1 is actually a quick tutorial on CSS, if you need a bit of a refresher. That shouldn't really include the main audience for this book, but there will be people who buy Andrew's text who might benefit. Chapter 2 also tends towards "the basics" as the title indicates: Text Styling and Other Basics. Fortunately, this chapter is also the start of the "anthology" content of the book, offering information formatted as Question, Solution, and Discussion. The Discussion part of each "tip" is certainly the largest, containing information on any specifics, curve-balls, and gotchas that may be contained in the particular technique involved.

Chapters are organized into functions such as Navigation, Tabular Data, Forms and User Interfaces, and so on, so if you have an area of interest or need, just shoot right to the relevant chapter, and then find the required task. Chapter 6 is the "Forms" chapter, but is really only half the story. Yes, it covers the browser end of forms, but of course, they won't really work unless you have the server side configured as well (think PHP, for instance). In that sense, the chapter and the book operate as one piece in the larger puzzle of web design and development. It's also a reference by design, so don't imagine that it's the first book you'll need to learn CSS.

I was mainly interested in Chapter 7: Cross-browser Techniques, since that's the primary reason for issuing another edition of this book. Designing websites for different platforms requires the designer to think in very broad terms, depending on the designer's audience. You have to address the most widely used browsers (unless you're serving a niche market), plus consider both PC/Mac, and mobile device platforms, if you care about that sort of thing. A common newbie designer mistake, is to create a site and test it on only one browser (and only one version of that browser), and only one OS. I've created what I thought of as a beautiful site when viewed in Firefox on Linux, but that turned out to be a "problem child" when I looked at it in IE 7 on XP. Andrew includes a nice little table on page 220, outlining the various browser and OS platforms to consider, including Safari, Chrome, and Konqueror, so a lot of thought has been given to this matter.

Chapter 7 is the "testing" chapter, instructing the reader on the options for being able to view their creations on Windows, Linux, and Mac (Linux live CDs, dual booting options, and so on). We are all some kind of "user". I tend to be a Linux user, but my wife exclusively uses Windows, and my daughter tends towards Mac. Developers have preferences as well, but letting those preferences dictate how you design and test can be a critical mistake, especially if you're doing this for money, and your company wants your product to work equally well for all customers.

I've read bad reviews on the previous edition of this book but, in my opinion, it was the reviewers who made the mistake. Their basic assumption was that they could learn CSS, more or less from scratch, by reading Andrew's text. This is not the intent of this book. If you know little or nothing about web design in general, and CSS in particular, acquire those skill sets first. This book is intended to help the reader solve specific problems, relative to the latest OS, browser, and hardware platforms, not to be a general introduction to the topic.

SitePoint offers a couple of forums to support the book, which is great, since I sometimes have questions about content that I can't get answered any other way. I did find the pop-ups on the forums rather annoying, though. Nice that you want to market your books, SitePoint, but if I'm on your site, I'm already aware of them and interested. Don't kill the "magic" by being too commercial.

If previous reviews of a book are good (as is the case with this book), then usually (unless the publisher or author decided to completely throw a monkey wrench into the machine) subsequent editions will maintain the quality. Fortunately for SitePoint and Andrew, the 3rd edition is up to snuff. If you fit the audience profile, and need to update your CSS skills for the most current browsers and so forth, The CSS Anthology: 101 Essential Tips, Tricks & Hacks should be on your wish list.

Share/Bookmark

Tuesday, July 7, 2009

Even Faster Web Sites: Performance Best Practices for Web Developers

Author: Steve Souders Format: Paperback, 254 pages Publisher: O'Reilly Media, Inc. (June 18, 2009) ISBN-10: 0596522304 ISBN-13: 978-0596522308 Apparently the move from Yahoo! to Google has been good to Souders (as you might expect). Now working for Google on web performance, he's written a sequel to his January 2008 book, High Performance Web Sites (Souders was working for Yahoo! at the time) which I previously reviewed. According to the Product Description, "Souders' previous book, the bestselling High Performance Web Sites, shocked the web development world by revealing that 80% of the time it takes for a web page to load is on the client side". Sounds pretty dramatic, especially for a technical book. I don't know if I was "shocked" when I read Souders' prior book, but I was impressed. How does his follow up effort measure up? Whenever I write a book, I usually mention that it takes a team to write a book, even if only one person's name is on the cover. As it turns out, besides Souders, there are eight other direct contributors to Even Faster Web Sites including Ben Galbraith, co-director of developer tools at Mozilla and Dylan Schiemann, co-founder of the Dojo Toolkit. The "dark side" of multiple contributors is sometimes a lack of focus or continuity in a book. The upside is including the wisdom and experience of numerous subject-matter experts. As with the previous Souders book, there's no explicit "who is the book for" section in the front matter, but the subtitle "Performance Best Practices for Web Developers" makes it obvious who should be reading this book. The idea, as with the prior book, is to develop web sites using practices that allow your sites to load and perform with the minimal amount of load on the client-side. With competing interests such as style, theme, content, and general "eye candy", this isn't as easy as it sounds. High Performance Web Sites (sorry, it's hard to review this book without referring to its predecessor) was a straight-forward 14 step (one chapter per step) sequence in how to improve web site performance. Even Faster Web Sites goes beyond what you might think of as "straight-forward", which isn't a bad thing, but it might make some of the techniques less accessible to the less experienced developer. With that in mind, if you're just starting out developing web sites, read High Performance Web Sites before moving on to this book. Reading the two books "in order" isn't absolutely necessary, but it might make more sense if you're new to the game. Experienced players may do as you wish. The reader will need to know more than just vanilla HTML/CSS/JavaScript to get the most out of this text. While topics such as Optimizing Images (Chapter 10) may not seem complex "programmatically", Coupling Asynchronous Scripts (Chapter 5) and Writing Efficient JavaScript (Chapter 7) will be more challenging if you're not already familiar with the subject matter. I suppose you could say that this book has been "written by professionals for professionals", but I think that tagline is used by a different publisher. I also have to say that, despite multiple contributors, the overall "feel" of the book wasn't disjointed and, while you can read the entire book cover-to-cover, experienced developers can also zero in just on specific topics of interest. The Appendix contains a list of various performance assessment tools which, in and of themselves, requires a bit of experience or experimentation to get a feel for. Other "value added" pieces include Souders' Web Site dedicated to the book and the O'Reilly site for the book. The former is a series of blog articles on the information presented in the text, including comments, while the latter is the standard "this is one of our books" pages, where you can read/submit errata, register the book, and so on. You'll probably get more mileage out of Souders' blog, since it contains more behind-the-scenes insights into the material. Don't read this book if you're just getting a handle on designing and developing your first few web sites, however once you have experience and have a solid grounding in "coding for the web", I think you'll benefit from Even Faster Web Sites. If you are a professional web developer, you definitely will benefit.

Monday, February 23, 2009

Review: Python Web Development with Django

Authors: Jeff Forcier, Paul Bissex, and Wesley Chun Format: Paperback, 408 pages Publisher: Addison-Wesley Professional; 1st edition (November 3, 2008) ISBN-10: 0132356139 ISBN-13: 978-0132356138 I have something of a relationship with both Python and Django, the latter because I use Django more or less regularly to contribute my portion of an application (which shall remain nameless for the moment) that my company ("my" in the sense that I work there, not that I actually own anything) is developing. I'm already sold on the relative simplicity and power of Python based on my attempts to hammer away with the language, so this book, at least as far as the topic is concerned, is everything I could ask for. But can the same be said for the content of the book? I was going to say "first things first" and then proceed to the target audience for the book, but there's another point to make before that. The little "button" on the front cover says "Covers Django 1.0". I visited the Django Project and on the download page (as of this morning, February 23rd) it says, "The latest official version is 1.0.2. Here's how to get it". Assuming you want to use the latest version of Django, having a book that presents the latest information (well, as recent as any print documentation can be) is an enormous advantage. As a small aside, the download page also states, "Python version 2.3 or higher" is required, so you don't have to be using latest version of the non-backward compatible Python 3 to use the latest version of Django (of course "or higher" can be interpreted more than one way). The second page of the Preface does something cool, if you aren't sure how much of this book applies to you. There's a little diagram that outlines the four skill/experience levels for readers, and which chapters are relevant to you depending on which level applies to you. "Brand New to Django and Python" starts you off at Chapter 1 which is to be expected, but some Python experience (but no Django) gets you going, starting at Chapter 2. Some experience with both puts you beginning at Chapter 4, and advanced learners can skip ahead to Chapter 11. At least as far as the authors' predictions go, this book has something for everyone. The book has a website, which is more or less expected these days. http://withdjango.com/ contains "auxiliary material" that is referenced in different sections of the book. Click the "Material for Readers" link and you're taken to links called "Extra resources" and "Source code downloads"; the meaning of the latter link being quite obvious. The page that becomes available by clicking the former link is a "linkfest" of Python and Django resources of every conceivable type, even if they are only barely related to the topic at hand (such as links to the official Firefox, jQuery, and Vim websites). However, back to the book. As previously mentioned, this book has something for everyone, even if you aren't familiar with Python. I say "everyone" in the context some people who have some coding experience and frankly, I wouldn't recommend this book as your first experience with Python if you hope to really learn the language. As author Wesley Chun can attest, entire books have been written on Python, so please don't assume that a single chapter will tell you all you'll need to know. That said, it should teach the experienced programmer what they'll need to know as far as a foundation for working with Django. I do recommend picking up a Python tome of some sort to strengthen that foundation, however. The 56 pages comprising Chapter 1 are just enough to whet the appetite. Chapter 2 is aptly named, "Django for the Impatient: Building a Blog". Most people learning a new technology, myself included, want to get at it right away. Few things are more frustrating than picking up a book expecting to learn to actually do something, and then discovering you have to wade through 200 to 300 pages of concept and theory before you learn to even say "Hello World!". In fact, this chapter almost literally has the reader "hitting the ground running" by putting him or her on a "deadline" to see how fast they can build a simple blog using Django. You've only got 19 pages, so you'd better hurry. Only when you've accomplished this task are you ready (according to the book) to really get started using Django as Chapter 3, "Starting Out" testifies to. You might think it's a step back, because the chapter is mostly concept, but hopefully you'll still be basking in the glow of building that first blog with Django, so moving through a concept chapter won't be as much of a chore. With the foundation now firmly laid, the book proceeds to more in-depth information. The book tries to create a balance between concept and practice and it's a delicate balance indeed. I'm not sure it's entirely successful, but it does its best. If you're looking for a simple "how to" book, this might be a disappointment. The book presents both the "how" and the "why" of Python and Django. Also, although some "beginner" information is presented early in the book, as I said before, don't let this book be your first and only Python learning experience. Without some additional background, you are going to become quickly lost as you advance through the latter pages of this text. At only 408 pages including the appendix sections, you dare not blink while reading this book. All of the relevant information is present and accounted for, but there's no fluff or padding to cushion you. Section Five is complete with a number of "Appendices" (or "Appendixes", take your pick) including "Command Line Basics", the obligatory "Installing and Running Django", and so on. This should help the beginner become reoriented, if they've lost their course somewhere in the book. If you have some programming and web development background, even if Python and Django are new to you, this book should be very helpful, as long as you can tolerate it's laser-like focus and intensity. If you have Python experience, so much the better. If you find yourself slowly getting in over your head, try reading books like Chun's Core Python Programming (2nd Ed) or Mark Lutz's Learning Python before proceeding with the Django book. Whatever you do though, have fun.

Monday, February 9, 2009

Review: Head First Web Design

Authors: Ethan Watrall and Jeff Siarto Format: Paperback, 495 pages Publisher: O'Reilly Media, Inc. (January 2, 2009) ISBN-10: 0596520301 ISBN-13: 978-0596520304 I recently reviewed Creating a Web Site: The Missing Manual and thought a review of this Head First book would be in order. While you might say that both of these books cater to beginners who don't have a history of creating and maintaining web site, you can also say that each book caters to its own special audience. Actually, these two books have two different audiences in more than one way. The Head First series, as I mentioned in my review of Head First Algebra, tends to be best used by younger people. A high school age audience is ideal and if you have been diagnosed with the dreaded initials "A-D-H-D", so much the better. All of the pictures, drawings, arrows, puzzles, and other input types are just great if you normally hate sitting still for more than a few minutes at a time reading straight text. However, as I glanced through the front matter of Watrall and Siarto's book, I got a mild shock. They didn't write this text for the "right-at-the-starting-gate" beginner. Specifically, the book assumes you have prior experience with XHTML (the most recent "buzzword" for HTML that conforms to the latest standards) and CSS, plus have some knowledge of PHP, .NET, and/or Ruby on Rails. If you don't fit this description, the publisher recommends picking up a copy of Head First HTML with CSS & XHTML to get started. So just what does this "web design" book teach? The book proposes to take up where designing a static HTML/CSS site leaves off. Specifically, to teach how to design and develop web sites for the professional or the wannebe-professional web designer. Your first clue that this Head First book is different from the rest of its siblings is that it's in color. I know it's an odd detail to mention, but all of the other Head First books I've seen to date have been strictly monochrome. It never occurred to me that color would be an option in this series (unless there's such a book as "Head First Color Digital Photography"). Relative to the audience-type I mentioned before, this isn't the easiest subject to teach, even in the Head First format. Action-oriented readers are doers, not necessarily planners, and designing professional web sites requires a lot of planning. Chapter 1 covers how to storyboard a proposed web site, which is a necessary first step in many artistic projects. This is contrary to the artist who, extending the metaphor, would rather grab a blank canvas and some paints and start spontaneously creating. Of course, using this approach, you don't always know what you'll end up with until it happens. With designing web sites, and particularly for people who are paying you, this isn't always the best option. While the web pages and some of the diagrams are better rendered in color for the sake of this book, I'm not sure that goes for the photos of the actual people (models). They tend to work better, at least for me, when they retain a more monochrome effect. It makes them easier to take, given their lack of surroundings. In fact, as I made my way through more of the book, I realized that I was having trouble shifting back and forth between the reality that color lends to screenshots of web sites and the more "cartoony" feel of the rest of the Head First format. I agree, it's better to "tell this tale" in color rather than monochrome, but it creates another problem. I found myself wondering if the reader, having become at least competent in basic XHTML/CSS and one or more programming languages, might be better served by "graduating" to a more standard web design/development text. I think of the Head First series as a single stepping stone for a person at a particular stage in their cognitive development (which is different than intelligence) that needs information served up in a particular format at this time in their life. Once they progress beyond that developmental milestone, they will be able to tolerate more "standard" information streams. This Head First book comes closer to the border between its realm and the realms covered by those other info streams than I would have expected. My basic assumption though, could be flawed. I have assumed that people "grow out of" needing to have all or most of their information provided the way the Head First series offers learning. On the other hand, how many people actually prefer the "video game" method of learning their entire lives? Is this also a generational difference in learning styles and that I'm on the wrong side of that particular line? No, otherwise, no one in their 20s could learn from any of O'Reilly's "The Definitive Guide" or "Cookbook" series, among others, and I know that's not true. The book might have been better titled "Head First Professional Web Design", since "web design" as a term, covers a wide field. Maybe that's what threw me off. While I, as an individual learner, am not often best served by this series (the Algebra book being the exception), this web design book seems to almost be pulling the audience away from a strict "Head First" learning model and encouraging them to take the next step. The "atypical-ness" of this one Head First book is being reflected in the difficulty I'm having in reviewing it. It's not that the book doesn't teach its subject well, it's just that the book has to bend it's own series format rules in order to do a good job. Could the audience have taken the next step on their own and just learned the same content from a different book? I'm not sure. Maybe the book serves those people who are used to and like the Head First format and don't feel ready to move away from it...even though they are. Is this book a good teacher for its audience? Probably. It just seems that, in order for the authors to teach this topic, they needed to appeal to the audience to stretch beyond what Head First normally offers. That may mean that Head First has an upper limit for what it can teach. As I review more in this series, I'll see if there's a point past which it cannot go.