Content tagged review

Learn You a Haskell for Great Good

posted on

This is the first book on Haskell, that really made me want to read it. I had it with me as an e-book on my vacations. I couldn't stop reading it before I finished. It is a very good introduction to the basics of the Haskell programming language. It even contains an understandable explanation of the infamous monads. (Side note: they are a very simple concept, and you shouldn't fear them.)

For me this book was the right amount of introduction to get me started. Everything else I think I will be able to learn while using the language.

The book is available in print at your preferred book shop, or can be read online and free of charge.

Links to resources

Reactive Programming with RxJava

posted on

RxJava is an implementation of “Reactive Extensions” (Rx) in Java. But what is this? Originally Rx are an implementation of Microsoft to address the increasing complexity of software. It is a model to build large scale asynchronous service architectures.

Another company that has to be mentioned is Netflix: they implemented the Rx in Java which resulted in RxJava.

On the programming side Rx looks very similar to how streams ( work. The main difference in my opinion is that streams are pull and lazy. They produce only as much data as someone is reading from them. RxJava on the other side is more push style. The source of data is pushing events through a pipe of operators similar to what you know from streams (filter(), map(), and so on) to the sink. And as I know from this book, Java streams are the wrong tool to parallelize anything that is not CPU bound–like network requests. There reason for this is, that (parallel) streams are executed on a thread pool that is shared with several other features of Java. This thread pools is limited to have only that many workers as the system has CPU cores. Therefore this pool gets exhausted very soon, when threads in it get blocked by I/O operations. Any thread waiting for an I/O operation effectively results in a processor core not used by your program.

RxJava on the other hand is not limited to a fixed thread pool. Any source (Observable) and sink (Subscriber) of data can be bound declaratively to user defined Schedulers. As well as Rx favours a model in which I/O operations are done asynchronously and non-blocking. Therefore resulting in a need for much fewer threads. In a traditional model of using one thread per network connection, threads become very soon the first thing that limits scalability.

What is really great about this book

The best part of this book for me were the reflections on Relational Database Access in chapter 5. While as a developer you might be tempted to convert everything to the reactive model, this part of the book shows where it doesn't make sense to do so.

By converting the access to your relational database to an asynchronous model you won't gain anything. Whatever you are doing on the client side, let's say for example your PostgreSQL will run all of your concurrent requests in different processes. This results in a noticeable limit on the number of parallel queries you're able to run. You cannot lift this limit by becoming asynchronous on the client side.

Links to the book

ZooKeeper, Distributed Process Coordination

posted on

ZooKeeper is a component that facilitates building distributed applications. It is:

The data managed by ZooKeeper is presented in a file system like manner with directories and files whose names get separated by slashes (/). The difference to a file system is, that you can store information in the directories as well. Or seen differently: directories are files at the same time. Based on this simple abstraction, users of ZooKeeper can implement things like leader election in a cluster of software instances.

The book by Flavio Junqueira and Benjamin Reed

The book is written by two experts of ZooKeeper, that know how it works internally and what are the pitfalls in which the users can trap. Flavio Junqueria is one of the ZooKeeper's contributors. Benjamin Reed helped to start ZooKeeper.

I was reading the book, because I is the basis for other distributed software systems I made myself familiar with the last months, including Akka and Mesos. I always think, that it's a good idea to know at least one layer below the layer I am actually using. I allows me to understand better what I'm doing and how to do it right.

The book starts by giving an overview of the concepts and basics used by ZooKeeper. It introduces an example master-worker application, that is implemented using different languages afterwards:

Other topics discussed in the book are:

I think, that this book is a highly valuable resource for anybody working with ZooKeeper either directly or indirectly by using some other software, that uses it.

Links to the book

Microservice Architecture, anligning principles, practices, and culture

posted on

To stay on the right track with microservices, I wanted to revisit the philosophy and organizational recomendations on how to do them right. After reading Building Microservices in april this year, I got Microservice Architecture, aligning principles, practices, and culture by Irakli Nadareishvili et al.; O'Reilly Media, Inc., 2016.

The book can be read on one week-end as the content is very well condensed to 118 pages.

What did I get from the book?

The book provides a lot of information on the culture and organizational requirements to successfully implement a microservice architecture.

[C]ulture is perhaps the most intangible [domain] yet may also be the most important. We can broadly define culture as a set of values, briefs, or ideals that are shared by all of the workers.

Microservice Architecture, page 29

It was very interesting to me to compare the presented observations with how we are doing microservices at work. One thing was especially interesting for me, as I did not read of this before, was the mention of the paper The Social Brain Hypothesis, 1998 in which Robin Dunbar writes about observations that there are several sizes of groups, that work better then others.

[T]he various human groups that can be identified in any society seem to cluster rather tightly around a series of values (5, 12, 35, 150, 500, and 2,000).

The Social Brain Hypothesis, Robin I. M. Dunbar, 1998

I can definetly recommend this book to everyone that already does microservices, or that plans to implement them. It does not present nor recommend any specific software product, but talks about the social and organizational requirements to succeed with this type of architecture. And it notes that they are not always the right way to go. In the book there is also a detailed list of further sources to deepen on various aspects of the topic.

Links to the book

Developing Web Components, UI from JQuery to Polymer

posted on

It's hard to find sources how to do front-end micro-services in a single page application (SPA). Having a single front-end that faces the user makes it hard to impossible to exploid the full power of going micro-services in the back-end. For every new function you cannot just deploy the corresponding service, but you have the dependency to update and redeploy the service as well.

So I was looking around how to go micro in an SPA. One of the ideas I found on the web was to do so using web components. To evaluate this idea as someone working mainly on the backend I thought I should get some literature and bought the book Developing Web Components by Jarrod Overson and Jason Strimpel, O'Reilly Media, Inc., 2015.

What did I get from the book?

The end-to-end theme of the book is to develop a dialog box web component. As a familar entry to the component it starts doing so in JQuery. Afterwards the component gets ported to using plain HTML5 APIs (templates, shadow DOM, custom elements, and imports). In the last part of the book, it gets converted to using Polymer. This makes the implementation much cleaner and easier to do.

As I don't do much front-end development it was very interesting to see what is possible in modern browsers by now. I like how web components bring back some of the strengts of HTML: marking the structure and semantics of a text instead of building interfaces by just styling a bunch of <div/>s. I like to see hightly semantic pages on the web. But I see so many web developers only taking care of the visual impression in a browser. Therefore it's always a requirement, that the way to get there also results in the work being done easier. The ease of using components built with polymer may achieve this goal.

But pertaining to my initial motivation to read the book, I have to say, that I didn't find a good match for doing micro-services in using web components.

Recommended links

„ARM Assembly Language - an Introduction“ von J. R. Gibson

posted on

Coverbild ARM Assembly Language von J. R. Gibson Die letzten Tage habe ich das Buch ARM Assembly Language - an Introduction von J. R. Gibson gelesen. Es ist eine Anleitung wie man ARM-Prozessoren in Assembler programmiert. Geschrieben wurde das Buch als Lehrbuch an der Universität Liverpool. Das merkt man, am Ende jeden Kapitels stehen Übungsaufgaben zum Einprägen und Verständnis überprüfen.

Das Buch ist perfekt für Einsteiger in der Assemblerprogrammierung. Der Leser erhält einen ausführlichen Überblick wie er in dieser Sprache programmieren kann. Wird der Einstieg mit einer begleitenden Vorlesung und Übungen unterstützt, so funktioniert das Buch noch besser. Es hilft aber auch, ein paar Grundlagen der Zahldarstellung und der Bit-Manipulation schon zu kennen.

Im Buch wird die ARM-7-Architektur behandelt. Vor allem wird der Prozessor ARM7TDMI betrachtet. Details zu den Prozessoren oder anderer Hardware findet man aber nicht. Dadurch ist das Buch auf für die allgemeine ARM-Programmierung interessant. Wer allerdings die Cortex-M-Prozessoren programmieren möchte, hat mit diesem Buch nicht das richtige. Es behandelt nicht die THUMB-Befehle, die der Cortex-M ausschließlich unterstützt.

Meine Bewertung: 5 von 5 Punkten für den Leser, der Assembler auf einem ARM-Prozessor lernen möchte und motiviert sind auch die Übungsaufgaben zu bearbeiten. Lesen alleine reicht nicht aus.

„C++11“ von Rainer Grimm

posted on

Coverbild C++11 Endlich wissen was in C++11 neu ist, deswegen habe ich „C++11, Der Leitfaden für Programmierer zum neuen Standard“ von Rainer Grimm gelesen. Ein dickes Buch mit 500 Seiten beschreibt was sich in der neuen Version seit 1998 geändert hat oder neu ist. – Und das ist eine Menge.

Immer wieder war ich erstaunt über ungewöhnliche neue Konstrukte und neue Syntax. Solch große Änderungen hatte ich einer reifen Sprache nicht zugetraut. Meine Highlights in C++ sind:

Sehr mutig ist die Spezifikation auch weil sie eine neue Syntax für Funktionen einführt. Bisher definieren wir eine Funktion in der Reihenfolge „Rückgabetyp, Funktionsname und Parameterliste“. In C++ können wir den Rückgabetyp auch hinter die Parameterliste schreiben:

auto fac(int n) -> int {
    return n > 0 ? n * fac(n - 1) : 1;

Rainer Grimm geht die Änderungen leicht verständlich an: in drei Durchgängen zeigt er zuerst nur was es neues gibt, im zweiten geht er weiter in die Tiefe der Erweiterungen und im dritten geht er ins Detail. Er Leser kann sich so schnell einen Überblick verschaffen und stolpert in den Details nicht darüber, wenn in Beispielen auch eine andere Neuerung als die gerade erklärte schon benutzt wird. Einziges Manko: im dritten Durchgang bei den Details wurde mir etwas langweilig. Trotzdem ein großartiges Buch dem ich vier von fünf Punkten gebe.

Unless otherwise credited all material Creative Commons License by Matthias Wimmer