Ylan Segal

Book Review: Building Microservices

There is a lot of buzz around microservices and service-oriented architecture, at least in the corner of the internet that I frequent. Heavyweights in the Ruby community, like Heroku think microservices matter. It seems that enough people are adopting microservices head-first that some influential people in the community have started warning that it might not be for everyone. Martin Fowler thinks there is a microservices permium to pay and that you probably want to start with a monolith. Avdi Grim is of the opinion that people are adopting microservices for the wrong reasons. And David Heinemeier Hansson, devoted a portion of his RailsConf 2015 keynote to denouncing the practice.

In “Building Microservices. Designing Fine-Grained Systems”, Sam Newman explores the practice of microservices. Starting with a definition of just how small they are (something that can be re-built in 2 weeks time), the book covers in depth what microservices are good for and what having a fleet of them looks in practice.

As one would expect, the author is partial to microservices, but acknowledges that they are not a good fit for every organization and every project. For example, when a start-up is still exploring their domain and iterating fast, the boundaries of their systems are hard to predict and API might churn significantly. Similarly, teams that are not leveraging cloud computing and have the necessary automation in place to provision and deploy new services might not find much success in having numerous systems to support in production. The author makes well-reasoned arguments for organizations only considering microservices when they have great automated-test coverage, continuous integration in place and automated deployments (preferably continuous delivery).

Along the way, Mr. Newman also points out that, like most things in Engineering, there are trade-offs to be made: Latency and develops complexity, chief among them. However, there is also a lot to be gained: being able to mix-and-match technology stacks, resilience of the whole system (assuming that the proper precautions are in place), independent scaling for each piece, deployment in stages, organizational alignment, the ability to replace parts as needed and maintaining team velocity.

I though the book to be an overall good read for those starting to dip their toes in the microservices world.

The REPL: Issue 10 - May 2015

Lessons Learned In Software Development

Henrik Warne compiles a list of rules-of-thumb he has learned throughout his career. Great nuggets of information. If you find some of these obvious, it’s probably because you have already internalized them.

Do Not Disclose Your Salary To Recruiters

Salary negotiations are something that many software engineers (and people in general) don’t give much thought about. However, it’s effect on your career is huge. Learning to negotiate and dealing with recruiters are useful skills to have.

Why Learning Rails Is Hard

Brook Riggio presents a great mind-map of the skills he considers a Rails developer needs to be competent in. As he mentions, if anything, after reading it I was ready to add many items to the list. Web systems can get complicated in a really quickly.

Using a Ruby Class To Write Functional Code

With a clear style and building sequentially, Pat Shaughnessy explains how to leverage some functional programming concepts in an object-oriented language. I’ve had a lot of success implementing code in this manner. Makes it easy to read, easy to change.

Experiment: Use Rbnev Instead of Rvm

I have been using rvm to manage my rubies for almost 5 years, mostly without problems. Throughout the years though, the number of features added keeps going in an attempt to do more for the user. Two weeks ago I was dealing with a cryptic stack trace related to X509 certificates when doing some cryptographic operations in JRuby 1.7.19. I wasn’t really sure what the culprit was, but the rvm documentation suggest that rvm itself can fix the issue. That seemed weird to me and also, it didn’t work. I was stuck with a JRuby installation that could not read the certificate from *https://www.google.com*.

Methodology

Under the assumption that the culprit of my problem was rvm, I decided that try one of the alternatives: rbenv. Luckily this is a blog, because when speaking the name of the two tools sound infuriatingly similar. Switching to rbenv was relatively easy. The steps I followed are those outlined in brentertz gist:

Installing rubies was straight forward. I usually need a few versions of MRI on hand, going back to 1.9.3 and JRuby as well. All were installed without problems and worked fine.

My team had some scripts that assumed rvm was installed, but it was trivial to add support for rbenv, like so:

1
2
3
4
5
6
if which rvm &> /dev/null; then
  rvm --create use ${version}
fi
if which rbenv &> /dev/null; then
  rbenv shell ${version}
fi

In addition, I like having the current ruby version in my prompt, because I switch between versions often, even while working on the same project. My custom zsh theme needed to be adjusted as well. Using the same trick as above, I created a bash function that does the right thing:

1
2
3
4
5
6
7
8
9
10
11
# Somewhere that gets sourced on shell init.. like .profile
ruby_version()
{
  if which rbenv &> /dev/null; then
    rbenv version | cut -f1 -d ' '
  else
    if which rvm-prompt &> /dev/null; then
     rvm-prompt i v g
    fi
  fi
}

Results

Most of our projects have been around for a while, so they are setup to use gemsets, because that was what rvm encouraged (and maybe still does, I don’t know). rbenv’s philosophy, on the other hand, is that they are unnecessary when using bundler. So far, not using gemsets has not had negative effects for me. I also have noted that my shell feels snappier when navigating directories: I attribute that to rvm hooking into cd, which is not done by rbenv.

So far, I gave been happy with rbenv and believe that it is a simpler tool that does enough for the job at hand, but no more. And remember that X509 issue? It turns out it was not really related to rvm at all: It was caused by duplicate certificates derived from the OSX keychain that where being picked up by JRuby and the underlying Java classes objected to. That issue got solved by getting certs from the curl website and pointing JRuby to use those.

Book Review: Architecting the Cloud

Architecting The Cloud. Design decisions for cloud computing service models, by Michael J. Kavis describes cloud computing in general and the different service models that are prevalent today in particular. It explores the differences and trade-offs between Software as a service (SaaS), Platform as a service (PaaS) and Infrastructure as a service (IaaS). I consider the book a good introduction to considerations for cloud computing for those that are used to more traditional data-center deployments.

The author covers a section on worst practices: Things that do not translate well when moving to the cloud and recommendations on how to avoid them. I found the most useful chapter to be the one on disaster recovery: A good overview of different strategies to become fault-tolerant in the cloud and embracing resiliency.

The REPL: Issue 9 - April 2015

Does Organization Matter?

Uncle Bob makes a useful analogy about code organization and physical organization of say, your desk or a library. Organization matter. Sometimes, all we need is a small amount of organization, sometimes we need the Dewy Decimal System

Why (and How) I Wrote My Academic Book in Plain Text

Most developers appreciate the benefits of plain text files since they play so well with other tools, like source control, grep, find, etc. W. Caleb McDaniel makes a great case for using plain text other than for programing code. In his case, he composes his academic writing in plain text and uses open source tools at the end to convert them to industry-standard proprietary formats. Awesome.

The Quality Wheel

A big part of effective communication is sharing the same terminology. It helps with context and allows us to be more specific. Jessitron proposes expanding our vocabulary around what “Quality Software” means. Instead of saying a piece of code is “good” or “clean”, how about it’s “configurable” and “readable”.