Node.js Design Patterns

Design and implement production-grade Node.js applications using proven patterns and techniques, 3rd Edition

Mario Casciaro and Luciano Mammino

Packt Publishing

Node.js often is thought of simply as a small but helpful tool for working with JavaScript code while developing applications. The two writers of (paid link) Node.js Design Patterns, 3rd Edition, however, show that Node.js is much more than a minor helpmate. They call it a major “innovation” in the challenging world of web development.

In their view, “the most important aspect of Node.js lies in its ecosystem: the npm package manager, its constantly growing database of modules, its enthusiastic and helpful community, and most importantly, its very own culture based on simplicity, pragmatism, and extreme modularity.”

Along with clear descriptions of how Node.js works, their updated and expanded third edition (paid link) offers “proven patterns and techniques” for designing and implementing production-grade applications using Node.js.

They delve into Node’s single-threaded programming model, its asynchronous architecture, and its deliberate emphasis on creating modules that do one thing well. And they describe how these approaches provide important benefits and advantages to developers who need to design applications that can be developed, tested, scaled, and maintained more easily.

In keeping with the “Node way” of application developement, their book lays out a ready-to-use “set of patterns to solve common Node.js design and coding problems.” The two authors discuss and illustrate how to write “scalable and efficient Node.js applications.” And they explain how to code in “modern” JavaScript, including “class syntax, promises, generator functions, and async/await.” They also point out differences between CommonJS and ESM (ECMAScript modules) and show how to handle those differences in Node.js.

If you develop applications using JavaScript, you may already have at least some basic experience with Node.js. Whether you are an experienced developer or just getting started, consider getting Node.js Design Patterns, 3rd Edition (paid link) and keeping it handy as an important reference source. It is well written and well structured. And, at 600+ pages, it covers a wide range of topics, from callbacks and events to messaging and integration patterns, plus more.

Si Dunn

(My thanks to Packt for sending a copy for review consideration.)

NOTE: As an Amazon Associate I earn from qualifying purchases.

‘See Also Deception’: A good addition to the Marjorie Trumaine mystery series #bookreview

See Also Deception

Larry D. Sweazy

Seventh Street Books

As I have mentioned here before, I love mystery stories where the investigator is an ordinary citizen, not a well-trained police detective or a struggling private sleuth beaten down by drunkenness, personal demons, and too many bad cases.

The investigator in See Also Deception, the second novel in the Marjorie Trumaine series, is dealing with than her share of life challenges. She is trying pay bills and scratch out a hardscrabble existence on a farm in rural North Dakota. She also is a full-time caregiver for her husband, Hank, a once-vigorous farmer now paralyzed from the neck down following a hunting accident.

During the very lean months between crops, Marjorie works from home for publishers, as a freelance indexer of books. Her ability to categorize and organize facts and details not only helps her get assignments and pay household bills; it also helps her solve murders in the countryside and in the small town nearby.

Set in the mid-1960s, amid Cold War tensions, See Also Deception has Marjorie struggling with demands at home and struggling with her belief that her friend Calla Elmore, the local librarian, did not shoot herself in the head but was murdered. Local law enforcement officials don’t share Marjorie’s suspicions, of course. So it is up to her to solve the case and prove them wrong.

Larry D. Sweazy, author of this series, is a prize-winning fiction writer who has turned out numerous other books. For the most part, the writing in this novel is very good. But the stark rural setting offers perhaps too many opportunities for internal monologue, once you’ve noted — and re-noted — the jackrabbits scurrying across the unpaved roads and the dust clouds billowing behind Marjorie’s world-weary Studebaker.

On a few occasions, Sweazy also uncorks a sentence that is just a bit too folksy, such as: “I knew I wouldn’t be able to stay away from my questions about Calla’s death any more than a June bug could stay away from the dusk-to-dawn light at the peak of the garage roof.”

Nitpicking aside, however, See Also Deception is an entertaining, engrossing sequel to See Also Murder, the debut novel in the Marjorie Trumaine series.

Si Dunn

 

Java Testing with Spock: A good (and sometimes Groovy) guide to using this powerful testing framework – #programming #java

Java Testing with Spock

Konstantinos Kapelonis

Manning, paperback

 

Spock, the author states, is “a comprehensive testing framework for Java (and Groovy) code that can help you automate the boring, repetitive, and manual process of testing a software application. Spock is comprehensive because it’s a union of existing testing libraries”—specifically JUnit, Mockito and JBehave. It also is influenced by several others.

