Realm of Racket: Learn to Program, One Game at a Time – #Racket #game #programming #bookreview

Realm of Racket
Learn to Program, One Game at a Time!

Matthias Felleisen, David Van Horn, Conrad Barski, M.D., Forrest Bice, Rose DeMaio, Spencer Florence, Feng-Yun Mimi Lin, Scott Lindeman, Nicole Nussbaum, Eric Peterson, and Ryan Plessner
(No Starch Press – paperback, Kindle)

Formerly known as PLT Scheme, Racket is an offshoot of the Lisp/Scheme family of programming languages. (Lisp, which was first specified in 1958, is the second-oldest high-level programming language, behind FORTRAN).

The (numerous) authors of this 294-page book call Racket “a friendly mutation of Lisp” and tout it as “perfect for all, from those who want to launch their education in computer science to those looking to expand their knowledge and experience in programming.”

Lisp has a long learning curve, so the writers have taken special pains to try to make Racket (“a weird-looking programming language,” they concede) approachable and fun by using comics and games built from short code examples.

Their well-written book is aimed at college freshmen readers. But they emphasize “that doesn’t mean you should drop this book if you are a sophomore or an industry professional.” Nor if you are still in high school or simply like to tinker with programming languages for fun and challenge.

“Regardless of your programming background,” they state, “many of the topics in this book will be new to you, and much of what you’ve learned before will appear in a new light.”

Realm of Racket is structured so that you start out programming very simple games and gradually tackle games that are more complex, while learning about such topics as functions, recursion, lambda, lists, structures, loops, testing, and more.

If you are interested in developing special-purpose computer languages that require specific knowledge of specialized fields, Realm of Racket’s  final chapter briefly delves into the field of language engineering. It notes that Racket “makes it particularly easy to create new programming languages, including special-purpose languages.”

Not surprisingly, some people who program in Racket call themselves Racketeers. The open source language and its program development environment (PDE), DrRacket (“Doctor Racket”), can be downloaded from http://racket-lang.org. “Racket can run on Windows, Mac, and *nix* systems,” the authors note.

Realm of Racket can be a fun, challenging book for computer-savvy teens nearing the end of high school or in their first years of college to study computer science or gaming. Younger readers likely won’t stick with it unless they have some helpful, patient guidance from knowledgeable older siblings or adults. Wait until they’ve gotten reasonably good at another language, such as Python, Ruby, C#, or Java, first.

Si Dunn

Hands-on Testing with PHPUnit How-to – A short, well-focused guide – #programming #bookreview

Instant Hands-on Testing with PHPUnit How-to
A practical guide to getting started with PHPUnit to improve code quality
Michael Lively
(Packt Publishing – paperback, Kindle)

PHPUnit is considered by many to be the leading tool for testing PHP code. This “Short, Fast, Focused” book (82 pages digital, 69 pages in paperback) is a recent addition to Packt Publishing’s “Instant” series. It zeroes in on how to install and use PHPUnit to create and run “easy-to-maintain tests.”

One strength of Michael Lively’s new book is his experience with PHP and PHPUnit. Another strength is the book’s step-by-step structure. It rates each key step as “Simple”, “Intermediate”, or “Advanced” and provides subheadings such as “Getting ready…”, “How to do it…”, “How it works…”, and “There’s more…” to help keep descriptions short and clear.

Code examples and screenshots also help the reader get comfortable with running tests using the PHPUnit framework.

Aside from skipping commas in some of the text, Michael Lively’s writing is clear and concise, and his descriptions and code examples have been reviewed by two experienced software developers.

The book is “written for anyone who has an interest in unit testing but doesn’t necessarily know where to start in integrating it with their project,” Lively states.

“It will provide useful tips and insights into how PHPUnit can be used with your projects and it should give you enough information to whet your appetite for the various features offered by PHPUnit.”

The code examples in Lively’s book “were written using PHP 5.3.24 and PHPUnit 3.7. All code samples were verified against a Linux box with Ubuntu 12.04 LTS.”

As with several other Packt books recently reviewed, if you use a Windows PC or a Mac instead of a Linux system, you pretty much are left on your own to figure out the installation process and certain commands.

–   Si Dunn

Functional JavaScript – Applying functional techniques and Underscore.js – #programming #bookreview

Functional JavaScript
Introducing Functional Programming with Underscore.js
Michael Fogus
(O’Reilly – paperback, Kindle)

When I first started tinkering with JavaScript, object-oriented programming (OOP) was the rage, and JavaScript frequently was touted as one of the key object-oriented languages. After all, according to many online descriptions, almost everything within JavaScript “is OO.”

Now, in this enjoyable new book, JavaScript is hailed as a functional programming language. Of course, functional programming recently has been the rage in many programming circles. And “enjoyable” may seem an odd word to attach to a software text. Yet, it fits. Michael Fogus shows here that he is a technical writer who can be entertaining, effective and well-organized.

“This book,” he states, “is not about spewing dogma regarding the virtues of functional programming. I think there are many functional techniques that offer ways to rein in the complexities of software development, but I realize that at times, there are better ways to implement any given individual part.”

