The Well-Grounded Rubyist book review

Ruby (along with Python and Javascript) is a kind of a language that allows you to use it without dropping a sweat to study it. That’s what has happened to me. I’ve been using Ruby for a while, but haven’t read anything but blog posts about it.

This book gave me a good momentum to start using some of the Ruby features I (i.e. Fibers ) that I was  completely unaware before, though the amount of input it provides is not overwhelming which helps you to digest this book over a weekend.

That’s a good starter for anyone willing to start coding in Ruby 2.1, lots of examples are outdated if you aim for Ruby 2.4+

My score 4/5

 

Author's profile picture Michael Koltsov on books

Introducing Python book review

This is actually the first book about Python I’ve read even though I’ve used it extensively throughout the years.

My perception that this book proves is that Pythonistas are usually not programmers by trade, they’d come to programming either due to a lucky coincidence or by taking a wrong turn on the road of career hopping.

This book has promised to give a broad look on the Python’s ecosystem, it actually delivers on what it promises. But this look is so shallow that I can’t recommend this book for those who’s willing to get a deep dive into Python on a weekend. The technical details it gives look like author’s waving the hands in the air with no actual proof that I’m used to in Scala and Java books.

Good book, but I can’t recommend it to any professional programmer who’s used to technical/programming/mathematical books.

Score 3/5

Author's profile picture Michael Koltsov on books

Continious Delivery book review

This book is considered a cornerstone of the DevOps movement. In my opinion, it might be that in the very beginning, but currently most of the concepts that it presents are obvious and outdated.

I will recommend it to be read to someone who’s new in the DevOps community, but if you’ve got a few years of experience in the area under your belt I would   not.

It’s nice to have all good concepts under one cover, but reading a 400-pages long book that will tell you the history of GIT and SVN is pointless in my opinion. Most of the ideas presented in the book could be wrapped in one long yet succinct blog post.

My score 3/5

Author's profile picture Michael Koltsov on books and DevOps

The DevOps Handbook book review

This book actually reminds me of the book “Release it ” but with much less emphasis on actual technical patterns but with a stronger accent on soft skills.

It’s also complimentary to the “Phoenix Project” written by the same authors.

If you’ve skipped the “Phoenix Project” or you don’t like to read the novels, like I do, I would recommend you to start with this book as it has much more momentum than the first book.

It has a bunch of great inspiring examples of successes from the companies that have embarked on the “DevOps journey” which to me is the best part of this book. Also the book is relatively recent therefore a lot of its advices are quite innovative and might be even disturbing to some.

My score 4/5

Author's profile picture Michael Koltsov on books and DevOps

The Healthy Programmer book review

Sometimes I’m late for some of the most important events in my life. Hopefully, health is not the issue that I’ve missed. Self-awareness and consciousness have always been a nice thing to have under your belt.

This book helps to improve those skills by giving you a nice reference for all the good things you need to be aware of that might either help you to advance or suffer as a human being.

This book is nothing more than a composition of blog posts, though it gives your a nice system as a set of goals you can follow along with a companion mobile app. In my opinion, it’s much nicer to have good ideas under one cover than scattered around the Internet.

My score 4/5 due to how actual this topic is for myself

Author's profile picture Michael Koltsov on books and life

“Release it” book review

There’s a relatively short list of books I would like to keep on my desk. Most often those books are references and a composition of famous quotes. After I’ve read this chap I’d like to have it on my work desk at any moment.

This book is a perfect mix of lots of useful technical insights, practices and recommendations got from the author’s hard-earned experience combined with some of the soft-skills you need to make your software and its maintenance (which as the author states costs more than the initial 1.0 version) as smooth as possible with as much of interrupted sleep as you could possibly get.

The book is definitely outdated, some of the references to particular technologies look odd and obvious (if not even funny). Nevertheless, I will put this book in one row with the “SRE book” & “Project Phoenix” as it combines them both.

My score is 5/5

Author's profile picture Michael Koltsov on books and DevOps

The phoenix project book review

That was the first non-technical book I’ve read for the last few years. At first I was really struggling to go through the first one hundred pages as I was constantly bored due to absolute lack of any technical details. However, a good book is always a good book even though it’s an IT-concerned novel.

What I like in this book is how it reminds some of the actual projects I’ve worked. I’m not sure whether the final solution that this book presents will be suitable for anyone but still it gives a lot of food for thought how to improve the inner processes and the workflow in any IT organization. If you like “The Deadline” by Tom DeMarco you would love this book.