What is Spock’s main advantage in test scenarios? “When things go wrong,” Konstantinos Kapelonis notes, “Spock gives as much detail as possible on the inner workings of the code at the time of the failure.”

Spock is written in Groovy, and just mentioning that language, as well as the Gradle build tool, may give a little heartburn to hardcore Java developers who don’t want to learn them. But others find Groovy refreshingly efficient and Gradle easy to use. In any case, using Groovy (and Gradle) with this book is “optional,” the author emphasizes. As noted in Appendix A, “It’s perfectly possible to use Spock in your Java project without installing Groovy itself.”

To emphasize that point, Kapelonis shows how to use Spock with the Maven build tool first, before he delves into how to use Spock with the Gradle build tool.

The book is divided into three major parts: (1) Foundations and brief tour of Spock; (2) Structuring Spock tests; and (3) Spock in the Enterprise.

Two appendices deal with installing and using Spock, plus getting your IDE set up, and using the book’s example files.

Java Testing with Spock is a comprehensive guide to learning how to do Java (and Groovy) testing with Spock, and it is generally well written and adequately illustrated.

I chose to try the Groovy-Gradle approach, with Eclipse as my IDE. And I did run into some awkward moments trying to get Eclipse Mars.2 to play correctly. The Groovy-Gradle plug-in from the Eclipse Marketplace was for earlier versions of Eclipse, and so was the Spock plug-in. After some tinkering and reconfiguring, I was able to get things working together and do some Java and Groovy tests. To be fair, I was doing this on a kludged-together Windows 10 machine that definitely is no development powerhouse. And I did not have time to try out the Maven approach, but I have used Maven in the past, and the author’s instructions and examples for Maven look solid.

Java Testing with Spock is a good, helpful how-to book for anyone who wants to know more about putting the Spock testing framework to good use at all levels of Java development.

Si Dunn

Attack of the Killer Parentheses: ‘Clojure in Action, 2nd Edition’ – #bookreview

Clojure in Action, 2nd Edition

Amit Rathore and Francis Avila

Manning – paperback

Clojure seems to be afflicted with a measles-like outbreak of parentheses, and it generally just looks strange to many software developers. And there’s a good reason for that, as this book’s two author point out in their recently released second edition.

“Clojure’s syntax is derived from its Lisp roots: lots of parentheses. It’s alien to most developers with experience in languages with Algol-inspired syntax like C, C++, Java, Python, Ruby, Perl, and so on.”

But Clojure also is an intriguing and powerful choice for many software development projects, Amit Rathore and Francis Avila insist. Clojure is “a functional Lisp on the JVM” (the Java Virtual Machine), and: “It is impossible to separate the Lisp, functional programming, and JVM features of Clojure. At every step they play on each other and tell a compelling software development story….”

I have been tinkering with Clojure on the side, at random spare moments, for more than two years, using a disorganized approach of looking at web postings, building and modifying simple projects that others have posted, and sometimes looking at Clojure how-to books as time permits.

From my perspective, Clojure in Action, 2nd Edition fills a beginner’s need for a friendly, well-organized approach to learning the language and putting it to work effectively. Developers already working with Clojure can benefit from having this book, too, as a handy reference. It covers a lot of ground, using reasonably short paragraphs and offers many short code examples to illustrate its key points.

Clojure in Action, 2nd Edition “assumes no prior experience with Lisp or with any functional programming language,” the authors emphasize. “It starts out with the absolute basics and slowly layers on the different features of the language in  a way to make it all fit together in an intuitive way. It takes a first-principles approach to all the topics, first explaining why something needs to be done a certain way, and only then talking about the Clojure way.”

Clojure is not a language for absolute beginners. The authors assume “you’re familiar with an OO [object-oriented] language like Java, C++, Ruby, or Python, but no background in Java, Lisp, or Clojure is required.” They also assume you have downloaded Clojure and gotten it working on your PC. You can read more about Clojure and download it here.

This expanded 2nd edition states that it covers the “new” features of Clojure 1.6. Of course, Clojure already is up to 1.8, but I have tried many of the code examples at various points in the book and have not encountered problems while running 1.8.

Si Dunn

Getting started with 3D printing? Consider these two new Maker Media books – #bookreview

