Testing in Scala – How to Test First, Then Develop Effective Code – #programming #bookreview

Testing in Scala
Daniel Hinojosa
(O’Reilly – paperback, Kindle)

In test-driven development (TDD), a software developer first creates some specific tests that are intended to fail and then writes code that is good enough to pass the tests. After that, the code is refactored, improved to make it better and easier to maintain and extend.

A key goal of TDD is to reduce the time and costs required to develop software.

Daniel Hinojosa’s well-written Testing in Scala effectively introduces test-driven development basics to Scala newcomers, as well as to developers already familiar with Scala or other programming languages, including Java, Ruby or Python.

The scala-lang.org website describes Scala as “a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application.”

Both TDD and Scala have been around for a number of years, but each is now gaining new traction with corporations, software companies, and individual developers seeking faster results at lower costs.

One big reason for Scala’s rising popularity, the Scala website proclaims, is Scala’s close ties to Java:

“Existing Java code and programmer skills are fully re-usable. Scala programs run on the Java VM, are byte code compatible with Java so you can make full use of existing Java libraries or existing application code. You can call Scala from Java and you can call Java from Scala; the integration is seamless. Moreover, you will be at home with familiar development tools, Eclipse, NetBeans or IntelliJ for example, all of which support Scala.”

The Spring Tool Suite also can support Scala using the Scala IDE for Eclipse, but there recently were a few “caveats” if you have the Java 7 JDK installed. Meanwhile, the Spring Scala project, announced last October, is underway.

The new book Testing in Scala is structured as six chapters that utilize different testing frameworks while an example application is tested and developed from scratch:

  1. Setup
  2. Structure and Configuration of Simple Build Tool (SBT)
  3. ScalaTest
  4. Spec2
  5. Mocking
  6. ScalaCheck

The book and its code examples, Hinojosa says, are “organized in a TDD fashion: test first, fail; test again, succeed maybe; test again, succeed, and so on.”

If you’ve never tried TDD, Testing in Scala may help you learn how to become a better, more efficient Scala developer.

It also can introduce you to a development style that you may be able to adapt quickly and effectively to other programming languages, as well.

Si Dunn

Advertisements

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

All for Search and Search for All: 3 New Books for Putting Search to Work – #bookreview

Seek and ye shall find.

That’s the theory behind the still-debated benefits of digging through Big Data to uncover new, overlooked, or forgotten paths to greater profits and greater understanding.

Big Data, however, is here to stay (and get bigger). And search is what we do to find and extract useful nuggets and diamonds and nickels and dimes of information.

O’Reilly Media recently has published three new, enlightening books focused on the processes, application, and management of search: Enterprise Search by Martin White, Mastering Search Analytics by Brent Chaters, and Search Patterns by Peter Morville and Jeffery Callender.

Here are short looks at each.

Enterprise Search
Martin White
(O’Reilly, paperback, Kindle)

Start with this book if you’re just beginning to explore what focused search efforts and search technology may be able to do for your company.

The book’s key goal is “to help business managers , and the IT teams supporting them, understand why effective enterprise-wide search is essential in any organization, and how to go about the process of meeting user requirements.”

You may think, So what’s the big deal? Just put somebody in a cubicle and pay them to use Google, Bing, and a few other search engines to find stuff.

Search involves much more than that. Even small businesses now have large quantities of potentially profitable information stored internally in documents, emails, spreadsheets and other formats. And large corporations are awash in data that can be mined for trends, warnings, new opportunities, new product or service ideas, and new market possibilities, to name just a few.

The goal of Enterprise Search is to help you set up a managed search environment that benefits your business but also enables employees to use search technology to help them do their jobs more efficiently and productively.

Yet, putting search technology within every worker’s reach is not the complete answer, author Martin White emphasizes.

“The reason for the well-documented lack of satisfaction with a search application,” he writes, “is that organizations invest in technology but not staff with the expertise and experience to gain the best possible return on the investment….”

Enterprise Search explains how to determine your firm’s search needs and how to create an effective search support team that can meet the needs of employees, management, and customers.

Curiously, White
waits until his final chapter to list 12 “critical success factors” for getting the most from enterprise-wide search capabilities.

Perhaps, in a future edition, this important list will be positioned closer to the front of the book.

Mastering Search Analytics
Brent Chaters
(O’Reilly – paperback, Kindle)

This in-depth and well-illustrated guide details how a unified, focused search strategy can generate greater traffic for your website, increase conversion rates, and bring in more revenue.