It is possible, of course, to debate object-oriented vs. functional JavaScript until the digital cows are called back home and put into infinite loops. But, for those who don’t know or care much about the differences, here are some basic views.

The Mozilla Developers Network (to simply pick  one example) discusses objected-oriented JavaScript on its site and declares: “Object-oriented programming may be seen as the design of software using a collection of cooperating objects, as opposed to a traditional view in which a program may be seen as a collection of functions, or simply as a list of instructions to the computer. In OOP, each object is capable of receiving messages, processing data, and sending messages to other objects. Each object can be viewed as an independent little machine with a distinct role or responsibility.”

Meanwhile, HaskellWiki offers this explanation of functional programming: “In functional programming, programs are executed by evaluating expressions, in contrast with imperative programming where programs are composed of statements which change global state when executed. Functional programming typically avoids using mutable state.

“Functional programming requires that functions are first-class, which means that they are treated like any other values and can be passed as arguments to other functions or be returned as a result of a function. Being first-class also means that it is possible to define and manipulate functions from within other functions.”

Some of the programming languages typically labeled “functional” include Clojure, OCaml, Erlang,  Haskell, Scala, and F#.

Here is how Michael Fogus defines functional programming:

“As a bare-bones introduction, functional programming can be described in a single sentence:

Functional programming is the use of functions that transform values into units of
abstraction, subsequently used to build software systems.

“This is a simplification bordering on libel,” he continues, “but it’s functional (ha!) for this early stage in the book. The library that I use as my medium of functional expression in JavaScript is Underscore, and for the most part, it adheres to this basic definition.”