Many people who want to jump into 3D printing have almost no idea what they actually want to make. Or, they may have projects in mind that far exceed their abilities to fabricate as beginners.

If 3D printing is on your mind (or arriving soon in some shipping boxes and downloads), here are two new books to consider: 3D Printing Projects and 3D CAD with Autodesk 123D.

3D Printing Projects

Toys, Tools, and Contraptions to Print and Build Yourself

Brook Drumm & James Floyd Kelly, with John Baichtal, Rick Winscot, Brian Roe, John Edgar Park, Steven Bolin,
Nick Ernst, and Caleb Cotter

(Maker Media, paperback)

Maker Media’s 3D Printing Projects is written by a team of professionals who have 3D printing newcomers in mind, at first. But their book also includes several more challenging projects that require Arduino or Raspberry Pi boards, motors, servos, or video cameras and other devices. Importantly, all of the projects are designed to be fabricated with small, desktop 3D printers.

The book starts by showing how to fabricate a simple gooseneck lamp that uses an LED light powered by a 9-volt “wall wart.” From there, the projects increase in complexity, to fabricated devices such as a two-axis camera gimbal and a flower-care robot that monitors soil moisture and adds water when the soil gets dry. Numerous photographs, illustrations and how-to steps are provided.

This well-written book shows that much can be done, even at the hobby level, with just a few custom 3D printed parts and some electronics.

 

3D CAD with Autodesk 123D

Design for 3D Printing, Laser Cutting, and Personal Fabrication

Jesse Harrington Au & Emily Gertz

(Maker Media, paperback)

The first steps to 3D printing include “learning how to design for three dimensions using a computer” and having an idea “where to start,” the authors of this useful book point out.

“Many makers who are accustomed to creating by hand view CAD [computer-aided design] software suspiciously. They may worry that digital design will lack soul, or be perceived as cheating. Neither is true,” Jesse Harrington Au and Emily Gertz insist. “A good CAD program can be just that: an aid in realizing your vision for your project.”

Autodesk 123D is one of several popular “parametric design” software packages on the market. The authors note: “The term parametric refers to the use of design parameters, such as measurements, to construct and control the 3D model. This means you will first create a sketch that has measurements attached to it. Those measurements will be used to construct your solid model using different features such as extrude, revolve, or loft.

“This being said, 123D is also capable of ‘tinkering’: using loosely based measurements while fleshing out the look and feel of your design. The power of this is that it allows you to tweak your model during the design process based on actual measurements.”

The book shows how to navigate CAD programs, and it covers how to work with the cloud-based Autodesk 123D “family of programs that allow you to share models between the different apps.”

3D CAD with Autodesk 123D is richly illustrated and well written, with much of the how-to text contained in short paragraphs that offer clear steps.

Si Dunn

 

 

 

 

Step away from the ‘smartphone’ and try using your hands and mind to make something – #bookreview

The Make: Series of How-to Books

A British scientist made headlines a few years ago when she warned that young people no longer make or repair things. It has become all too easy for them now, she cautioned, to simply throw away old or broken devices and buy new ones.

A key point was that many things currently being discarded could be fixed or refurbished and put to new uses. It would just take a little effort, a little learning, and some imagination.

I ran into some of that “no longer make or repair things” attitude a few years ago while working temporarily as a substitute teacher. If you have ever been a substitute in a public high school or middle school, you likely know that students often view “subs” as an excuse to pay absolutely no attention to anything he or she says.

When I could get no interest or response to the day’s assigned work in a science class, I tried introducing a challenge: Imagine you have become stranded on a desert island in the Pacific Ocean, and you have just a few items with which to try to survive and attract the attention of a passing ship. The items ranged from coconuts and palm fronds to a pocket mirror, a small magnifying glass, a couple of cups, some string and a safety-pin.

I figured the kids might come up with some clever ways to (1) crack open the coconuts for food and liquid, (2) start a fire using a magnifying glass and dried palm fronds, (3) use the string and safety-pin to catch a fish to cook over the fire, (4) use the cups to boil seawater and capture the steam to make a little drinking water, and (5) prepare a separate pile of palm fronds to burn as a rescue signal to a passing ship.

Ha. At first, the students seemed intrigued and engaged by the challenge. They immediately started calling out survival “strategies.” Unfortunately, most of their ideas started with two concepts: “First, I’d go to the mall and buy…” or “First, I’d go online and buy….”

