Introducing Erlang – A gentle, effective guide to a challenging programming language – #bookreview

Introducing Erlang
Simon St. Laurent
(O’Reilly – paperback, Kindle)

Erlang has come a long way since it began its odd life in the 1980s as a programming language for telephone switching systems, specifically Swedish-made, Ericsson telephone switching systems.

Today, the language and its Open Telecom Platform libraries are gaining new converts among serious practitioners of functional programming. Many of them likewise are drawn to the built-in support for concurrency, distribution and fault tolerance.

“The broad shift from single computers to networked and distributed systems of multiprocessor-based computing gives the Erlang environment a tremendous advantage over practically every other environment out there,” author Simon St. Laurent contends. “More and more of the computing world is starting to face exactly the challenges that Erlang was built to address.” Yet, as he concedes in his preface, “Erlang has long been a mysterious dark corner of the programming universe, visited mostly by developers who need extreme reliability or scalability and people who want to stretch their brains.”

Brain-stretching indeed is one reason why Erlang has stayed in that dark corner for more than two decades.

The language’s learning curve, St. Laurent notes, “starts gently for a while, then it gets much steeper as you realize the discipline involved, and then goes nearly vertical for a little while as you try to figure out how that discipline affects getting work done—and then it’s suddenly calm and peaceful with a gentle grade for a long time as you reapply what you’ve learned in different contexts.”

In a world where everything seemingly must be done in a hurry, you won’t learn Erlang in a hurry. But the payoff for learning it can be rewarding. Erlang, it seems, now is on a roll and experiencing growing demand. The language has been showing up in many different places, from Facebook to CouchDB to the Costa Rican Institute of Technology, to name just a few. Numerous package managers, such as Debian, MacPorts, and Ubuntu, also include a version of Erlang in their default installation.

I run Windows machines, and getting Erlang onto them has proved pleasingly easy. Indeed, Windows users apparently have some of the easiest times getting started with Erlang. Just go to http://erlang.org/download.html and click on the correct link – 32-bit or 64-bit – for your PC.

The book’s code samples can be downloaded from a link provided in the book. And it’s easy to work with the Erlang shell, its command-line interface. The newest version now provides numbered lines.

But, if you’ve worked with other programming languages, Erlang’s syntax likely will seem awkward and strange for a while.

“Punctuation is different and capitalization matters,” the author emphasizes. “Periods even get used as conclusions rather than connectors!”

To display the current working directory in the shell, for instance, you type pwd(). And do not forget to include the period.

To move up a directory, you type cd(“..”). And do not forget to include both the quotation marks and the concluding period.

Indeed, almost everything you enter in Erlang seemingly must end with a period.

Also: “Forget classes, forget variables that change values—even forget the conventions of variable assignment,” the author cautions. “Instead, you’re going to have to think about pattern matching, message passing, and establishing pathways for data rather than telling it where to go.”

Introducing Erlang takes a slow and gentle but effective approach to learning this powerful and difficult language. Simon St. Laurent spends a lot of time trying to help readers “get comfortable in the sunny meadows at the bottom of the learning curve.” Still, his well-written book effectively and efficiently meets its stated goal of helping you “learn to write simple Erlang programs.” It likewise shows and explains how to get started working with the OTP, the Open Telecom Platform’s libraries.

The book and its numerous code examples offer a solid grounding in the basics that you can then use to “understand why Erlang makes it easier to build resilient programs that can scale up or down with ease.” And, if you decide to continue learning, Simon St. Laurent’s new book can make it easier for you to move on to the really brain-stretching, and shadowy, inner workings of Erlang.

Si Dunn

Learn You Some Erlang for Great Good! – A hefty, humorous, wide-ranging how-to guide – #erlang #programming #bookreview

Learn You Some Erlang for Great Good!
Fred Hébert
(No Starch Press – paperback, Kindle)

Two decades ago, I worked for Swedish telecom giant Ericsson, grinding out software specifications, user manuals and other documentation. I was part of a small group in Texas that was supposed to help adapt Swedish-made computers and software to the American banking market.