Brent Chaters explains how to use search engine optimization (SEO) and paid search as part of an effective, comprehensive approach.

Key to Chaters’ strategy is the importance of bringing together the efforts and expertise of both the SEO specialists and the Search Engine Marketing (SEM) specialists — two groups that often battle each other for supremacy within corporate settings.

“A well-defined search program should utilize both SEO and SEM tactics to provide maximum coverage and exposure to the right person at the right time, to maximize your revenue,” Chaters contends. “I do not believe that SEO and SEM should be optimized from each other; in fact, there should be open sharing and examination of your overall search strategy.”

His book is aimed at three audiences: “the search specialist, the marketer, and the executive”–particularly executives who are in charge of search campaigns and search teams.

If you are a search specialist, the author expects that “you understand the basics of SEO, SEM, and site search (meaning you understand how to set up a paid search campaign, you understand that organic search cannot be bought, and you understand how your site search operates and works.)”

Search Patterns
Peter Morville and Jeffery Callender
(O’Reilly – paperback, Kindle)

“Search applications demand an obsessive attention to detail,” the two authors of this fine book point out. “Simple, fast, and relevant don’t come easy.”

Indeed, they add, “Search is not a solved problem,” but remains, instead, “a wicked problem of terrific consequence. As the choice of first resort for many users and tasks, search is the defining element of the user experience. It changes the way we find everything…it shapes how we learn and what we believe. It informs and influences our decisions and, and it flows into every noon and cranny….Search is among the biggest, baddest, most disruptive innovations around. It’s a source of entrepreneurial insight, competitive advantage, and impossible wealth.”

They emphasize: “Unfortunately, it’s also the source of endless frustration. Search is the worst usability problem on the Web….We find too many results or too few, and most regular folks don’t know where to search, or how….business goals are disrupted by failures in findability…[and] “Mobile search is a mess.”

Ouch!

Colorfully illustrated and well-written, Search Patterns is centered around major aspects in the design of user interfaces for search and discovery. It is aimed at “designers, information architects, students, entrepreneurs, and anyone who cares about the future of search.”

It covers the key bases, “from precision, recall, and relevance to autosuggestion and faceted navigation.” It looks at how search may be reshaped in the future. And, very importantly, it also joins the growing calls for collaboration across disciplines and “tearing down walls to make search better….”

Si Dunn

iPod: The Missing Manual, 11th Edition – A clear, concise keeper for your reference needs – #bookreview

iPod: The Missing Manual, 11th Edition
J.D. Biersdorfer, with David Pogue
(O’Reilly – paperback, Kindle)

I own and use a small collection of old iPods, including a Shuffle and a Classic. I play them when I exercise and when I work at my computer in a coffee shop and don’t want to listen to the piped-in music or the surgical nurse at the next table talking too loudly into her smartphone. When she starts started telling someone the gory details of a rare procedure recently performed inside a patient’s skull, I just crank up Adele and drown it all out.

The new 11th edition of iPod: The Missing Manual is a perfect reference book for me. It reminds me how to do certain tasks on my older devices. It shows me how to use features I still haven’t tried but might after the next song ends. The book also has information I could use to help a granddaughter with her brand-new iPod Touch — but somehow I doubt she’ll ever let me touch it.

Anyway, J.D. Biersdorfer has been writing a technology column for the New York Times since 1998, and this is her 11th iPod book. So she knows her stuff. And, of course, fellow New York Times writer and co-author David Pogue invented the Missing Manual series and has authored or co-written some 55 books, including 28 Missing Manuals.

Together, in this new edition, they have prepared an excellent, 331-page guide for how to get the most out of your iPod, whether it is really old, slightly old, or fresh out of the box.

For example, you may want to know how to play slideshows on your TV using your Touch or your Classic. The steps are in there. Want to know how to hook up a Touch or Nano to your car’s stereo? It’s in there. Have you ever tried using the iTunes graphic equalizer (EQ) “to improve the way your songs sound…”? Just follow five well-described steps.

Forgotten how to autofill or manually fill your Shuffle with new songs? When’s the last time you added or deleted a playlist on your Classic or Nano? Ready to edit some photos on your Touch or set it up with an iCloud account ? Don’t remember how to get to iTunesU? Just follow the book’s clear steps and color screenshots.

With several different iPods to care for and optimize, iPod: The Missing Manual, 11th Edition quickly has proven its worth for me. It definitely will be a keeper on my reference shelf.

Si Dunn