The reality of being stranded in isolation without immediate communication did not even register with them at first. When they did begin to try to imagine surviving without their smartphones, they quickly ran out of ideas and became sullen or antagonistic toward me.

This experience also became the straw that finally broke the back of my desire to continue as a substitute teacher. I had grown up at a time when making, tinkering, building, and repairing all were noble pursuits for a teenager interested in science, electronics, space and engineering. If I wanted a shortwave radio or a new type of model airplane or a small rocket I could launch in my back yard, I built them from scratch or combined pieces of previous projects. None of this experience registered with my students. And my next attempts to stir up enthusiasm for making and repairing things similarly fell flat.

Make It So?

Do you worry that your kids are growing up not knowing how to make things or fix things? Do you fret that you no longer remember how to make things or fix things?

Working with your hands, eyes and brain – and not just mindlessly swiping an index finger across a tiny screen – can be both physically and mentally rewarding.

Of course, the web is alive with “how to” information for making or repairing almost anything. And I make occasional pilgrimages to public libraries and bookstores to find reference materials and instruction books related to specific projects.

I am an unabashed fan of the “Make:” series of books from Maker Media. I don’t build all of their projects, but I do try out some of them. And I enjoy reading about zany, yet sometimes practical, stuff such as (1) how to use a magnet to tell if money is counterfeit, (2) how to create artwork that actually does something, using just a handful of electronic components, (3) how to generate electric power with several lemons connected in series, or (4) how to make some really good paper airplanes and paper helicopters. The “Make:” books consistently feature clear, well-organized instructional text, illustrations and photographs of how things go together.

Books such as Tinkering: Kids Learn by Making Stuff (2nd edition), Easy 1+2+3 Projects, and Planes, Gliders, and Paper Rockets can appeal to parents and children who are in elementary school or older. For older kids and their parents, or for would-be engineers, Make: books such as Bluetooth, Getting Started with Intel Edison, and 3D Printing Projects can be helpful and enlightening how-to guides. Books on numerous other topics also are offered.

Do your kids (and/or you) seem unhealthily addicted now to clutching and staring at smartphones all day? You may want to try putting the devices aside and seeing what you can create with your hands, your mind, some household materials and a few readily available gadgets that don’t require pricey data plans and contracts.

You can do it! Power off now! (Okay, for just a few minutes at first if you insist and if you have a really bad case of smartphone withdrawal.)

— Si Dunn

Go in Action – A comprehensive overview, from ‘Hello, Go’ to ‘Testing & Benchmarking’ – #programming #bookreview

Go in Action

William Kennedy, with Brian Ketelsen and Erik St. Martin

Manning – paperback

The authors of Go in Action assume that you are a working developer who is proficient with some other language, such as Java, Ruby, Python, C# or C++.

However, their book is written well, has good illustrations and offers small to moderate-sized code examples. So, someone who is less than a “working developer” also can pick up this work and use it to get a good start on mastering Go.

The Go language, developed at Google, “has concurrency built in.” Also: “Go uses interfaces as the building blocks of code reuse.” And it has “a powerful standard library,” Kennedy, Ketelsen and St. Martin point out. (They are well-known figures in the Go community.)

Some readers likely will mixed feelings about using the online Go Playground rather than downloading and installing the software. But the book’s three authors emphasize: “Go developers use the Playground to share code, ideas, test theories, and debug their code, as you soon will too.”

They add: “Without installing Go on your computer, you can use almost all that Go provides right from your web browser.”

The major topics covered in the book include Go’s language syntax, type system, concurrency, channels, and testing, among others. If you want a clear, concise and reasonably comprehensive overview of Go, consider Go in Action, from the get-go.

Si Dunn

 

 

Ionic in Action – A solid guide to building hybrid mobile apps with Ionic and AngularJS – #programming #bookreview

Ionic in Action

Hybrid Mobile Apps with Ionic and AngularJS

Jeremy Wilken

(Manning, paperback)

Ionic in Action is a very good introduction to the Ionic framework, which the author describes as “a combination of tools and utilities….” These tools and utilities enable developers “to quickly build hybrid mobile apps using the same technology used to build websites and web applications, primarily HTML, CSS (Cascading Style Sheets) and JavaScript.” Using Ionic, you build “hybrid mobile apps,” which employ a browser window to display the user interface.