The coders handled the programming, so I didn’t have to know much code, just how to describe and illustrate the features they were developing. I knew a little assembler, BASIC, and C. But often, the coders worked with what was then a weird-looking proprietary language: Ericcson Language, or Erlang.

For various marketplace reasons, the head Swede suddenly showed up one day, shut our group down, and sent us packing. That was the last time I saw or gave any thought to Erlang.

Until now.

Learn You Some Erlang for Great Good!, recently published by No Starch Press, is a fun yet serious “beginner’s guide” to Erlang. The proprietary language became an open-source language in 1998.

According to the official Erlang website: “Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang’s runtime system has built-in support for concurrency, distribution and fault tolerance.”

Erlang today has a cadre of fans and serious practitioners who use it to create a variety of applications. (CouchDB, for example, is written in Erlang.) And numerous big-name companies use Erlang in a variety of ways.

It is a  functional programming language that also supports concurrent programming, and it has a reputation for being difficult to learn, according to Joe Armstrong, who created the first version of Erlang in 1986. (Indeed, the print version of Fred Hébert’s thick new “beginner’s guide” spans 30 chapters and 595 pages, from “Hello, world” all the way to testing and distribution.)

“One of the biggest barriers to learning Erlang,” Armstrong writes in the book’s foreword, “is not so much that the ideas involved are intrinsically difficult but that they are very different from the ideas in most of the other languages that you will have encountered. To learn Erlang, you have to temporarily unlearn what you have learned in other programming languages. Variables do not vary. You’re not supposed to program defensively. Processes are really, really cheap, and you can have thousands of them, or even millions if you feel like it. Oh, and then there is the strange syntax. Erlang doesn’t look like Java; there are no methods or classes and no objects. And wait a minute…even the equals sign doesn’t mean ‘equals’–it means ‘match this pattern.’”

Fortunately, Fred Hébert’s new book is the perfect antidote to Erlang’s tough learning curve. Hébert, the “Erlang User of the Year 2012,”  delivers clear writing, good illustrations, humor, and plenty of short code samples in his well-structured chapters. His long experience as an Erlang programmer and instructor definitely shines through.

He concedes that, while Erlang “does some things very well,” it definitely is “no silver bullet and will be particularly bad at things like image and signal processing, operating system device drivers, and other functions.” However: “It will shine at things like large software for server use (for example, queue middleware, web servers, real-time bidding and distributed database implementations), doing some  lifting coupled with other languages, higher-level protocol implementation, and so on.”

At the same time, he urges coders to “not necessarily limit yourself to server software with Erlang. People have done unexpected and surprising things with it.”

Si Dunn

Building Web, Cloud, & Mobile Solutions with F# – #programming #bookreview

Building Web, Cloud, & Mobile Solutions with F#
Daniel Mohl
(O’Reilly – paperback, Kindle)

F# (pronounced “F-sharp”) is a relatively new functional, open-source programming language developed by Microsoft and the F# Software Foundation. F# can be used to create scalable applications with ASP.NET MVC 4, ASP.NET Web API, Windows Communication Foundation (WCF), Windows Azure, HTML5, Web Sockets, CSS3, jQuery Mobile, and other tools.

Daniel Mohl’s Building Web, Cloud, & Mobile Solutions with F# is a well-written guide to “everything you need to know to start building web, cloud, and mobile solutions with F#.” Mohl also give some how-to examples using a range of technologies, libraries, and platforms, including SignalR, CouchDB, RavenDB, MongoDB, and others.

Mohl says his book is “intended for technologists with experience in .NET who have heard about the benefits of F#, have a cursory understanding of the basic syntax, and wish to learn how to combine F# with other technologies to build better web, cloud, and mobile solutions.”

In other words, this should not be your first book about F# or the relevant technologies that also are covered. Mohl recommends Chris Smith’s Programming F#, 3.0 as a first step toward learning the language.