(Underscore.js can be obtained from http://underscorejs.org and imported into “the applicable project directories.”)

Fogus refuses, in his text, “to create a false dichotomy and say that functional and object-oriented styles should stand in opposition.” Indeed, he notes that JavaScript supports both models and “systems can and should be composed of both models.”

He also points out that JavaScript can be used with other paradigms, including imperative programming, prototype-based object-oriented programming, and metaprogramming.

“In no way does this book represent even a modicum of original thinking regarding functional programming in JavaScript,” he states. Yet, it is a worthy effort.

It is well written, smoothly organized, and nicely illustrated with short code examples and helpful diagrams. And Fogus notes that JavaScript does have “[l]anguage oddities, unsafe features, and a sea of competing libraries” that raise concerns when it is selected for a project. Functional programming, he contends, can be one way to help ensure that JavaScript “can be not only safe, but also simple to understand and test, in addition to being proportionally scalable to the size of the code base.”

Here is the chapter lineup for Fogus’s 237-page book:

  • Chapter 1. Introducing Functional JavaScript
  • Chapter 2. First-Class Functions and Applicative Programming
  • Chapter 3. Variable Scope and Closures
  • Chapter 4. Higher-Order Functions
  • Chapter 5. Function-Building Functions
  • Chapter 6. Recursion
  • Chapter 7. Purity, Immutability, and Policies for Change
  • Chapter 8. Flow-Based Programming
  • Chapter 9. Programming without Class

Functional JavaScript is a winner on at least two counts: (1) as a how-to text for long-time JavaScript programmers wishing to learn more about functional programming; and (2) as a how-to text for long-time functional programmers desiring to learn more about JavaScript.

The book is not recommended for JavaScript newcomers who are still at the level of typing console.log(“The answer to everything in the universe is 42″). However, experienced beginners can learn from it, and so can those of us who just tinker with JavaScript periodically and use it mainly to work with Node.js, Backbone.js, Ember.js, CoffeeScript, HTML and other choices.

Si Dunn

Python Cookbook, 3rd Edition – Breaking Away from Python 2 to Python 3 – #programming #bookreview

Python Cookbook, 3rd Edition
David Beazley & Brian K. Jones
(O’Reilly - paperback, Kindle)

PYTHON 3 users will be very pleased with this new book. Those who still cling to Python 2 likely will not.

Even though “most working Python programmers continue to use Python 2 in production,” its authors concede, and “Python 3 is not backward compatible with past versions,” this third edition of the popular Python Cookbook is intended to be used only with Python 3.3 and above.

“Just as Python 3 is about the future, this edition…represents a major change over past editions,” Beazley and Jones state. “First and foremost, this is meant to be a very forward looking book. All of the recipes have been written and tested with Python 3.3 without regard to past Python versions or the ‘old way’ of doing things. In fact, many of the recipes will only work with Python 3.3 and above.”

THEIR “ultimate goal,” they point out, was “to write a book of recipes based on the most modern tools and idioms possible. It is hoped that the recipes can serve as a guide for people writing new code in Python 3 or those who hope to modernize existing code.”

The 687-page Python Cookbook, 3rd Edition is not intended for beginning programmers. However, beginners can learn a few things from it and keep the book on their shelves for future use as they gain experience with Python 3.

And, it can be a helpful guide if you are working to update some Python 2 code to Python 3. According to the authors, “many of the recipes aim to illustrate features that are new to Python 3 and more likely to be unknown to even experienced programmers using older versions.”

THE book offers 15 chapters of how-to recipes organized into the following major categories:

  1. Data Structures and Algorithms
  2. Strings and Text
  3. Numbers, Dates, and Times
  4. Iterators and Generators
  5. Files and I/O
  6. Data Encoding and Processing
  7. Functions
  8. Classes and Objects
  9. Metaprogramming
  10. Modules and Packages
  11. Network and Web Programming
  12. Concurrency
  13. Utility Scripting and Administration
  14. Testing, Debugging, and Exceptions
  15. C Extensions

Each of the approximately 260 recipes is presented using a “problem-solution-discussion” format. Here are a few recipe titles chosen at random:

  • “Combining and Concatenating Strings”
  • “Reformatting Text to a Fixed Number of Columns”
  • “Bypassing Filename Encoding”
  • “Iterating over the Index-Value Pairs of a Sequence”
  • “Capturing Variables in Anonymous Functions”
  • “Implementing Stateful Objects or State Machines”
  • “Enforcing an Argument Signature on *args and **kwargs”
  • “Creating Custom Exceptions”
  • “Writing a Simple C Extension Module”

SOME of the book’s code examples are complete. But others, the authors caution, “are often just skeletons that provide essential information for getting started, but which require the reader to do more research to fill in the details.”

If you are serious about Python and keeping pace with its progress, you should seriously consider getting this excellent how-to book.

Si Dunn

Creating Mobile Apps with jQuery Mobile – A good & wide-ranging how-to guide – #programming #bookreview

Creating Mobile Appls with jQuery Mobile
Shane Gliser
(Packt Publishing – paperback, Kindle)

The long tagline on the cover of Shane Gliser’s new book deftly sums up its contents:  “Learn to make practical, unique, real-world sites that span a variety of industries and technologies with the world’s most popular mobile development library.”

Gliser unabashedly describes himself as a jQuery “fanboy…if it’s officially jQuery, I love it.” He is an experienced mobile developer and blogger who operates Roughly Brilliant Digital Studios. He also has some background in mobile UX (user experience).

Both aspects of that background serve him well in his smoothly written, nicely illustrated how-to book that zeroes in on jQuery Mobile, a  “touch-optimized” web framework for smartphones and tablets.

You may be surprised when you extract the 234-page book’s code examples and related items and find that the ZIP file is almost 100MB in size. Gliser covers a lot of ground in his 10 chapters. And each chapter contains a project.

Still, what you don’t do in the first chapter, “Prototyping jQuery Mobile,” is work at a computer. In the true spirit of UX, Gliser has you start first with a pen and some 3×5 note cards. Your goal is to rough out some designs for a jQuery Mobile website for a new pizzeria.

Why the ancient technology? “We are more willing to simply throw out a drawing that took less than 30 seconds to create,” Gliser writes. Otherwise, it’s too easy to stay locked into one design while trying different ways to make its code work. And: “Actually sketching by hand uses a different part of the brain and unlocks our creative centers.”

Best of all, working first with paper sketches enables team members who are not coders to contribute some comments, suggestions, and corrections for the emerging design.

In Chapter 2, “A Mom-and-Pop Mobile Website,” you step over to your computer with the paper prototype in hand and start converting the final design “into an actual jQuery Mobile (jQM) site that acts responsively and looks unique.” You also begin building “a configurable server-side PHP template,” and you work with custom fonts, page curl effects using CSS, and other aspects of creating and optimizing a mobile site.

“Mobile is a very unforgiving environment,” Gliser cautions, “and some of the tips in this section will make more difference than any of the ‘best coding practices.’” Indeed,  he wants you to be aware of optimization “at the beginning. You are going to do some awesome work and I don’t want you or your stakeholders to think it’s any less awesome, or slow, or anything else because you didn’t know the tricks to squeeze the most performance out of your systems. It’s never too early to impress people with the performance of your creations.”

Chapter 3, “Analytics, Long forms, and Front-end Validation,” moves beyond “dynamically link[ing] directly into the native GPS systems of iOS and Android.” Instead, Gliser introduces how to work with Google static maps, Google Analytics, long and multi-page forms, and jQuery Validate. As for static maps, he says, “Remember to always approach things from the user’s perspective. It’s not always about doing the coolest thing we can.” Indeed, a static map may be all the user needs to decide whether to drive to a business, such as a pizzeria, or just call for delivery. And, as for Google Analytics: “Every website should have analytics. If not, it’s difficult to say how many people are hitting your site, if we’re getting people through our conversion funnels, or what pages are causing people to leave our site.”

Meanwhile, desktop users are familiar with (and frequently irritated by) long forms and multi-page forms. Lengthy forms can be real deal-breakers for users trying to negotiate them on mobile devices. The author presents some ways to shorten long forms and break them “into several pages using jQuery Mobile.” And he emphasizes the importance of using the jQuery Validate plug-in to add validation to any page that has a form, so the user can see quickly and clearly that an entry has a problem.

The focus in Chapter 4, “QR Codes, Geolocation, Google Maps API, and HTML5 Video,” is on handling concepts that can be “applied to any business that has multiple physical locations.” Gliser uses a local movie theater chain as his development example. A site is created that makes use of QR codes, geolocation, Google Maps, and linking to YouTube movie previews. Then, he shows how to use embedded video to keep users on the movie chain’s site rather than sending them off to YouTube.

In Chapter 5, the goal is “to create an aggregating news site based off social media.” So the emphasis shifts to “Client-side Templating, JSON APIs, and HTML5 Web Storage.” Notes Gliser: “Honestly, from a purely pragmatic perspective, I believe that the template is the perfect place for code. The more flexible, the better. JSON holds the data and the templates are used to transform it. To draw a parallel, XML is the data format and XSL templates are used to transform. Nobody whines about logic in XSL; so I don’t see why it should be a problem in JS templates.”

Next, he shows how to patch into Twitter’s JSON API to get “the very latest set of trending topics” and “whittle down the response to only the part we want…and pass that array into JsRender for…well…rendering” in a manner that will be “a lot cleaner to read and maintain” than looping through JSON and using string concatenation to make the output.

Other topics in Chapter 5 include programmatically changing pages in jQuery Mobile, understanding how jQuery Mobile handles generated pages and Document Object Model (DOM) weight management, and working with RSS feeds. Gliser points out that there is still “a lot more information out there being fed by RSS feeds than by JSON feeds.” The chapter concludes with looks at how to use HTML5 web storage (it’s simple, yet it can get “especially tricky on mobile browsers”), and how to leverage the Google Feed API. Says Gliser: “The Google Feeds [sic] API can be fed several options, but at its core, it’s a way to specify an RSS or ATOM feed and get back a JSON representation.”

Chapter 6 jumps into “the music scene. We’re going to take the jQuery Mobile interface and turn it into a media player, artist showcase, and information hub that can be saved to people’s home screens,” Gliser writes. He proceeds to show how “ridiculously simple it can be to bring audio into your jQuery Mobile pages.” And he explains how to use HTML5 manifest “and a few other meta tags” to save an app to the home screen. Furthermore, he discusses how to test mobile sites using “Google Chrome (since its WebKit) or IE9 (for the Windows Phone)” as browsers that are shrunken down to mobile size. “Naturally, this does not substitute for real testing,” he cautions. “Always check your creations on real devices. That being said, the shrunken browser approach will usually get you 97.5 percent of the way there. Well…HTML5 Audio throws that operating model right out the window.”

Since “mobile phones are quickly becoming our photo albums,” Gliser’s Chapter 7, “Fully Responsive Photography,” shows first how to create a basic gallery using Photoswipe. Then, in a section focused on “supporting the full range of device sizes,” he explains how to start using responsive web design (RWD), “the concept of making a single page work for every device size.” The issues, of course, range from image sizes and resolutions to text sizes and character counts per line, on screens as small as smart phones and tablets, or larger.

In Chapter 8, “Integrating jQuery Mobile into Existing Sites,” three topics are key: (1) “Detecting mobile – server-side, client-side, and the combination of the two”; (2) “Mobilizing full site pages – the hard way”; and (3) Mobilizing full site pages – the easy way.” Gliser avoids some potential “geek war” controversies over “browser sniffing versus feature detection” when detecting mobile devices. He zeroes in first on detection using WURFL for “server-side database-driven browser sniffing.” He also shows how to do JavaScript-based browser sniffing, which he concedes may be “the worst possible way to detect mobile but it does have its virtues,” especially if your budget is small and you want to exclude older devices that can’t handle some new JavaScript templating. He also describes JavaScript-based feature detection using Modernizer and some other feature-detection methods.

As for mobilizing full-site pages “the hard way,” he states that there is really “only one good reason: to keep the content on the same page so that the user doesn’t have one page for mobile and one page for desktop. When emails and tweets and such are flying around, the user generally doesn’t care if  they’re sending out the mobile view or the desktop view and they shouldn’t.” He focuses on how “it’s pretty easy to tell what parts of a site would translate to mobile” and how to add data attributes to existing tags “to mobilize them. When jQuery’s libraries are not present on the page, these attributes will simply sit there and cause no harm. Then you can use one of our many detection techniques to decide when to throw the jQM libraries in.”

Mobilizing full-size pages “the easy way” involves, in his view, “nothing easier and cleaner than just creating a standalone jQuery Mobile page…and simply import the page we want with AJAX. We can then pull out the parts we want and leave the rest.” His code samples show how to do this.

Chapter 9, “Content Management Systems and jQM” looks at the pros and cons of using three different content management systems (CMS) with jQuery Mobile: WordPress, Drupal, and Adobe Experience Manager. “The key to get up and running quickly with any CMS is, realizing which plugins and themes to use,” Gliser writes.  He also explains how to use mobile theme switchers.

Drupal offers some standard plugins that provide contact forms, CAPTCHA, and custom database tables and forms, and enable you to “create full blown web apps, not just brochureware sites,” he notes. But: “The biggest downside to Drupal is that it has a bit of a learning curve if you want to tap its true power, Also, without some tuning, it can be a little slow and can really bloat your page’s code.” .

As for Adobe Experience Manager (AEM), Gliser merely introduces it as a “premier corporate CMS” and a “major CMS player that comes with complete jQuery Mobile examples.” He doesn’t show “how to install, configure, or code for AEM. That’s a subject for several training manuals the size of this book.”

Chapter 10, the final chapter, is titled “Putting It All Together — Flood.FM.” Using what you’ve learned in the book (including prototyping the interfaces on paper first), you create “a website where listeners will be greeted with music from local, independent bands across several genres and geographic regions.” Along the way, Gliser introduces Balsamiq, “a very popular UX tool for rapid prototyping.” He discusses using Model-View-Controller (MVC), Model-View-ViewModel (MVVM), and Model-View-Whatever (MV*) development structures with jQuery Mobile. He shows how to work with the Web Audio API , and he illustrates how to prompt users to download the Flood.FM app to their home screens. He finishes up with brief discussions of accelerometers, cameras, “APIs on the horizon,” plus “To app or not to app, that is the question” and whether you should compile an app or not. Finally, he shows PhoneGap Build, the “cloud-based build service for PhoneGap.”

Bottom line: Shane Gliser’s book covers a lot of  useful ground for those who are ready to learn jQuery Mobile.

Si Dunn

Arquillian Testing Guide – For better integration testing & functional testing on the JVM – #programming #bookreview

Arquillian Testing Guide
John D. Ament
(Packt Publishing – Paperback, Kindle)

If you have some experience with integration testing and functional testing on a Java virtual machine (JVM), John D. Ament’s important new book can help you get up to speed with the Arquillian testing platform’s numerous features and capabilities.

Arquillian “leverages JUnit and TestNG to execute test cases against a Java container,” Ament explains. The Arquillian framework, he adds, has three major sections: “test runners (JUnit or TestNG), containers (Weld, OpenWebBeans, Tomcat, GlassFish, and so on), and test enrichers (integration of your test case into the container that your code is running in.)” Also: “ShrinkWrap is an external dependency for you to use with Arquillian; they are almost sibling projects. ShrinkWrap helps you define your deployments, and your descriptors to be loaded to the Java container you are testing against.”

Ament’s 224-page book shows how to write simple code for various Java application tests but also explains how to develop rich test cases that you can run automatically.

The author uses the JUnit test container in his examples but explains how you can use the TestNG test container, if you prefer.

While the book is aimed at readers with intermediate experience, newcomers to Java testing can learn from it, too. Before diving into the process of explaining Arquillian, Ament describes “the fundamentals of a test case,” from an Arquillian perspective, of course. And he devotes a chapter to “The Evolution of Testing,” from the early days of manually testing single units to the advent of automated testing with powerful new tools. (Manual testing, by the way, is still important and will not go away soon, Ament indicates. “There is likely no removing manual testing for functional applications,” he writes.

“Manual testing should be considered when performing user acceptance testing, where you need to validate that the application functions the way you would expect end to end. From a quality assurance standpoint, it’s the most direct way to make sure an application works the way expected.” But, he warns, “a developer shouldn’t wait until this point to begin testing….”

He also devotes a chapter to the basics and the process of container testing. “Arquilian is all about testing your code inside a container,” he says. “Containers represent what your application will run on.” His text examines each of the “three primary ways that Arquillian can interact with a container — embedded, managed, and remote.”

Embedded containers, he notes, “typically run on the same JVM as your test case. Next are managed containers, which Arquillian will start up for you during the test process and shut down after the tests are run but run in a different JVM. Finally, there are remote containers, which are assumed to be running prior to the test and will simply have deployments sent and tests executed.”

The book’s remaining chapters take the reader deeper into the testing processes and how to use of Arquillian’s features and extensions.

Arquillian is not software you can learn to use effectively in a single weekend of hacking. You must learn it by using it and using it a lot, Ament emphasizes. “Run as many tests as you can with Arquillian…[y]ou make the best use of Arquillian when you use it throughout 100 percent of your tests.”

Arquillian Testing Guide is available through several sources, including Amazon and Packt Publishing.

Si Dunn

Puppet 3 Beginner’s Guide – Automate configuration management & become a better system admin – #programming #bookreview

Puppet 3 Beginner’s Guide
John Arundel
(Packt Publishing – paperback, Kindle)

If you administer a small network built around just a few servers, you may still be doing at least some of the configuration management by hand. You literally move from machine to machine, manually entering updates, changes, or fixes. And your small network may be running several different brands–and vintages–of hardware and software, which complicates the update and repair process.

However, infrastructure consultant John Arundel warns, once you get “[b]eyond ten or so servers, there simply isn’t a choice. You can’t manage an infrastructure like this by hand. If you’re using a cloud computing architecture, where servers are created and destroyed minute-by-minute in response to changing demand, the artisan approach to server crafting just won’t work.”

In his new book, Puppet 3 Beginner’s Guide, Arundel emphasizes: “Manual configuration management is tedious and repetitive, it’s error-prone, and it doesn’t scale well. Puppet is a tool for automating this process.”

Among “UNIX-like systems,” there are at least three major configuration management (CM) packages, including Puppet. The others are Chef and CFEngine, plus a few more competitors. Arundel calls them “all great solutions to the CM problem…it’s not very important which one you choose as long as you choose one.” But he hopes, of course, you will favor Puppet and his well-written how-to guide.

Puppet 3 Beginner’s Guide is structured to help system administrators “start from scratch…and learn how to fully utilize Puppet through simple, practical examples,” he writes.

He places important emphasis on the rapidly closing “divide between ‘devs,’ who wrangle code, and ‘ops,’ who wrangle configurations. Traditionally, the skills sets of the two groups haven’t overlapped much,” he notes. “It was common until recently for system administrators not to write complex programs, and for developers to have little or no experience of building and managing servers.”

Today, system admins are “facing the challenge of scaling systems to enormous size for the web, [and] have had to get smart about programming and automation.” Meanwhile, “[d]evelopers, who now often build applications, services, and businesses by themselves, couldn’t do what they do without knowing how to set up and fix servers,” he says.

Therefore, “[t]he term ‘devops’ has begun to be used to describe the growing overlap between these skill sets…Devops write code, herd servers, build apps, scale systems, analyze outages, and fix bugs. With the advent of CM systems, devs and ops are now all just people who work with code.”

Arundel’s 184-page Puppet 3 Beginner’s Guide offers 10 chapters smoothly structured with headings, short paragraphs, code examples, and other illustrations. He has generated his code examples using the Ubuntu 12.04 LTS “Precise” distribution of Linux. But he explains how to load the software using “Red Hat Linux, CentOS, or another Linux distribution that uses the Yum package system,” as well.

The chapters are:

  • Chapter 1, Introduction to Puppet
  • Chapter 2, First Steps with Puppet
  • Chapter 3, Packages, Files, and Services
  • Chapter 4, Managing Puppet with Git
  • Chapter 5, Managing Users
  • Chapter 6, Tasks and Templates
  • Chapter 7, Definitions and Classes
  • Chapter 8, Expressions and Logic
  • Chapter 9, Reporting and Troubleshooting
  • Chapter 10, Moving on Up

That final chapter covers a range of topics, including how to make Puppet code “more elegant, more readable, and more maintainable.” The author offers “links and suggestions for further reading.” And he describes several projects to help you “improve your skills and your infrastructure at the same time.” Those projects, he says, “provide a series of stepping-stones from your first use of Puppet to a completely automated environment.”

Besides Linux, Puppet will run on other several platforms, including Windows and Macs. But there is almost no help for those in Arundel’s book. Essentially, it’s Linux or bust. For other operating systems, you will need to refer to the Puppet Labs website.

It can take a bit of work to get Puppet installed and properly configured. But once you have Puppet running, the Puppet 3 Beginner’s Guide can help you become both a proficient Puppet user and a more efficient, knowledgeable, and versatile system administrator.

Si Dunn

Book Brief – Programming Grails – A new, solid guide for experienced developers – #programming #bookreview

Programming Grails
Burt Beckwith
(O’Reilly – paperback, Kindle )

Burt Beckwith is an experienced core developer on the Grails software team at SpringSource. His new book, Programming Grails, is written primarily for experienced Grails developers “who want to dig deeper into the architecture and understand more about how Grails works its magic and how it integrates with Groovy, Spring, Hibernate, and other technologies.”

Beckwith adds that “[d]evelopers with experience in similar frameworks such as Spring MVC, JEE, or Ruby on Rails should find this book useful in understanding how Grails implements features to which they are accustomed.”

He cautions that Programming Grails “should not be your first Grails book, since it presumes a good deal of previous experience and understanding, so be sure to read a more comprehensive Grails book first.”

The 12-chapter, 344-page book focuses on the inner workings of the Grails 2.0 feature set and emphasizes “best practices for building and deploying Grails applications,” including topics such as “performance, security, scaling, tuning, debugging, and monitoring.” It is written clearly, and its text is kept reasonably short between topic headings. Numerous short code samples and other illustrations are included.

Grails’ creator, Graeme Rocher, has given this book a solid thumb’s up, stating that “it goes much deeper than any other Grails book I have seen.”

The Modern Web: Multi-Device Web Development with HTML5, CSS3, and JavaScript – #bookreview

The Modern Web
Multi-Device Web Development with HTML5, CSS3, and JavaScript
Peter Gasston
(No Starch Press – Kindle, paperback)

After a quick first glance, you might look right past this book. You might assume its title, “The Modern Web,” simply introduces some kind of heavily footnoted, academic study of the Internet.

Not so, Web breath. In this case, it’s the subtitle that should grab your attention.

Whether you hope to go into web development, or you’re already there, Peter Gasston’s new book can help you get an improved grasp on three important, device-agnostic tools that will be essential to your work and career development. They are: HTML5, CSS3, and JavaScript, that not-so-simple programming language that many new web specialists often try to avoid learning. (That’s because, typically, it’s easier, more fun and a bit less cryptic to work with HTML5 and CSS3.)

Also, Gasston notes, there have been big explosions in the number of libraries and frameworks that use JavaScript, further clouding a developer’s ability to know which ones he or she should learn next. (The author limits his coverage to four: jQuery, YepNope, Modernizr, and Mustache.)

Gasston’s well-written book zeroes in on the three “web technologies that can be used anywhere, from open websites to device-specific web apps.” And on all sorts of devices, ranging from tiny phones to tablet computers to wall-covering HDTVs.

And his teaching aim is to show you “modern coding methods and techniques that you can use to build websites across multiple devices or that are tailored to the single device class you’re targeting.”

By the way, “websites” is simply a shorthand term the author uses “to avoid repetition. The features you’ll learn from this book are relevant to websites, web applications, [and] packaged HTML hybrid applications–in short, anything that can use HTML, CSS, and JavaScript.”

Gasston also wants you to learn that “fast” is the main thing that matters to those who will use your site. “Your site needs to be fast–and feel fast–regardless of the device it’s being displayed on,” he emphasizes. “And fast means not only technical performance (which is incredibly important) but also the responsiveness of the interface and how easily users can navigate the site and find what they need to complete the task that brought them to you in the first place.”

His 243-page book contains many short, useful code examples and illustrations, and is excellent for developers who have at least a little bit of experience with HTML5, CSS3, and JavaScript but aren’t sure where and how to focus their energies and attention for the rapidly changing career road ahead.

The Modern Web offers a well-organized introduction, plus 11 chapters:

  1. The Web Platform
  2. Structure and Semantics
  3. Device Responsive CSS
  4. New Approaches to CSS Layouts
  5. Modern JavaScript
  6. Device APIs
  7. Images and Graphics
  8. New Forms
  9. Multimedia
  10. Web Apps
  11. The Future

There also are two appendices: Browser Support as of March 2013 and Further Reading.

Peter Gasston has been a web developer for more than 12 years, and his previous book is The Book of CSS3.

He notes that “[t]he Web is constantly evolving, and book publishing means taking just a single snapshot of a moment. Some things will change; some will wither and be removed. I’ve tried to mitigate this by covering only technologies that are based on open standards rather than vendor-specific ones and that already have some level of implementation in browsers.”

He urges developers to stay alert to changing Web standards and to “be curious, be playful, keep on top of it all. He stresses: “There’s never been a more exciting time to work in web development, but you’ll need to put in an extra shift to really take advantage of it.”

Si Dunn

Four good books that can help boost your JavaScript skills – #programming #bookreview

Ready for some enlightenment that can boost your JavaScript programming skills?

O’Reilly recently has published four books that can help you move from basic JavaScript library user to confident, experienced developer. 

“JavaScript started out as a simple and approachable front-end scripting language,” the publisher notes. “It has matured into a true cross-platform environment targeted by the latest emerging languages, frameworks, and developer tools.” The four new JavaScript books can help you “[l]earn how you can get the ultimate in responsiveness and interactivity from JavaScript, whether you use it on the front-end or server-side.” 

The four books are: JavaScript Enlightenment and DOM Enlightenment, both by Cody Lindley; Learning from jQuery by Callum Macrae; and Testable JavaScript by Mark Ethan Trostler.

#

JavaScript Enlightenment
Cody Lindley
(O’Reilly – paperback, Kindle)

Short, clear code samples are the stars of this fine, informative book. And most of the code samples can be viewed, executed and modified online using file links provided for the jsFiddle.net website.

The book’s goal is “to give the reader an accurate JavaScript worldview through an examination of native JavaScript objects and supporting nuances: complex values, primitive values, scope, inheritance, the head object, etc.” Cody Lindley adds: “I intend this book to be a short and digestible summary of the ECMAScript 3 Edition specification, focused on the nature of objects in JavaScript.”

Lindley keeps that promise in his 147-page book. His code samples rarely span more than a half page, and his explanatory paragraphs also are taut and to the point.

For example: “In JavaScript, objects are king: Almost everything is an object or acts like an object. Understand objects and you will understand JavaScript. So let’s examine the creating of objects in JavaScript….An object is just a container for a collection of named values (a.k.a properties).” 

Lindley’s book covers six of the nine native object constructors that are pre-packaged with JavaScript. The six are: Number(); String(); Boolean(); Object(); Array(); and Function(). He skips Date(), Error(), and RegEx() “because, as useful as they are, grasping the details of these objects will not make or break your general understanding of objects in JavaScript.” But he does hope you will learn them later, on your own. 

“JavaScript,” he writes, is mostly constructed from just these nine objects (as well as string, number, and boolean primitive values.) Understanding these objects in detail is key to taking advantage of JavaScript’s unique programming power and language flexibility.”

 # 

DOM Enlightenment
Cody Lindley
(O’Reilly – paperback, Kindle)

If you work with JavaScript, you probably rely on a Document Object Model (DOM) library such as jQuery to help you handle HTML scripting. 

But you can script the DOM without a DOM library, using JavaScript. Cody Lindley shows how in this excellent guide aimed at two types of developers who have experience with JavaScript, HTML, and CSS.

“The first developer is someone who has a good handle on JavaScript or jQuery, but has really never taken the time to understand the purpose and value of a library like jQuery,” Lindley writes. “The second type of developer is an engineer who is tasked with scripting HTML documents that will only run in modern browsers or that will get ported to native code for multiple OSes and device distributions (e.g., PhoneGap) and needs to avoid the overhead (i.e., size or size versus use) of a library.”

He notes that “HTML documents get parsed by a browser and converted into a tree structure of node objects representing a live document. The purpose of the DOM is to provide a programmatic interface for scripting (removing, adding, replacing, eventing, and modifying) this live document.”

Much of his 161-page DOM Enlightenment  focuses on how to work in JavaScript with “the most common types of nodes…one encounters when working with HTML documents.” He purposefully has “left out any details pertaining to XML or XHTML.” And, to help keep the book small, he has “purposely excluded the form and table APIs,” but adds: “I can see these sections being added in the future.”

Lindley also imposes a key technical limitation on the “content and code in this book….” It was, he says, “written with modern browsers (IE9+, Firefox latest, Chrome latest, Safari latest, Opera latest) in mind.”  

In keeping with the goals of O’Reilly’s Enlightenment series, explanations are short and concise and code examples are kept small. Also, the code examples are available online and can be displayed, run, and modified at the jsFiddle.net website.

 Cody Lindley emphasizes that he is “not promoting the idea of only going native when it comes to DOM scripting….” He hopes, instead,  “that developers may realize that DOM libraries are not always required when scripting the DOM.”

#

Learning from jQuery
Callum Macrae
(O’Reilly – paperback, Kindle)

Some developers work comfortably with jQuery yet have only a modest understanding of JavaScript.

Callum Macrae’s concise, well-written new book is intended to help fill that gap. It is “targeted at developers who know jQuery, but who don’t feel comfortable in their JavaScript knowledge or would just like to know more.”

The 102-page book focuses on the JavaScript code that jQuery covers up. It offers five chapters and two appendixes, with many short code examples and other illustrations. Much of the code is available through a GitHub repo.

Chapter 1, “Event Handling,” explains how event handling works in JavaScript and notes that “[e]vents are the heart of pretty much all web applications….jQuery provides a suite of functions to make event handling considerably easier than in JavaScript alone.” But these functions “add overhead and remove control from you, the developer. For this reason, it is important to know how you can handle events without jQuery in pure JavaScript.”

Chapter 2 covers “Constructors and Prototypes.” Writes Macrae: “Constructors are a way of creating objects, and can be initiated via the new keyword. Prototypes are one of the more powerful features of JavaScript, and allow the developer to declare a method or property that all instances of an object will inherit.” The chapter also can “help you understand how jQuery works, as jQuery itself uses prototypes.” 

Chapter 3 deals with “DOM Traversal and Manipulation.” Macrae notes that “jQuery includes a number of functions that make working with the DOM a lot easier than with JavaScript alone, which can be pretty ugly. However, the functions provided by jQuery can be rather hefty (especially in older browsers), and it is often a lot faster to just use pure JavaScript. Therefore, it is important to know how to work both.”

Chapter 4, “AJAX,” covers jQuery’s AJAX functions and concedes that they “offer some significant improvements over the native JavaScript AJAX features, as they are a lot easier to use.” Macrae explains: “AJAX is the act of making an HTTP request from JavaScript without having to reload the page; you could think of it as an inline HTTP request.” The chapter shows some jQuery AJAX requests and how those AJAX requests are sent in JavaScript. The goal is to help you get better at debugging code and also realize that “it isn’t worth loading the entire jQuery library to send a few requests and nothing else….”

Chapter 5, “JavaScript Conventions,” explains some “common conventions that you can use to improve your JavaScript…such as making your code more readable by using comments and whitespace correctly, optimizing your code in order to improve performance, design patterns, and some common antipatterns (code that causes more problems than it solves.)”

 This book is not recommended for persons who have no jQuery or JavaScript experience. Still, Appendix A, “JavaScript Basics,” provides a 28-page introduction to JavaScript, starting at “Hello World!” Appendix B, meanwhile, describes several applications and websites that can help you improve your JavaScript knowledge.

 # 

Testable JavaScript
Mark Ethan Trostler
(O’Reilly – paperback, Kindle)

“You have to test your code,” Mark Ethan Trostler emphasizes, “so why not make the process as easy and painless as possible?”

That’s a very desirable goal. Yet, as he notes a few sentences later, “testing–especially JavaScript testing–is complicated.”

For example: “Client-side JavaScript is especially difficult to test properly, as we have very little control over the environment within which our code runs. Multiple operating systems, multiple versions of operating systems, multiple browsers, multiple versions of browsers, not to mention plug-ins, extensions, different languages, zoom levels, and who knows what else, all conspire to hinder the performance of our applications. These permutations slow down, break, crash, and eat our applications for lunch. It’s a jungle out there!”

Trostler, a software engineer who works in test at Google, says his book “attempts to bridge the gap between sane development practices and JavaScript. JavaScript is a weird little language.” And he has aimed his guide at “people who encounter JavaScript professionally. Beginning, intermediate, or guru-level developers are all welcome, as this book has something for everyone.”

His 250-page how-to guide is structured into eight chapters that “tackle testable code in several steps. First we will investigate complexity. Then we will look at an architecture choice that attempts to limit complexity and coupling. With that as our foundation,” Trostler continues, “we will move on to testing, both at the functional level and at the application level.” From there, he delves into: code coverage; integration, performance, and load testing; debugging; and using automation in tests.

 “Writing unit tests for client-side JavaScript can be daunting,” Trostler states. “That means too many people don’t do it. This is not OK…”

Testable JavaScript is well written and rich with code examples, screenshots, diagrams and other illustrations. Whether you write client-side or server-side JavaScript — or both — or you are trying to rework some legacy files, Mark Ethan Trostler’s text can help you learn how to better create and maintain testable code.

Si Dunn