Ionic in Action shows how build three different mobile web apps. And, while working on those apps, you encounter virtually every feature that Ionic offers. I recently started learning Ionic, so I am pleased with how this book is organized and impressed that it has some important blessings from Adam Bradley, a co-creator of the Ionic framework.

Ionic is built on top of AngularJS, and it interacts with Cordova. The author of Ionic in Action, Jeremy Wilken, promises that being familiar with AngularJS is “helpful but not required.” However, as someone who has wrestled with AngularJS (and been slammed to the scope mat more than once), I am pleased that this book includes a chapter titled “What you need to know about AngularJS.” And, as in the rest of the book, you learn by doing, not just by reading explanations and looking at illustrations.

In the Angular chapter, you build a basic web application using AngularJS. Of course, one chapter does not take the place of a good AngularJS tutorial. But it provides a useful starting point.

Whether you are working to become a mobile app developer or seeking to improve and widen some existing skills, this is a good book both to learn from and keep handy in your reference library.

Si Dunn

Make: Paper Inventions – A fun how-to book for kids and their adults

 

 

 

Make: Paper Inventions

Kathy Ceceri

Maker Media, Inc. – paperback

Don’t just hand this book to your kids, say “Have fun,” and then go off to play with your computer. Get out the glue, scissors and paper and join in.

You might enjoy seeing what happens  when you (1) cut all the way around a Möbius strip or (2) fold a single strip of paper into a versatile and surprising trihexaflexagon, or (3) try your hand at quilling. That, the author writes, is “the art of creating 2-D and 3-D designs out of thin paper spirals and curls.”

Make: Paper Inventions opens with a nice, succinct overview of the history of paper and the fact that it was not made from the hard interior of trees until the mid-19th century. Before then, paper was made from many other materials, such as linen, cotton, the inside of certain tree barks, and the flattened stalks of papyrus plants.

The first project in the book is the messiest, and you may not want to use your favorite blender. But it will provide good teaching moments for kids (and their adults). The text and photographs show how to make new paper from several sheets of recycled copy paper. You will not want to run the homemade paper through your laser printer, but it can be used for art projects.

Kids can handle some of the paper projects in this book by themselves. However, the more complicated ones, such as building a large geodesic dome from newspaper pages, definitely will need adult guidance and encouragement. And certain materials may need to be ordered.

Meanwhile, the final chapters of this fine book offer projects that mostly involve folding pieces of paper. And they provide some focus on mathematics, such as how to fold paper in such a way that just one diagonal cut will result in a five-pointed star.

Make: Paper Inventions can help put more STEAM (science, technology, engineering, art, and mathematics) into the lives of your kids–and into your life, as well.

Si Dunn

‘Meteor in Action’: A good how-to guide for learning a popular JavaScript framework – #programming #bookreview

 

Meteor in Action

Stephan Hochhaus and Manuel Schoebel

Manning – paperback

I have worked with several JavaScript frameworks, and Meteor has become a favorite, mainly because it is closely related to the MEAN stack family and plays well with MongoDB and Node.js.

As the Meteor in Action authors note: “Meteor runs on top of Node.js and moves the application logic to the browser, which is often referred to as single-page applications. The same language is used across the entire stack, which makes Meteor an isomorphic platform. As a result, the same JavaScript code can be used on the server, the client, and even in the database.”

Meteor is versatile and easy to use, particularly for simple applications. But, like any other JS framework, it does have a learning curve. And there are some inherent weaknesses, as well as strengths, that must be considered when deciding if Meteor is the right choice for a particular project.

Meteor in Action can give you a good grounding in Meteor’s basics, plus solid momentum along the path toward Meteor mastery. The book begins with a polished and not-too-lengthy overview of Meteor’s Open Source framework. Then it shows how to build a small, reactive game application. From there, the major topics include: templates; data; fully reactive editing; users, authentications, and permissions; exchanging data; routing; the package system; advanced server methods; building and debugging; and going into production.

Another reviewer has stated that parts of this book may be outdated soon, because some of the technology associated with Meteor is changing fast. But not every work site immediately will keep up with the latest and “greatest” changes to Meteor software, of course. And, you may encounter applications needing support that are still running earlier releases of Meteor.

This  is a worthy and valuable book for anyone just starting to learn Meteor. And it likewise can be helpful to Meteor users who want better understanding of the framework, how it is put together, and how it can be used effectively in large applications. The two authors of this book have been working with Meteor since the framework’s “infancy” in 2011.

Si Dunn