In its 160 pages, Building Web, Cloud, & Mobile Solutions with F# offers five chapters, three appendices, and a number of code samples and screen shots. The chapters and appendices are:

  • 1. Building an ASP.NET MVC 4 Web Application with F#
  • 2. Creating Web Services with F#
  • 3. To the Cloud! Taking Advantage of Azure
  • 4. Constructing Scalable Web and Mobile Solutions
  • 5. Functional Frontend Development
  • Appendix A: Useful Tools and Libraries
  • Appendix B: Useful Websites
  • Appendix C: Client-Site Technologies That Go Well with F#

Mohl’s text also contains numerous links to important and useful websites.

He notes that “the primary focus of this book is on how to use F# to best complement the larger technology stack”, so he spends “a lot more time talking about controllers and models than views. F# provides several unique features that lend themselves well to the creation of various aspects of controllers and models.”

Si Dunn

CouchDB and PHP Web Development Beginner’s Guide – #programming #bookreview

CouchDB and PHP Web Development Beginner’s Guide
Tim Juravich
(Packt Publishing, paperbackKindle)

CouchDB and PHP can be a formidable team when used to create web applications. 

“CouchDB is a database that completely embraces the web,” according to the Apache CouchDB website. Data is stored with JSON documents; documents can be accessed with a web browser via HTTP; and JavaScript can be used to “query, combine, and transform” documents. “You can even serve web apps directly out of CouchDB,” the site states.

Meanwhile, PHP is “a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML,” its website notes.

The new CouchDB and PHP Web Development Beginner’s Guide by Tim Juravich is an excellent source for learning how to make the two packages work together. His focus, in the book, is on developing and honing skills by discovering “the ins and outs of building a simple but powerful website using CouchDB and PHP.”

After installing CouchDB and PHP, you learn how to create and enhance a simple, Twitter-like social network called “Verge.” It is an application that “will allow users to sign up, log in, and create posts,” the author states.

CouchDB and PHP Web Development Beginner’s Guide is available through Amazon, Barnes & Noble, and Safari, and also can be ordered direct from the Packt Publishing website in digital formats as well as print.

The book is packed with how-to steps and explanatory details. And it is organized into 10 well-defined chapters.

  • Chapter 1: Introduction to CouchDB
  • Chapter 2: Setting up your Development Environment
  • Chapter 3: Getting Started with CouchDB and Futon
  • Chapter 4: Starting Your Application
  • Chapter 5: Connecting Your Application to CouchDB
  • Chapter 6: Modeling Users
  • Chapter 7: User Profiles and Modeling Posts
  • Chapter 8: Using Design Documents for Views and Validation
  • Chapter 9: Adding Bells and Whistles to Your Application
  • Chapter 10: Deploying Your Application

A key strength of this book is its structure and use of focused headings. For example, when it is time to do something at your computer, there is a “Time for action” heading, such as: “Time for action – creating new databases in CouchDB.”

The step-by-step procedures that you then perform are laid out clearly in numbered order. And you get more than a brief description or illustration of what is supposed to happen. Juravich follows up with summary paragraphs labeled “What Just Happened?”  These summaries describe the purposes of the steps just performed and what they achieved.

Also, at the end of each chapter, he includes a helpful summary of the key points he has covered.

CouchDB and PHP Web Development Beginner’s Guide is well written and follows a classic and effective teaching model: “Tell them what you are going to tell them, tell them, and then tell them what you just told them.”

Its example code files can be downloaded from the Packt website or sent to you by email after you have registered with Packt.

The second chapter includes instructions for installing Apache, PHP, Git (for version control), and CouchDB on Windows, Linux and Mac OS X machines. But it is worth noting that the author restricts most of his discussions to the Mac OS X operating system (10.5 and later) and uses Mac OS command line statements “for simplicity and brevity.”

Windows and Linux users likely will have to do some command-line translations and work with files in different locations than described. Newbies with Windows or Linux machines should wait and gain more command-line experience first or find a mentor who knows both Mac OS X and Windows or Linux before tackling this book.

Maybe someone will write a similar CouchDB-PHP book for Windows and/or Linux users soon?

Si Dunn

Node: Up and Running – A fine intro to Node.js, the new 799-pound gorilla in the room – #programming #bookreview #in