My score is 3/5, simply because I don’t like novels.

Author's profile picture Michael Koltsov on books

What the newly coming Java 9 will bring to your Scala?

Abstract

Java 9 is supposedly coming in July this year. All of its features are already discussed, however, as it was in the past everyone will wait until the minor version 1 or even 2 will be released for the wide adoption to take place. What’s even more important that usually OpenJDK community doesn’t care a lot about the JVM languages if it’s not Java. Those Clojure developers who used to install every JVM update know what I’m talking about.

Let’s quickly reiterate what are the major JVM/Java features that might affect (or have already affected, according to the current b168 build) Scala and its ecosystem as Scala has currently its prime-time with a lot of business users unwilling to break their core apps due to a new version of the platform its built upon.

In my opinion the list of features should look like that:

  • JShell
  •  Compact strings
  •  Variable type inference
  •  Factory methods for making immutable collections
  •  ECMA6 features in Nashhorn
  •  Http/2 client
  •  Private methods in interfaces
  •  Reactive streams
  •  Multi-release jars
  •  AOT Compilation
  • G1 Garbage collector
  • Modules

Let me quickly go through that list one by one to explain what in  my opinion will be the pros and cons of every feature.

JShell

If someone still recalls what was the BeanShell back in the days when there still was a need to write scripts in java due to lack of robust scripting language for the JVM let me assure you that’s not it though a full-rethought fork of it that has gone through multiple JCP improvements. It’s not as versatile as running

 sbt console

 

on your project with all your dependencies and Scala code compiled being already added to the classpath, but hopefully Java build tools could improve that and make this REPL as useful as it is  for Scala projects.

import java.security.Security

Security.setProperty("crypto.policy", "unlimited")

Notice the lack of semicolons, but be aware that you still need to use them if you plan to write a function.

void println(String arg) {
    System.out.println(arg);
}

println("Hello Java")

Compact strings

Did you like that every string is a char array? I didn’t as even considering a string pool having a lot of strings was costly, made your heap unnecessarily large and  made your unicorn garbage collector cry since why should it be bothered with cleaning of … strings?

GC has to stop the world due to abundance of strings

Since JDK 9 your strings will become… arrays of bytes plus an encoding flag.

According to findings made by the JDK committee the lower footprint will make your unicorn garbage collector dance of joy.

The GC is waiting for more garbage

Let me illustrate it with a slide from a great presentation done by Aleksey Shipilev at JFokus.

Variable type inference

You’re finally allowed to omit the type while allocating a new Java variable, like you know… in Scala.

var myCounter = 0L

val myName = "Adam"

Sorry, just kidding. It’s not yet there. It’s the most anticipated JEP for me personally that was proposed last year by the JCP, even though it was authored by Brian Goetz there’s no final decision yet will it be a part of Java 10 or Java XXL (the one that will implement generics in a real type safe way rather than with type erasure).

 

Factory methods for making immutable collections

One of the most loved and hated Scala feature is its collection library. In case of JDK 9 it has nothing to fear about. Making immutable collections have become less tedious, though the choice of factory methods instead of constructors is questionable if you ask me. The most frequent use case for Google’s Guava (apart from the magnificent CacheBuilder which we often use with Scala) is fully covered now by the Java core functionality in my opinion.

List immutableList = List.of();
List<String> immutableList = List.of("1","2","3")
Map emptyImmutableMap = Map.of()
Map nonemptyImmutableMap = Map.of(1,"one",2,"two",3,"three")

 

ECMA6 features in Nashhorn

We use Nashhorn and JVM-based scripting quite often, therefore having ECMA6 features like arrow function and block scope will be very helpful.

Unfortunately, in every JDK9 build I tried I couldn’t find features promised in the corresponding JEP.

Let me list them so we could hope to see it in the near feature with a minor update.

Promised during the initial update

  • Template strings
  • let, const, and block scope
  • Iterators and for..of loops
  • Map, Set, WeakMap, and WeakSet
  • Symbols
  • Binary and octal literals

Promised with later updates

  • Arrow functions
  • Enhanced object literals
  • Destructuring assignment
  • Default, rest, and spread parameters
  • Unicode
  • Subclassable built-ins
  • Promises
  • Proxies
  • Math, Number, String, and Object APIs
  • Reflection API
  • Classes
  • Generators
  • Modules
  • Module loaders
  • Tail calls

Http/2 client with websockets

