Bash Scripting Best Practices

| Comments

I was always afraid of writing shell scripts. Bash seemed to be a programming language that doesn’t allow a slightest mistake… Extra space here and there and everything blows up.

Like with every skill, persistence and repetition help. I’ve started writing more and more bash scripts a few years ago. But it’s important to remember one simple rule – when things become really complex you need to switch to Python/Ruby/scripting language of your choice. Please do!

Anyway, today I want to share some of the very practical conventions, best practices and recommendations I gathered over these years.

It’s not an introduction to bash, you should have some background already (ideally some war stories as well).

Also, I’m not an expert! It’s ok to not agree with me. And I’m pretty sure almost everything I mention can be improved. So please help me and leave some feedback ;–)

How to Build CLI in Node.js

| Comments

CLI (Command-line interface) is a very common way to run a program in a terminal. As a software engineer you use different CLIs every day – git, Docker, npm, etc.

Today I want to share my experience building CLIs using Node.js and a few helpful packages.

Craft Conf 2017

| Comments

Last week I attended Craft Conference in Budapest, Hungary. Here’s the description of the event:

CRAFT is about software craftsmanship, presenting which tools, methods, practices should be part of the toolbox of a modern developer and company, and serving as compass on new technologies, trends. You can learn from the best speakers and practitioners in our community.

It was definitely one of the best conferences I’ve ever been so far and I’m happy to share some highlights!

About Being a Polyglot Software Engineer

| Comments

Recently I’ve watched a technical talk about some tool, let’s call it X. This tool is written in Java. Presenter was really excited and energetic and he obviously knew his stuff. And then, there were two questions after the presentation:

  • Are there any similar solutions in languages other than Java?
  • What do you think about the concept Y?

Microxchg 2017

| Comments

Last week I had a pleasure visiting Microxchg conference in Berlin. I was really excited, because I also conducted my first workshop there – Building Microservices with Scala and Akka.

I think the event was truly successful and I’d like to share my thoughts and notes below for the most interesting talks I attended.

The conference is dedicated to Microservices, as you can guess from its name. It’s not new – originally started in 2015, it’s been attracting top presenters from all around the world, including recognized experts like Sam Newman and Fred George.

2016 in Review

| Comments

Here’s my first attempt to summarize most important things happened in my professional life (mostly programming) this year, for future self. May be it’ll be interesting for someone else too.

Intro to RAML 1.0

| Comments

Pretty much every web developer has built HTTP APIs. How does it usually happen? If you have good practices established in your team you probably start with a whiteboarding session. Good one-hour exercise with your colleagues produces something that we call “API spec”. It might look like this:

Great job everyone! Although, we forgot a few “minor” things:

  • Error messages and error HTTP codes
  • Authorization and authentication
  • Schema for the entities
  • Versioning
  • … >_<
  • And the most important, does it actually satisfy consumers (like front-end apps or other systems)?

Multiply that by number of years you’re going to maintain that (∞) and the rate of adding new features… Looks really depressing. Our beautifully designed “API spec” quickly becomes a pile of unmaintainable mess. Is there a better way to do it?

Bootstrapping Akka Cluster With Consul

| Comments

As you probably know, I’m a big fan of Akka. Akka Cluster is a great low-level mechanism for building reliable distributed systems. It’s shipped with powerful abstractions like Sharding and Singleton.

If you want to start using it you should solve cluster bootstrapping first. Almost every tutorial on the internet (including the official one) tells you to use seed nodes. It looks something like this:

1
2
3
4
akka.cluster.seed-nodes = [
  "akka.tcp://ClusterSystem@host1:2552",
  "akka.tcp://ClusterSystem@host2:2552"
]

but wait… Hardcoding nodes manually? Now when we have Continuous Delivery, Immutable Infrastructure, tools like CloudFormation and Terraform, and of course Containers?!

Well, Akka Cluster also provides programmatic API for bootstrapping:

1
def joinSeedNodes(seedNodes: Seq[Address]): Unit

So, instead of defining seed nodes manually we’re going to use service discovery with Consul to register all nodes after startup and use provided API to create a cluster programmatically. Let’s do it!