Node: Up and Running
Tom Hughes-Croucher and Mike Wilson
(O’Reilly, paperback, list price $34.99; Kindle edition, list price $27.99)

Node.js is often described as “the dominant player” in the world of server-side JavaScript development. Whether that’s completely true or boastful hype, big players such as Google, LinkedIn, eBay, Walmart and Microsoft now are using it. And so are countless smaller players and startups. If Node.js is not yet King Kong, it has at least grown into a 799-pound, but reasonably tame, programming gorilla for those who want to write scalable server-side code using JavaScript.

In today’s weird, challenging job market for programmers, it would not hurt you to feed this new gorilla a few bananas and gain at least passing familiarity with it. You never know when you may need to ramp up some Node.js skills in a hurry, to get or keep a job or land a contract.

I like O’Reilly’s “Up and Running” book series for that very ramp-up reason. They do a good job of introducing a programming language and showing how to use key aspects of it. And they point you to additional resources for skills and knowledge you can pick up on the fly.

According to the two authors of Node: Up and Running,“Node.js is many things, but mostly it’s a way of running JavaScript outside the web browser.” They add: “Many people use the JavaScript programming language extensively for programming the interfaces of websites. Node.js allows this popular programming language to be applied in many more contexts, in particular on web servers. There are several notable features about Node.js that make it worthy of interest.”

For example: “Node is a wrapper around the high-performance V8 JavaScript runtime from the Google Chrome browser. Node tunes V8 to work better in contexts other than the browser, mostly by providing additional APIs that are optimized for specific use cases.”

The two authors point out that “JavaScript is an event-driven language, and Node uses this to its advantage to produce highly scalable servers. Using an architecture called an event loop, Node makes programming highly scalable servers both easy and safe.” Node.js also features non-blocking I/O.

Node.js “runs on Windows, Linux, Mac, and other POSIX OSes (such as Solaris and BSD),” the authors state. And this is the second Node book I’ve reviewed that claims the installation process is “extremely simple.” The previous book did not give enough information for beginners. This one follows “extremely simple” with instructions and screen displays spread across nearly four pages. But – a hurried beginner may miss this at first – the steps are only for those who choose to do a source install rather than use one of the Node.js installer links.

The first time I used a Windows link to install Node.js (trying to follow the previous book), I somehow ended up with stuff scattered and duplicated in several subdirectories  –. an “extremely simple” mess.)  This time, my installation did seem “simple,” if not quite “extremely simple.” (Once it completed, I had to go to a command prompt and run “node” rather than just click on a brand new Windows icon — my definition of “extremely simple.” )

Of course, you are expected to have some JavaScript knowledge and programming experience before tackling this book, so you may not want to get ahead of yourself on the learning curve. If you’re currently a JavaScript novice, put this one on the shelf for a little bit later. But definitely get it.

Node: Up and Running offers plenty of code examples, and the paragraphs between them are well-written and kept reasonably short. Thus, knowledge and skills can be gained in manageable small chunks. Only a few other illustrations are offered, and, unfortunately, they tend to be more goofy than helpful.

The 184-page book has eight chapters:

  1. A Very Brief Introduction to Node.js
  2. Doing Interesting Things
  3. Building Robust Node Applications
  4. Core APIs
  5. Helper APIs
  6. Data Access
  7. Important External Modules
  8. Extending Node

Some readers have noted that this book does not contain the traditional appendix giving links and referrals to other sources of more information on Node.js, and that’s a fair criticism. However, the book’s Chapter 6, “Data Access,” does have links to, and discussions of, “the basic ways to connect to common open source database choices and to store and retrieve data.” The topics covered include using Node.js with CouchDb, Redis, MongoDB and relational databases such as MySQL and PostgreSQL. The chapter also looks at connection pooling and message queuing (MQ) protocol.

“The Node project is still very young,” the two authors state, “and yet rarely have we seen such fervor around a project. Both novices and experts have coalesced around the project to use and contribute to Node, making it both a pleasure to explore and a supportive place to share and get advice.”

Their new book, Node: Up and Running, can help you get friendly fast with this new 799-pound gorilla in the room, Node.js.