Though not as useful as Spray-can and its later reborn as Akka-http-client this version of out of the box http client for Java has finally managed to use Http version 2 as well as WebSockets. This is really helpful as it will allow to get rid of nasty includes of Apache Commons and Spring for the single purpose to do a http call… like we do in 2017. Did I say that it also has an asynchronous API?

import java.net.http.*

import static java.net.http.HttpRequest.*

import static java.net.http.HttpResponse.*

URI uri = new URI("http://grandparade.co.uk/blog")

HttpResponse response = HttpRequest.create(uri).body(noBody()).GET().response()

System.out.println("Response was " + response.body(asString()))

 

Private methods in interfaces

This is the feature that looks to me as an attempt to chase the  Scala’s trait features. In addition to the default method implementation in interfaces added in JDK8 this is the second step to make mixins available for Java developers.

This is very handy for those who need to switch between Scala and Java quite often (like I do).

public interface Bear {
  private Long iterateTeeth() {
      return 42; 
  }
  private static void makeARoar(){
      System.out.println("GO BEARS GO!");
 }
}

Reactive streams

I’m not exactly sure how this feature will be adopted by the Java developers as we’ve seen a lot of traction towards JavaRx amongst them. Although lambdas provided by JDK8 allow to follow the reactive manifesto in Java easier than before, it’s still a long way to go to do this in Java

val o = Observable.interval(200 millis).take(5)
o.subscribe(n => println("n = " + n))
Observable.just(1, 2, 3, 4).reduce(_ + _)

However, this is also fine written with the Flow API provided by JDK 9

import java.util.concurrent.SubmissionPublisher;  
...  
    //Create Publisher  
    SubmissionPublisher<String> publisher = new SubmissionPublisher<>();  
  
    //Register Subscriber  
    MySubscriber<String> subscriber = new MySubscriber<>();  
    publisher.subscribe(subscriber);  
  
    //Publish items  
    System.out.println("Publishing Items...");  
    String[] items = {"1", "x", "2", "x", "3", "x"};  
    Arrays.asList(items).stream().forEach(i -> publisher.submit(i));  
    publisher.close();

Such primitives of the Flow API will be given during the initial release:

  • java.util.concurrent.Flow
  • java.util.concurrent.Flow.Publisher
  • java.util.concurrent.Flow.Subscriber
  • java.util.concurrent.Flow.Processor

Multi-release jars

By releasing multi-release jars Java committee is planning to address the pain you have to go through while upgrading a JVM version by providing compiled classes for every JVM version they might be executed on.

jar root
  - A.class
  - B.class
  - C.class
  - D.class
  - META-INF
     - versions
        - 9
           - A.class
           - B.class
        - 10
           - A.class

Let’s say your API has been compiled with the JDK 10, but for those retrogrades who are still using JDK 9 you can provide their own oldschool version of your class inside your jar file with no effort from the user’s side.

This feature makes my unicorn very happy.

AOT Compilation

This feature addresses those apps that have grown so massive that the JIT compiler takes time to warm-up and fill its caches. The idea is to have your code already compiled to bytecode before  starting your application to make the bootstrap of both big and small apps as agile as it could possibly be.

//first you compile it with the new jaotc compiler
jaotc --output libHelloWorld.so HelloWorld.class
//Then specify generated AOT library during its execution
java -XX:AOTLibrary=./libHelloWorld.so HelloWorld

There’s a lengthy thread on HN that explains all pros and cons of that feature, but during my small experiments I haven’t noticed any big difference. Scala compiler still takes the longest time to finish its compilation process in comparison with javac and jaotc. Theoretically, this feature might be a game changer for small apps like test Java packs that are eager to start as soon as possible with no need to wait until the caches get warm.

G1 Garbage collector

G1 collector has been added some time ago, so now after a long improvement & refinement process, it’s going to be the default GC as well as it’s one of the only two that are available for the jaotc compiler.

In my personal experience not having to think about what GC you’re using and which options of it to tune to get the most performance is actually a great thing as it allows you to stand on the shoulders of giants.

In my personal experience G1 makes the smallest GC pauses as well as it has the most throughput in comparison with parallel and CMS garbage collector.

Modules

One of the most awaited features of the new JDK is the “Jigsaw” project that was promised to use since java7 six long years ago.

JDK 9 will introduce such parts of it:

  • Modular JDK
  • Modular Java Source Code
  • Modular Run-time Images
  • Encapsulate Java Internal APIs
  • Java Platform Module System

