Elixir is perfect for prototyping, programming, scripting, and anything except desktop GUI.
Elixir has a simplicity and complexity that is perfect for modern development.
Breaking things down into smaller units, decentralization and modular design are all approaches to simplicity — so long as the unity of the overall purpose is not lost. Edward de Bono
The above was said not by a Programmer but by a Physician and the inventor of Lateral Thinking.
This article consists of my current view and contains opinions on certain topics.
They may seem shortsighted due to the fact that I won't jump into details explaining each one of them.
The world evolves... And when you build something new on top of something old and reliable you get the best of both worlds.
- The future is about concurrency. Good concurrency.
- The future is about great Artificial Intelligence. Machine Learning, Deep learning and Neural networks.
- The future is about Internet of the Things or IoT.
- The future is about Cyber Security and how to integrate cyber security into everything you do.
- The future is now. Elixir is a perfect example of how we can build a better future.
I was a Tcl fan for many years. I've used it in all the projects I could. Personal and profesional. Why?
Development was fast and easy.
If you'd have asked me If i would give up Tcl for Python, Ruby, C# or Perl I would have said NO. There was no reason to do it.
Not one of those languages could come close to what I was doing. But it was also something else that kept me from migrating.
The power of the Tcl C API. With the C API I could just extend Tcl pretty easy to do my bidding from C whenever i needed speed.
Sure, all other languages have a C API but none of them reached the heights of the C API.
Tcl was the adolescence phase, eventually, we all grow up and want to be like Elixir.
Right now I have to say goodbye to Tcl and welcome my darling Elixir into my professional and personal life.
Elixir is the new generation of implementations Tcl and other languages lack. I'm not talking about libraries. I'm talking about ways of solving problems.
Even if Elixir doesn't have the nifty Starkit/Cookit system that Tcl has I truly hope it will develop distillery to do similar things on a more robust cross-platform way.
But let us not forget the Giant on which ELixir is built. Erlang.
Please note that even though I'm talking about Elixir, under the hood it runs in Erlang. So you better understand what I mean.
It's actually Elixir Erlang on Steroids. Or that Elixir is a Framework Macro Environment built on Erlang.
Thanks to all the Erlang developers throughout 30 years:)
So Erlang solved many problems of Distributed computing, parallel computing and Concurrent Programming BEFORE the cloud was anything near a hype.
Think about it for a second, please. Erlang implemented distributed node systems BEFORE anyother programming language even dreamed to run in the cloud.
Erlang/Elixir still do it way better than any other programming language. There ae some things which one must give up the Object Oriented ways of thinking to truly benefit from Functional Programming.
Even if Functional programming may seem awkward at first I've still got the perfect elixir for your programming!
I've never seen a programming language come equipped with standard libraries that deal and solve these issues with such ease.
I mean, I've effetively NEVER seen a programming language come with such a robust Standard Library and great documentation as Erlang.
Elixir goes a step further with iex.
You can type h Module.function and you will get the documentation of that module.
Hey! Python and Ruby have this too. Ok you got me there. How about this. You write your program with documentation.
Enter iex and all your documented functions are already available. Magic! I am aware that other languages handle this too, but not with such an ease of generating your documentation directly.
I mean, if you look at a distributed node of machines where data has to be kept in sync and replicated you will probably need to use 10 to 20 different toolsets.
Whilst this can be done with only the basic Erlang and Elixir installation without having to add up the security implications of all the different software servers used.
I truly believe that Erlang and Elixir are undervalued. Even more than I thought Tcl was undervalued.
I hope enough genius programmers will adopt it to develop even more interesting open source projects.
But I don't want it to become too mainstream so everyone thinks it's a hype and adopts it.
We want to avoid bad software by having exceptional software developers. Let the mediocre ones work in other systems there is always enough need for Ruby, PHP, Java and C#.
Looking at wikipedia https://en.wikipedia.org/wiki/List_of_programming_languages
There are around 780 programming languages listed, searching the interwebs we can find out that there are actually close to 2000 programming languages.
PHP, Ruby, Python or something else for the backend. Include SQL into the play. Add some bash for scripts. Add some extra tools which have a specific programming language. You get the point. We're overloaded with programming languages.
Then there is the problem of FRAMEWORKS.
Oh my God, there are hundreds of frameworks lying around for certain programming languages.
This one is better
I won't start pointing out that some languages are better than others
Or that Java sucks - the life out of you - big time. Even C# is better than Java. Hell, even pure C is better than Java. It's just a copy of C++/C with a lot of marketing hype.
No really. It doesn't matter what language you're using.
If it makes you happy and it gets it's job done keep using it.
Even if you use a hammer to cut off wood.. keep going, you may eventually succeed.
Most people start bashing wars about performance. Comparing different languages on different aspects.
That Java or X... or .. is performant. But if we all cared about performance we'd all still be writing in Assembly.
I mean really, no one almost cares about performance. If we'd care about performance we wouldn't have Java everywhere.
Programs are written badly, behave in wrong ways and are pretty slow.
Let's be honest here a moment. When you start to think about HTTP and HTML, it was developed as a way to link text only documents. It wasn't meant for what it evolved today.
The HTTP and HTML system kept getting addons instead of being reinvented.
Now the whole world is using a stateless system to implement stateful REAL TIME interactions.
Adding a saw to your hammer won't make it work better. You can't nail screws with a saw to your hammer.
But performance is important in other aspects. Our processors aren't getting any faster, we are getting newer features and maybe more cores.
Processing power is stagnating and we need more systems to process the bad software created by others.
Concurrency and distributed computing
Let's not even start talking about concurrency.
Concurrency? What are you talking about. Threads, semaphores, mutexes, shared data and state.Inter process communication.
Most of the work a DevOps team does is trying to glue together pieces of software to build a working system for bad software.
This means using 20 servers to do the work that maybe 10 servers could have done if software was written in a good way.
With Erlang and Elixir you don't need 20 different software projects to distribute your app and handle everything.
It's already built in. Concurrency is one of the core things built in. High Availability and fault tolerance is already a CORE feature. Distributing nodes is already built in.
Don't bother implementing OPen Stack, Azure or VMware systems. All you need are some good old nodes to do the job. You can even avoid installing anyother software and secure your system by having Erlang on bare metal Xen. Erlang on Xen speeds up everything by allowing your apps to perform on the bare minimum of resources.
I've really got the perfect elixir for your programming. Elixir through the Erlang ecosystem can help you implement a perfect concurrency and message passing system. This way you can implement any heavy work in C/C++/Rust and let Elixir/Erlang do the rest
With Elixir and Erlang you don't need things like Redis, Memcached or NoSQL. You can have GenServers act as Key/Value stores and share the data between nodes.
You certainly don't need message passing queues like Zero QM.
You can use those specialized systems, there is nothing stopping you from doing it. However the power and flexibility of Erlang/Elixir allows you to do everything in it.
Implementation Speed as a consideration in the world of connectivity
"de gustibus non est disputandum" (Tastes shall not be discussed)
This means that we shouldn't judge someone based on his preferences
However, if you can find out that you can do the same amount of work in less time with another language.. then It might be time to start rethinking your whole life.
I mean, why spend 2x the time when you can do it faster, and better?
Yes, enter the world of Frameworks. I'll write more about the pitfals in another blog post.
One of the main reasons I had chosen Tcl back in the day was because you could prototype things and build software extremely fast.
I could have a prototype in half with Tcl in half the time it took me to do it in Java or C#. Even if Java and C# provide me many frameworks and libraries, they are extremely verbose when it comes to development.
If a client had an idea I could prototype something, starpack it and ship it as a minimum viable product. Testing it and giving feedback.
I certainly didn't need to open any complicated IDE for this. I could use a simple editor with basic highlighting. Try working in Java, C# or other "powerful" programming languages without an IDE or a complicated makefile. Just go ahead, Give an IDE Up for a month. You'll soon realize that programming is though and you don't know your environment as much as you'd like to!
Tcl Threads where the closest thing to a safe and fast parallel execution I've seen.
But Elixir Processes based on Erlang are AWESOME. Other programming languages make what is simple in Elixir/Erlang feel so hard and frustrating.
Now I can put everything in a process. Communication is way easier and I know for sure that things won't get mixed up due to concurrency issues.
I can easily connect to other Elixir/ERlang nodes and pass data around.
Testing Love - Yeah, it's Test Driven Development all the way
One of the things I ADORE about Elixir is that you can write documentation and tests in your comments.
What? How is this possible?
Well, when you write your function documentation in markdown format (ok..) it looks if you have an examples portion
It proceeds to extract your functions and the result by making a TEST out of it automatically.
By the way, this is called Doctests.
No extra engineering and stacks
Over engineering an app? Can happen to anyone.
But how do you implement something in Elixir WITHOUT using FOR/WHILE? You use recursion.
But recursion is evil, you will fill up your stack!
Sorry, by now most programming languages would have implemented tailcall optimization so this doesn't happen.
If the last call in a function is to itself then it will optimize the stack and you won't have any issues.
But how can you be sure?!
I've passed around a very big data structure and called it recursively 2 000 000 times.. Doing modifications and putting it do some pretty hard work.
It didn't fail nor did it crash my system WHEN written properly.
Elixir can actually make you a better programmer
Yeah, this sounds almost like clickbait. It isn't. If you apply functional programming the right way you will probably have clean code which is a win.
Elixir has some nifty little tricks that will make your code better.
Pattern matchin is one of them.
Will Elixir/Phoenix replace X/Y/Z?
Nah, probably this won't happen due to many factors:
- Universities teaching poor programming languages and habbits.
- Tons of MOOC (masive open online courses) teach different programming languages
- TIOBE index
- Most jobs requiring Java and C#. Big companies pushing their favourite language (Microsoft, Oracle, Google..)
- PHP is still widely used in Web Development
- Ruby & Python Hype ,
- Domains like Cyber Security use Python since there are books and tools written in Python specially for Peneteration Testing. I know because I've learnt Python due to Cyber Security.
- Data Analysts, Data Sciencetitsts and Machine Learning experts tend to use Python (and R) because there are tons of
- 3D world uses certain programming languages, Python is also extremely used
- Raspberry PI has Python as the main IoT implementation language
Whoa Andrei, from the List above you seem to indicate that Python IS the best choice. This is true, I'd advise anyone serious into programming to jump directly with Python since it has the most potential if you want to switch between subdomains. However Elixir has some benefits.
I will tell you what will happen.
Using Elixir in combination with distributed services to create fault tolerant systems will make your company ship products faster,
You will have less optimization issues. Less headaches on managing the whole system. This means that all your programmers can focus on learning the Erlang/Elixir ecosystem by heart. They wil be able to interoperate on many levels. Meaning that you won't need specialized Redis optimizers. Nor specific DevOps engineers to do certain tasks which will be done by the Erlang ecosystem.
Using Elixir for Machine Learning / Artificial Intelligence will speed up development of new discoveries. Even if Elixir doesn't have all the nifty functionality you can connect to Python processes to pass the data that needs to be analysed. Getting it back and developing your cloud system.
Elixir has Nerves! The Nerves project allows you to build a custom Linux image with ONLY erlang and Elixir on it. Speed + Security. This can be used on MANY IoT devices.
But Elixir can't do number crunching that fast!
Well, nothing's keeping you from not using a Port or implementing your the number crunching in C , calling a NIF and using Elixir for everything else.
Some things I wasn't able to find..
There is one thing I wasn't able to find that has the same power as in Tcl.
Something similair to Starkit, Starpacks, Tclkits or Cookits.
What I want is to write my code once, and then transcompile it into an executable and ship it to different operating systems and/or processor types.
Doing this without having to manualy install Erlang on the machine.
Yes, I can and have used distillery.. but it's Windows support is still lacking. Other platforms are in development or non existant. Distillery has a big plus that it can be used to deploy from one server to the final server without having to install all the tools and stacks again.
A simple yet powerful General User Interface. Yes, Tk might be old and looks "ugly" but It does the job for some projects where all you need is a fast UI.
Ok, we can use Phoenix to acheive better UI and UX (user Experience and interaction) but it sometimes complicates the process.
You might say "Elixir/Erlang isn't built for GUI..". I know, it's built for backend server processing. BUT, sometimes you MIGHT want to have a frontend
without going through the HTTP stack.
There are a lot of books to help you get started. Reading the getting started guide will certainly help you out:
I've only barely walked on the surface of the Elixir/Erlang planet. I told you that I've got the perfect elixir for your programming. All you now need to do is study.
Yes, Elixir and Erlang will be the way to the future as one platform to do cloud computing on.
Of course, the cool kids will have to learn 10 different languages and switch 30 different frameworks over the course of 5 years.
There will be a big opportunity for Elixir/Erlang developers to make great applications.
Erlang/Elixir is not a Hype or a trend, it's a the way to a distributed future.
GIVE ME SOMETHING ELSE TO READ:
Highly inspired by https://www.youtube.com/watch?v=lKXe3HUG2l4
You might enjoy these similar articles:
Be the first to comment!
Add a new comment
All comments are moderated and must adhere to the terms of service.