– Si Dunn

#

Not your father’s database: Getting Started with CouchDB & with Fluidinfo – #bookreview #in #programming

These two books reflect some of the wide-ranging changes that the Internet and mobile devices are bringing to the ways databases are structured, accessed, updated, stored and maintained.

Getting Started with CouchDB
By MC Brown
(O’Reilly,
paperback, list price $24.99; Kindle edition, list price $14.99)

“Databases are no longer isolated, single systems,” writes MC Brown. “Whether you want a database that can be shared among multiple devices (your desktop, laptop, and mobile phone), between multiple offices, or to be used as part of your database scaling operations, copying and sharing database information has become required functionality.”

He adds: “Different databases have traditionally approached this in a variety of different ways, including binary logs, data streams, row-based logging, and more complex hashing techniques. Within CouchDB, a simple but very effective method has been developed that uses the individual documents as the key to the method of sharing and distributing the document information between databases.”

Apache CouchDB is a free download for Linux, Mac OS X, or Windows. According to the website, “Apache CouchDB™ is a database that uses JSON for documents, JavaScript for MapReduce queries, and regular HTTP for an API.”

Brown also describes how to install CouchDB from source code, with careful emphasis on “(if you must).”

For the number of pages (84), the list prices for Brown’s book seem a bit high. But if you want to learn how to work with CouchDB, information to get you started is conveniently at hand, in the book or e-book. For example, Brown shows how to create databases and delete databases and how to create, update and delete documents in the databases.

“All of your interactions with CouchDB will be through HTTP,” he notes. His book provides some “key details” for several HTTP operations “such as HEAD and DELETE that are useful when talking to CouchDB.”

MC Brown has written or contributed to more than 26 books dealing with programming, systems management, web technologies and other subjects. He is vice president of documentation for Couchbase.

#

 Getting Started with Fluidinfo
By Nicholas J. Radcliffe and Nicholas H. Tollervey
(O’Reilly,
paperback, list price $24.99; Kindle edition, list price $11.99)

“Fluidinfo is an online storage system in which there is a place for information about everything—everything that exists, everything that could exist, and everything that can be imagined,” this book’s two authors state. “It allows anyone to store any information, about anything, in any digital form. And Fluidinfo is social: users can exercise fine control over who can read their data and can even enable other chosen users and applications to write data on their behalf.”

Another way to describe Fluidinfo is as an “openly writeable shared datastore.”

Like CouchDB, Fluidinfo exposes “all its functionality through HTTP, the core protocol that underpins the World Wide Web. Programmers can take advantage of its RESTful API, which makes it easy to integrate with other applications.”

To try out Fluidinfo and get an account, go to fluidinfo.com. The site offers the option to sign in via Twitter.

This well-written, 119-page book is offered as a “practical guide to several ways to access and use Fluidinfo” and is organized into nine chapters:

  • Chapter 1: What Is Fluidinfo?
  • Chapter 2: Fluidinfo from the Command Line
  • Chapter 3: Social Data
  • Chapter 4: Programming with Fluidinfo
  • Chapter 5: Programming with FOM (the Fluid Object Mapper)
  • Chapter 6: Programming Fluidinfo with JavaScript
  • Chapter 7: Fluidinfo’s RESTful API
  • Chapter 8: Advanced Use of the Fluidinfo Shell
  • Chapter 9: Conventions for the About Tag

There is also an appendix titled “Fluidinfo Query Language Reference.”

One of the book’s authors, Nicholas Radcliffe, has connections to Fluidinfo that date back to the 1980s and “has been a friend and advisor to the Fluidinfo company since its inception.” Meanwhile, Nicholas Tollervey is a software developer at Fluidinfo and has nearly 30 years’ experience in programming.

#

Si Dunn is a novelist, screenwriter, freelance book reviewer, and former software technical writer and software/hardware QA test specialist. He also is a former newspaper and magazine photojournalist. His latest book is Dark Signals, a Vietnam War memoir available now in paperback. He is the author of a detective novel, Erwin’s Law, a novella, Jump, and several other books and short stories.