The bottom line is that you will be able to release your app in multiple jars by splitting it into modules and encapsulating each one into its own file. The JDK9 itself will be released in 92 modules (this number may change for the final release).

Unfortunately, sbt and scalac don’t support modules at that moment.

###

Author's profile picture Michael Koltsov on stuff

Ansible for DevOps book review

I was given this book, which is an uncommon event for me as I usually buy all books by myself. Moreover, I was given a paper version of the book.

Therefore, there were absolutely no regrets regarding this book =) The book is concise and covers almost all parts of Ansible I’ve ever heard of. The only exception was the case when you need to deal with a server that’s under a jump host/bastion, which is very common for cloud deployments as they usually are done in a VPC network of some kind that not exposed to the outer world.

This book has plenty of handful examples, but the most useful thing in it were not them.  The book covers some of the most undervalued parts of the Ansible ecosystem: Ansible Galaxy, Tower and it also has a decent set of invaluable pattern and best practices for writing your playbooks.

My score: 5/5, I’m not sure if you need to read anything more than this book if you plan to use Ansible professionally.

 

Author's profile picture Michael Koltsov on books

Puppet Essentials book review

The book provides only a shallow knowledge of Puppet, doesn’t cover some of the most important modules you’ll need in the real world as well as it doesn’t provide practical examples.

I will recommend it only if you need to quickly brush up the technical details of Puppet’s architecture or you need to start using it quickly rather than spending some time on playing with examples its documentation provides

My score: 3/5

Author's profile picture Michael Koltsov on books

One of my favorite quotes drawn as a comic

Chris Hadfield{.authorOrTitle}, the first Canadian office on board of ISS

Author's profile picture Michael Koltsov on books

Mesos in Action book review

I can recommend this book only to those who’s looking for a very shallow knowledge of Mesos. It covers only the basics, no details, no iternal APIs, a lot of references to the Mesos documentation.

It’s worth reading if you need to quickly refresh your knowledge, besides that it’s worthless. It recommends to do Service discovery within the Mesos cluster by means of HAProxy & Mesos-DNS!!!

My score 3/5, RTFM

Author's profile picture Michael Koltsov on books

SRE book review

I don’t normally buy paper books, which means that in the course of the last few years I’ve bought only one paper book even though I’ve read hundreds of books during that period of time. This book is the second one I’ve bought so far, which means a lot to me. Not mentioning that Google is providing it on the Internet free of charge.

For me, personally, this book is a basis on which a lot of my past assumptions could be argued as viable solutions with the scale of Google. This book is not revealing any Google’s secrets (do they really have any secrets?) But it’s a great start even if you don’t need the scale of Google but want to write robust and failure-resilient apps.

Technical solutions, dealing with the user facing issues, finding peers, on-call support, post-mortems, incident-tracking systems – this book has it all though, as chapters have been written by different people some aspects are more emphasized than the others. I wish some of the chapters had more gory production-based details than they do now.

My score is 5/5

Author's profile picture Michael Koltsov on books

How Linux Works book review

This book doesn’t claim to cover all Linux features, but definitely it covers some of the most important ones.

It’s easy to read, though it encompasses lots of useful information. I wish my first Linux book was like that.

The only complaint I had with it was that though its second edition has been recently issued and it wasn’t strictly specified on which Linux distribution should I run some of the commands from the book  I wasn’t able to try some of them due to that there were no such packages in the APT repository for reference Ubuntu Docker image I’ve been using.

This is definitely not a book I would recommend to a SysOps, unless he needs to quickly brush-up his skills. But if you’re a “superuser”, that’s the book you should definitely read to know what’s “inode” any why top&vmstat&iotop might be much more powerful than you’ve thought.

My score 4/5

Author's profile picture Michael Koltsov on books

Plans for 2017

Personal

  • Brush up (most probably by starting from the basics) my German language skills
  • Start tracking expenses, again
  • Pass a Polish language exam
  • Teach Kira how to ride a bicycle, finally
  • Run a marathon
  • Play 2 etudes with Kira
  • Draw a vector banner
  • Read 20 books
  • Technical

    • Learn Python
    • Learn either Rust or Go, presumably both
    • Improve my data skills, implement at least 2 data-concerned apps as side projects
    • Migrate this website to Jekyll
    • Teach my wife a programming language that has a lean learning curve to the level at which she could write her own scripts
    • Improve my TopCoder/HackerRank profile, finish reading at least 2 algorithms-related books throughout the year
    Author's profile picture Michael Koltsov on life