My Journey with Elixir

December 18th 2016, 3:25 pmCategory: Software Engineering 0 comments

This article is not technical and highly opinionated!

What is Elixir?

Elixir is a functional programming language built on top of Erlang Virtual Machine. Think of Elixir to Erlang as Scala to Java. Erlang was designed and implemented at Ericsson in the 80s. it is used to build scalable, fault-tolerant, distributed, non-stop applications. Erlang has been used by the telecom industry for over 20 years, so, it has a proven record in production. Elixir inherited all the goodness of Erlang with a much elegant and easier syntax.

Why Elixir?

CPUs are not going to be faster, instead we have multiple cores. Obviously, our code must be concurrent to be able to utilize all the cores sufficiently, and here’s where Elixir shines.
Instead of relying on the operating systems concurrency, Erlang virtual machine built its own concurrency model which is based on the Actor model where processes communicate with each others through message passing, hence Erlang is a concurrent language in its core. So, by adding more CPUs to your machine, Erlang is going to utilize them and your application is going to be faster.
 

An application built in Erlang can:

  • Handle very large number of concurrent activities

  • Be easily distributable over a network of computers

  • Be fault-tolerant to both software and hardware errors

  • Scale with the number of machines on the network

  • Be upgradeable and reconfigurable without having to stop and restart

  • Be responsive to users within certain strict timeframes

  • Stay in continuous operation for many years

Love at first sight

A couple of months ago, one of my colleagues asked me if I know anything about Elixir. All what I knew back then was that the Ruby community was talking about a new programming language called Elixir. That's when I decided to give it a look.
 

At the beginning, the code looked much like Ruby, I was able to see a lot of similarities. But when I started learning Elixir and tried writing some code, I found out that it is not that easy. The concepts of functional programming for someone who has been using OOP  throughout his career is very hard to grasp in a couple of weeks.

The hard part here is that I had to unlearn all the things I learnt! It's totally a different way of thinking and you will need time to get used to it.

The Elixir official tutorial is a good place to start, but it's not enough. I tried exercism.io and then I realized that I need to go back and re-read the tutorial once again. The exercises and the solutions on exercism.io was a great way to learn and practice Elixir.

Then I had a look into Phoenix (web framework built on Elixir) which looks like Ruby on Rails although Phoenix creator says it is not! The framework is super fast, but I had troubles with their documentations. Back then Ecto 2.0 was not yet released and it was very hard to learn about it. At the end I was able to do what I wanted to do  with Ecto but it took too much time and effort due to the lack of good tutorials and documentations.

My Opinion

From what I read and watched, I can say that Elixir/Phoenix mostly are going to make the same impact that Ruby/Rails did 10 years ago. But the question is should we start using them now in production?In my opinion, you must start learning about Elixir. There are a lot of different concepts you will learn about, that will make you see things differently. But using it in production is something else. The first challenge is that not all members of your team will be able to learn it easily. I am not talking about the syntax here. Elixir is a pure functional programming language, we are not dealing with objects, instead we are dealing with immutable data. We are not thinking of changing the state, instead we are thinking of data transformation. This switch may take time. Second challenge is the lack of documentation for some of the 3rd party packages. Third challenge is that the community is still growing.

So, what to do?

I think for now the best things to do are to keep learning Elixir, make small pilot projects or maybe try to contribute if possible.


References:
Actor Model 
Why Erlang 
Elixir Getting Started 
Elixir School 
Phoenix 
Ecto 
Exercism 
 

One of the most overlooked features of Java and programming generally, is WeakReferences. Here you can find a walkthrough of java.lang.ref and similar options in other languages with suggestions of possible uses.

 

Verbal Expressions

September 5th 2013, 3:07 pmCategory: Software Engineering 0 comments

I have always hated Regular Expressions and avoided to use it in favor of writing longer code that is just 10x readable (and not much slower).

 

Now after I have seen Verbal Expressions will surely start using it Insha' Allah, specially that it is ported to many languages (including Objective-c)

 

Kudos to Mahmoud Khaled for finding this.

 

Its Apple again, moves slowly but surely. 

Apple, a company admired by many people around the world. I will not talk much about its success but I talk about something I noticed in the way it pushes new technology and features.

I noticed that Apple slowly pushes new features and it continues to enhance them step by step to surely result in a better implementation over other ordinary solutions, which ultimately let Apple overbeat its competitors.

I would like to explore the software company's personality types. It will be helpful for clients who seek a software vendor to outsource a portion of their work. Also this post will assist IT job seekers to understand the personality of the company with which they are going to engage.

Let we categorize the software companies personalities based on their primary focus which is can be one of the following: process, people (clients), technology, or ideals.