Meet Sergio Monge

Hello everyone ! This is my turn to talk about me at this time. I’m Sergio and I’m CTO at 4Geeks, a role that I really enjoy. I like to help people to make the software of their dreams. using disruptive and top notch technology. Personally I love to talk to people, create empathy with them, talk about different topics but also understand ideas.

I’m from Cartago, which is nearly to the capital. Cartago was the first capital of Costa Rica, there is not much things to do in my province, so I decided to move to San Jose.

I like to read a lot about technology, classical literature and also comic books. Though the read I think I got the capability to understand different realities, different opinions and different points of view, which I applied every day to my work at 4Geeks.

As I did before with other co-workes I will share a little interview I did to myself:

How will you describe yourself?

I see myself as a communicative persone, I like to talk but to listen. I am a very empathic with the ideas or thoughts of people, as long as these opinions do not discriminate against others. I like to keep learning about anything, have my own opinion on different aspects of life is something I try.

What do you do in your free time?

I do not have much free time, but when I have it I definitely read or jus talk to my girlfriend about my day and so. 

Best series you have ever watched?

  1. Breaking Bad
  2. Sons of Anarchy
  3. Seinfeld
  4. Vikings
  5. Bojack Horseman
  6. Rick and Morty
  7. Merlí

Mountain or Beach ?

I like mountain whether but I go too much frequently to the beach. I do triathlon, so almost every month I go to the cost.

Do you do sports (adventure, extreme, endurance) ?

Of course, this is something I can really talk some time. I do triathlon and I’s something that I’m really passionate about. Actually I’m preparing myself for the next IronMan 70.3 Costa Rica . So my time is dived between 4Geeks and training for the competition. It’s amazing.

Which type of music do you like?

I always enjoy metal, but I will say that I’m really open to any kind of music from Jazz to HipHop, for example. What I’m sure about is that Megadeth, Tool, A Perfect Circle and Pink Floyd are my top 4 bands of all the time.

What are your top 5 books of all the time ?

  1. Crime and Punishment by Dostoyevski
  2. Watchmen by Allan Moore and Dave Gibbons
  3. In Cold Blood by Truman Capote
  4. For Whom the Bell Tolls by Ernest Hemingway
  5. The Sandman by Neil Gaiman

What are your top 5 movies of all the time ?

  1. Pulp Fiction (1994) by Tarantino
  2. A Clockwork Orange (1968) by Kubrick
  3. The lord of the rings triloghy (2001 – 2003) by 
  4. Birdman (2014) by Iñarritu
  5. Inglorious Bastards (2009) by Tarantino

What is the most excited part of being CTO ?

The way I can help clients but also teams. I involved on both sides I like to understand client ideas and needs and convert them into real products, 4Geeks brand products. I like how I can motivate teams to improve every day motivates me, I like to see people doing what they really love.

What is the most challenging situation you had faced in your current position ?

Learn, learn and learn. Technology never sleeps and I need/enjoy reading, learning and researching new ways to code, delivery, manage and lead.

Which is the best part of being part of 4Geeks team ?

The PEOPLE, We are talented bunch of people, the team are very emphatic with the different ideas and opinions and integral, we love to read, do exercise, talk about modern worlds, history.

I also love the different internal projects We do, like 4Geeks Capsules (15-20 min talking about any tech topic) our Book Club, our 4Geeks Wellness Challenges, and relaxing with Yoga sessions.

Yoga Sessions ( We were starting )

What are your goals for this year?

At 4Geeks my goals are share more and more content to return some of my knowledge to the community. I want to deliver education to people at socio-economic risk if you want to help, I’m here !

I’ll be participating on different congress around the US this year, so I hope to find more and more people to learn from, and apply knowledge gain to our client’s products.

Personally, my goal is to classify to IRONMAN 70.3 World Championship in South Africa, but It’s a hard task to accomplish, nevertheless I’m training for hard for that.

Well, that’s it for today. As you know I’m here to help everyone as possible, whenever you need guidance on how to start making ideas into reality though technology 4Geeks team is up and ready, just reach out to us at hello@4geeks.io.

Why to build a MVP for your startup?

Startup founders are coming crazy over-thinking a solution and the look and feel. Some of them are spending a lot of time and money thinking in what great, and getting a wrong way.

The correct way is always where the client is. MVP is Minimum Viable Product and it’s exactly that. The main core to solve an specific problem. Look at the following graphic to get to know what a MVP is and what it’s not. Then, I will describe every single point below.

 

MVP is built to learn and apply customer feedback. Since it refers to a new idea, the startup owner should acknowledge and accept the fact that a possible user reaction is unknown and probably negative. So, It’s essential to get user feedback and see if the startup has a potential. I think this is an intelligent starting point.

To clarify a little more how to identify what MVP is, I’m going to describe you the difference based on my own experience building digital products.

MVP is…

  • Supposed to solve a real problem: Focus on solve a real problem, with zero budget. This is the most realistic and challenge way to operate.
  • Built to learn user feedback: This is why smart founders are building MVP, because they want to learn what users think about their solution, who is more able to test your idea that clients.
  • More minimal than you think:  Don’t build any strong product at this stage. MVP is a very very minimal solution. Most cases, is nothing about technology, apps or something like that.

MVP is not…

  • About getting profit: Focus on learn as much as you can, then use that information to build very very strong profitable product in a second or third stage.
  • Designed to impress users: Get users feedback instead of impress them.
  • Supposed to see it as end product: Remember, the first goal is to get user feedback quickly and change over time.
  • Carved in stone: MVP is made to easy pivot, with no frustration.

 

There is not final decision about what MVP is, but the only real import thing is to keep things easy. If you want to learn more about this, I suggest to read Lean Startup by Eric Ries. There you can learn the basic to found a healthy startup from a early stage.

If we can help you to build your MVP write us an email. Our multidisciplinary team (developers, designers, digital consultants, and entrepreneurs) has a lot of experience building strong product from a basic MVP. Millions of people are using products designed and built by 4Geeks.

Source: anadea.info

Meet Meli Arce

She is our QA team lead, always keeping our client’s products bug free. Communication is pivotal for her, making her an excellent communicator and direct in the message she wants to give. She has great communication skills; personally I and other teammates always ask her about how to improve our English in order to learn new vocabulary and correct pronunciation. She enjoys helping us.

Since day 1, Meli has improved different processes and has built a solid relationship with our client. She is very empathetic; she understands our client’s needs and always try to put herself in other people’s shoes.

She is from Desamparados, located in the southern part of San Jose. Meli is a cat lover; she has three cats: Yodais (Yoda’s eyes – very geeky name), Silvia Silvestre, and Monita. Besides that, she enjoys art, especially films … But before I start talking more about her, here you have a little interview with Meli:

How will you describe yourself?

Easy going, detail-oriented, fast learner

What do you do in your free time?

Watch movies, write, and read.

Best series you have ever watched?

Mad Men, Stranger Things, Freaks and Geeks

Mountain or Beach ?

Mountain – I like the weather there.

Do you do sports (adventure, extreme, endurance) ?

Nope.

PD: Currently she is running some days per week, as part of a 4Geeks Wellness challenge. If you talk to her, ask her about this.

Which type of music do you like?

All types except reggeaton. I enjoy 50s and 60s music.

What are your top 5 books of all the time ?

    1. Crimen y Castigo (Crime and Punishment) by Dostoyevski
    2. El Lobo Estepario (Der Steppenwolf) by Hesse
    3. La Insoportable Levedad del Ser by Kundera
    4. Los Demonios (The Possessed) by Dostoyevski
    5. Los Siete Ahorcados by Andreiev

What are your top 5 movies of all the time ?

  1. Jurassic Park (1993) by Spielberg
  2. Rear Window (1954) by Hitchcock
  3. 2001: A Space Odyssey (1968) by Kubrick
  4. Amelie (2001) by JeunetThe
  5. The Witch (2016) by Eggers

What is the most excited part of being QA ?

I really like to put myself in the user’s shoes. Most of the time I feel like a detective 🙂 looking for bugs and contemplating different scenarios.

What is the most challenging situation you had faced in your current project ?

Understanding the roles and their functions inside the app.

Which is the best part of being part of 4Geeks team ?

The team and the learning possibilities (QA Automation).

What are your goals for this year?

Grow as a QA and learn QA Automation.

Meli is really into QA, so whenever you have question or need guidance regarding some QA topic, reach out to us; there is always an open channel at hello@4geeks.io. Our team is ready to build amazing stuff.

Google Cloud vs AWS. Is it one better than the other ?

Cloud computing has increase on its usage in big steps. We are a time where to have a cloud infrastructure reliable, secure and cost-effective is pretty much easy.  At the end of the day we want to see our money well invested.

At 4Geeks we have been used Google, AWS and Azure, but I want to focus on Google and Amazon ( I like them more ). My mission is to show benefits of them and to know how and when to implement them in a project.

UX

This is totally personal, and we can discuss here, but I lost less when using Google Cloud Console, there are limited options here, and trust me, this is good for it. Console of Amazon AWS has lots of stuff which we really don’t need and they only get us lost a little bit. Most of the times we don’t need that quantity of features, and honestly they only get higher the learning curve.

We enjoy to work with cleanest sites where the UI is pretty straight forward and Google does that.

Billing and Pricing

I will like to go first with the free trial, those days where our wallet breaths and we desire to keep it forever, but it won’t, so let’s go ahead and check wich one offers the best free trial, so our team can test and confirm.

Google offers $300 as credit that can be used in the first 12 months when you activate your account, I find this really cool because you can figure out how much your environment will cost. There is also a free forever set up  where you can run an small application and the cost will be $0, cool right ? Well, the instance is not the big thing, for free you can run an instance with 0.2 CPU and 0.6 GB of RAM with 30GB of disk and 5GB of cloud storage.

Amazon on the other corner, doesn’t have credit to be spend, but They have a free trial for 12 months within a specific set up. So basically you can run 750 hours/month of a small 1 CPU/1GB RAM instance with 30GB disk storage, 750 hours/month of a database instance and 5GB of cloud storage (similar to Google), but the trial doesn’t limit to those products, you can check the entire list on the link above, but you can find RDS, Load Balancing, CloudFront under the expense list of free products.

Now, when the the fairy tale ends, We have to pay, but, how much ? which one is expensive ?

So Google is like 32% less expensive than AWS, using the example above. There are other features we may use to our projects like Google App Engine, Google Kubernetes or Amazon Elastic Beanstalk, but for our porpuse with that setups is enough to see that Google is cheaper utilizing the exactly same setup.

I really like Google’s free trial because you can manage your “money” and you can realize quickly how much your setup will be, also, when go live, you will save money utilizing Google for sure.

Security

Google invest on talent about security measures. They create events internal and external to keep sharing security knowledge. Google has in internal audit team that searches for security laws changes around the world, for example, the new compilance GDPR. Personally I give a lot of value to the issue of having specialized teams, that gives value to the company and assures me that the people behind the products are indicated, they show the team to the world.

All communication and data transfer are encrypted by default, when we send data to Google they encrypt the data, and we the data is sent to Data Centers too. Google servers uses string security protocols as TLS to secure communication between Google and Customer device, when we use Google Load Balancer we trigger those communications protocols, also, there is an option to use Google Cloud VPN, which establishes IPSec virtual private networks.Google encrypt all persistent disk are FDE (Full Disk Encryption) that protects data at rest.

Something really cool is that Google brings us some the capability to use third party certifications, bringing value to our systems. We found it really interest un 4Geeks, since we use PCI compliance for our payment gateway.

Google has IAM implementation which creates specific access for users to the entire Google Cloud Platform. This is cool because we can handle satisfactory the access to our infrastructure avoiding any unwanted access.

Amazon VPC is a great tool to handle firewalls, so you can create virtual network and have total control of the access to your infrastructure, this is very useful to increase security to our systems. All transit communications are encrypted over TLS protocol.

Amazon provides also a flexible key managment so you can basically handle keys easily to the different encryption process, but AWS can handle that as well for you. So you have all keys centralized, we don’t tend to lost them anymore.

There is a service similar to Google IAM called AWS IAM if you are thinking which one was the first with the name or the idea, well, it was Amazon. So IAM work the same both platforms, but Amazon go further and provides Multi-Factor authentication, so, besides having restricted access you can ensure the veracity of the logged user.

Finally they do some compliance services such as PCI, ISO, HIPAA and SOC.

Kubernetes Service

Why Do I go with Kubernetes? Well … this is an excellent of container orchestration. We suggest more and more clients every day to use Kubernetes as the container handler. So, our team had to start doing comparison between which platform provides the best environments and pricing for Kubernetes development.

Google is always ahead of Kubernetes updates since the do it natively on all their software, so, they know it well. With GKE(Google Container Engine) you can easily start doing Kubernetes with a smaller learning curve than Amazon EC2 container Service probably It’ll require more ground work.

Serverless

This is a topic that has been growing fast, more and more production environments are migrating to serverless. At 4geeks we have had implemente a couple of projects with serverless approaches.

We moved from create server infrastructure from scratch, which it can take lot of weeks, lot of money, lot of headaches to hace services that creates infrastructure for us like Kubernetes and Puppet. So, it’s simple to deploy an app, but what about if you want to run functions when requested, not taking care of your environment, updates and all the ground work to our a project top and running, well … serverless.

I took it from here. I found that post really interesting. Both of them provides a really stable solution in serverless function. I think that AWS is good because you have more options in languages. The finality of this sever less comparison is to take a better understanding of what serverless, also knows that there is options taking care of it. We will talk about serverless a little bit deeper  in the future, so I invite you to subscribe if you want to know about it.

Summary

All projects works in different ways they need different resources and need different platforms and approaches, that’s why we believe there is no ultimate tool or platform to be used, whenever you need some help of our dedicated DevOps and architecture team you can reach out to us.

We really love all DevOps topics, so I, personally, will present a webinar: Importance of DevOps on a successful projectI will go ahead and discuss why we need to focus on the culture of DevOps and the importance to choose the right toolset for our project. You can always visit the webinar under our site.

Meet the 4Geeks Style

For years software development companies has been doing the same old thing to try fixing modern problems. However, the world has changed, it changes every single day, that’s why we need to upgrade tools, skills and everything.

Today, humanity has enormous ambitions and our mindset must agree with that. If we plan to turn dreams into realities… let’s say spacial discovering, eradicate diseases, improve communication, design better transportation and some others, we need to put all our knowledge in the same picture, with responsibility.

 

I argue you to take the newspaper and read about a lot of issues the humanity has. How we can deal with energy problems? What the next step to reduce the global warming? It’s our responsibility to deliver a better planet.

In this information era we can get answers to practically any question. The next step is to convert these answers into real solutions. If we can dream it, we can do it.

This is the best time to introduce you 4Geeks Style, and how we, a group of young entrepreneurs, can solve big problems to make life easier by using technology.

What exactly is 4Geeks Style? Right talent, right experience, right technology. We are developers, designers, data scientists, and digital consultants. We help throughout the entire product development cycle.

From now, We will share a lot of important content on social media and another channels about ideas, techniques, ways and more to build great solutions to common problems. So, it doesn’t matter if you are technical or business guy, you can get benefits from our coming whitepapers, blog posts, webinars, etc.

I know this post is very abstract and can be confused, but trust me, there are a lot of cured information over the table, and we are so excited to share it with you.

Please share this post to reach more people interested on global problems/solutions. And be sure to subscribe to our newsletter here to get updates and fresh content in your inbox.

Let’s build an intelligent world together – our home for the next 1000 years. Are you with us?

Nearshoring to boost your business

Day by day we enjoy to bring value to our clients projects, who are, almost in 90%, located in our development offices abroad. (Costa Rica and Mexico). But, at the first time we talk to our clients they are hesitating if a nearshore company is the solution for their problems and needs or not, is it better to do offshore ? why not having my own IT department ? how can I trust you ?. Those are some examples of questions We answer to our clients and leads in a daily basis.

Starting from the basics I will like to make a difference between Nearshore and Offshore.

Offshore

It’s to development products but generally overseas, with mostly languages barriers and not compatible time zones. I can think on different countries mostly in Europe and Asia, countries like India, Pakistan, Ukraine and Rusia.

Offshore can represent a considerable reduce on your operational costs, also, considering different tools to find freelance developers in those countries will save you some money. However, there is a gap in time zone, which goes from 6 hrs to 9 hrs difference.

Communication has a key rol on project success, having that time difference can impact badly for your project, by waiting valuable time to get response on some specs, also, you may need to do extra effort creating documentation and adapting Agile methodologies.

Nearshore

You will have your team within a short time zone different (1-2 hrs as much). With that been said, you can start aproaching agile practices, meetings and avoid miscommunications.

You can visit your team really easily, accesible flights and short period of time in an airplane. For example, a flight to India can take 15 hours and it can cost $800 but flying to Costa Rica can take from New York at least 4 hours and it can cost $250.

There’s can be a reduce on cultural and language impact, being at the same continent there are similitudes in cultural aspects, but also, in most of the American continents English has an important roll on education, we can make sure that language won’t be a problem.

We are Nearshore !

Knowing the differences we can see that nearshore teams can be more expensive than having offshore, but you will get more ROI because you will have more control on your team, there is no lacking of hours, waiting emails, responses, the communication becomes agile and understandable.

In 4Geeks we provide different nearshore offices located in Costa Rica and Mexico, providing to our clients competitive pricing and the opportunity to meet our offices and enjoy these countries.

Take a look at this video of Costa Rica. Enjoy !

Chatbots: Are you a human or a bot?

Alan Turing, for more than one a God and from my point of view was the one who triggers this actual concept of machines. It was during 50’s when Turing postulate Turing Test. It was theoretical postulate only and as It’s own concept was lacking of variables we have now, nevertheless, It was one of first human being asking himself if we can determine if a machine is actually behaving as one or most like a human.

It was 1966 and a MIT professor called Joseph Weizenbaum, came up with ELIZAThis bot was able to start a conversation and simulate a Rogerian psychotherapy by most of the cases rephrasing client’s statements.

But everything changed with SmarterChild, why? basically because It changed a little bit the way a bot was perceive. Before, bots was for entertaining only, this bot was able to help you in different ways, like movies or appointments.

The older chatbots just compared patterns and that was everything, they build an answer based on patterns. Now, a bot can analyze data and elaborate an intelligent answer within learning included. This is where it gets interesting …

What is?

All chatbots are powered by NLP (Natural Language Processing), nevertheless, that only allow to us to understand/process inputs, the tricky part is when we answer to those questions, we need real big data.

In other words by it’s own conception, chatbots are useful without a good database where we can process and give an extra value to chatbots. A chatbot without big data is like an app that just show information, it just consumes memory and phone resources without a good unique value.

So, chatbots have use machine learning to process users inputs, this learning can be supervised or unsupervised, everything resumes un patterns which are processed by neuronal networks, which can detect patterns and learn from this. But machine learning is a topic we can go though later.

At the time we tech/feed that chatbot data, more valuable it becomes. Let’s say you have a e-commerce company, with a good chatbot, you can get reports really easily by asking something like:

  • What is my projection in the next 2 years ?
  • What has been my revenue this month ?
  • What is the most buyed item ?
  • Give me the email of our most recurrent buyer.

To answer that question a chatbot will have to go and processed some big data. That’s the importance of a database well fed.

A human is totally able to do what a chatbot is capable to do, at the end of the day, we want to make our lives easier, don’t we? Who wants to perform a search for hours when you can only ask for something.

Future of Marketing

Why?

  • Navigation Assistant
  • Automatic Responses
  • Reactive Communication
  • Recommendations
  • Receive Orders
  • Visit Registration
  • Clients Monitoring
  • Engagement beyond clicks

What are the benefits of chatbots overall

  • Reduction of operating costs and moderation.
  • Increase in response rate
  • Support 24/7
  • Telemarketing savings.
  • Increase in service during peak hours.
  • Automation and simplification of sales
  • Improvement of the customer experience (CX)

Musts

Having a chatbot is a continuous work (like everything in this life), but there is always some rules you have to consider if you want to have a good and realistic chatbot.

It has to sound familiar, like a human been, you can see this approach like easy/difficult, but It’s very important, people have to feel like they are talking with a real person, so, an identity and personality (artificial) for a chatbot is crucial. So, Does it have to be funny, introverted, friendly ? Your choice.

You have to give people reasons to comeback and use your bot again, create a necessity. That’s why it’s important to create a familiar environment.

To continuous improvement on your chatbot you must check logs and look for user needs, and make your chatbot learning faster.

It’s important to create all basics for your bot, it’s like to create a building, you first have to put all the foundations.

Before start a chatbot

  • Objetive

Make a realistic scope of your bot, so, you can have a metrics and check how is your bot going on.

  • Personality

Give to you bot a personality, just like we talked before, It’ll be nice people talk about you bot with specific characteristics and a differentiator from others.

  • Solution

What your bot will solve for your end users. It as to be a key differentiator for your clients.

  • Lifecycle

The most important part. What is the workflow of your bot, what is the beginning and what’s the end.

As you see all those points depend on each other, so It’s important to have all of them well described and decided. Then you are ready to start your bot.

I’m a developer

If you are a developer like me, and you want to start digging into this obscure world, there are some tools that right now does the NLP for you:

  • Cloud Natural Language API — Google
  • Cognitive Services APIs — Microsoft
  • Watson Conversation — IBM

Free for all (for now):

  • API.AI — Google
  • Wit.ai — Facebook

Those tools can help you to create a cool chatbot. At 4Geeks we have used API.AI to play with our Google Home. It’s easy and funny.

So, as you can see there is a list of benefits and and todo-list before start with you chatbot, but, the most important part of this is to have a cool chatbot with excellent data and a well defined goal. I argue you to comment and contribute by adding more and more info.

If you are asking if there is something more and more deep I want to invite you to be in touch, cause later, I will talk about how to create a Neurologic Network with Python to create the basics of a custom bot with self learning.

Where do I start with Go?

If you remember a few weeks ago I was talking a bit about Go, you can watch the video here and I told you about some of Go’s many features.

To start remember that is Go: Go is a lovely little programming language designed by smart people you can trust and continuously improved by a large and growing open-source community.

Go is meant to be simple, but sometimes the conventions can be a little hard to grasp. I’d like to show you how I start all of my Go projects.

Setting up your environment

The first step is, of course, to install Go. You can use the binary distribution for your operating system from the official site. If you use Homebrew on Mac, brew install go works well. When you’re done, this should work:

$ go version

Once installed, the only other thing to do is to set your GOPATH. This is the root directory that will hold all of your Go code and built artifacts. The Go tooling will create 3 subdirectories in your GOPATH: bin, pkg, and src. Some people set it to something like $HOME/go, but I prefer plain $HOME. Make sure it gets exported to your environment. If you use bash, something like this should work:

$ echo 'export GOPATH=$HOME' >> $HOME/.profile

$ source $HOME/.profile

$ go env | grep GOPATH

GOPATH="/Users/kenneth"

If you’re using Windows, don’t forget to add a GOPATH environment variable. With that done, we’re ready to create our first Go application.

In Our first app, we create a file with extension.go in any text editor

$ touch demo.go

Every application in go is commanded by a

package main 

Every Go application is made up of packages and, using a Java reference, programs use the main package as the default.

import (
"fmt"
)

As I mentioned at the start of the tutorial, Go has a rather large standard library. To access that functionality, you need to import the specific packages you need.

Here, I’ve imported one:  fmt. If it seems foreign, it really shouldn’t. In PHP and C you’d use includes (or requires), in Python you’d use imports and in Ruby you’d use require.

func main() {

fmt.Println(“Hello  World”);

}

I’ve called the fmt.Println method, which invokes the fmt package that is the data in and out library.

 

Compiling The Code

Unlike PHP, Ruby, Python etc, Go is a compiled language. So from your project directory, in my case

$ go run demo.go

go run, the only thing it command does is run our file, if we want to compile our demo.go must run go build demo.go

 

Easy, right?

In Conclusion

We’ve created ‘hello world’  in small steps and using only the Go standard library. Our code can be fetched and deployed on nearly any server architecture. The resulting binary is self-contained and fast. And, most importantly, the code is straightforward to read and reason about. It can easily be maintained and extended, as necessary. I believe all of these properties are a function of Go’s steady and philosophic devotion to simplicity.

 

If you’d like more information check out the following:

Books

A selection of books about Go.

 

Tutorials

 

Starting and changing mindset with Elixir

Created in 2012, Elixir is functional and dynamic language, which make a real option if we want to create a web application. Since, Elixir runs under Erlang virtual machine (BEAM), which make it really stable and mature.
Created by José Valim, who is a Ruby on Rails enthusiastic and had helped the community a lot. So, he took the the best of Rails and merge it with the efficiency of Elixir + Erlang.

Elixir is special for high availability systems .

Functional

The first two meanings we have to forget are objects and classes. It’s all about functions that operate and transform data, pure functions. But, We can not rely on Elixir being a pure functional language.

Dynamic

Elixir variables don’t need to be declared as an specifics data type, It checks at runtime.

Inmutable

Data structure won’t change. For example:

# Uses the match operator to give a true on function
name = “Han Solo”

# It creates a total new value for the new variable
name = “Luke Skywalker”

Concurrency

This is something that Elixir can sell without any help, It’s a big feature here. Since, Elixir runs under BEAM, concurrency is much easier. Code running simultaneously, Thanks Erlang !

Reliability

Elixir is a young language, but It runs on Erlang VM, which is pretty old and a reliable system, one of he most around the globe.

Easy to read and write

By taking some Ruby stuff, Elixir decided to go with the syntax, which is good for us. The code is easy to read and o write.

Modules or classes ?

As I mentioned before classes are not considered in Elixir, every function is stored and handled in a modules, as their namespace.
defmodule HelloModule do def say_hi do IO.puts "Hello World !" end end

Structs

This is a map where we set up a set of keys and their default values. It’s defined in the module.
 
defmodule User do
  defstruct name: "John", roles: []
end
 
iex> %User{name: "Han", roles: [:pilot, :shooter]}
User{name: "Steve", roles: [:pilot, :shooter]}

Strings

A string a basically a sequence of bytes, UTF-8 encoded binary. Elixir provides to us a set of functions to interact with our strings.

Lenght.

length/1
It returns the number of bytes in our string.
iex> String.length "Walter White"
12

Replace

replace/3
It returns a new string, It receives three parameters, the string to be changed, the pattern to be replaced and the replacement string.
iex> String.replace("Seed","e","i")"Siid"

Duplicate

duplicate/2
It returns a specific string duplicated the number of times seted
iex> String.duplicat("Hello",3)"Hello Hello Hello "

Split

split/2
Ir returns a list based on the patter of split.
iex> String.split("Hello, I'm Bond, James Bond", ",")["Hello", " I'm Bond", " James Bond"]

Collections

List

A simple collection of values, where there can be any type of data.
 
iex> ["String", 12.3 , :atom]["String", 12.3, :atom]

List Concatenation

++/2
 
iex> ["Luke", "Leia"] ++ ["Han"]
["Luke", "Leia", "Han"]

List Subtraction

–/2
 
iex> ["String", 12.3 , :atom] -- [:atom]
["String", 12.3]

Head / Tail

Heads is the first element of our list and the tail is te remaining elements on the list.
 
iex> hd ["Head", 222, :tail]
"Head"
 
iex> tl ["Head", 222, :tail]
[222, :tail]

Keyword Lists

It’s an associative list composed by two tuples, where the key have to be an atom data type, they are ordered and keys can be given more than once.
 
iex> [foo: "bar", hello: "world"]
[foo: "bar", hello: "world"]
 
iex> list = [{:a, 1}, {:b, 2}]
[a: 1, b: 2]
 
iex> list ++ [{:c, 3}]
[a: 1, b: 2, c: 3]

Maps

Maps are more flexible compare to keyword lists, keys can be any value, included variables and maps keys doesn’t follow any kind of ordering.
 
iex> key = :one

iex> list = %{key => 1, :two => 2, "three" => 3, 4 => 4}
%{:one => 1, :two => 2, "three" => 3, 4 => 4}

# Get an specific value from a given key.
iex> Map.get(list, key)
1

# Add a tuple to the current list.
iex> Map.put(list, :five, 5)
%{:one => 1, :two => 2, "three" => 3, 4 => 4, :five => 5}

# Return the map on list format. 
iex> Map.to_list(list)
[{4, 4}, {:atom, 1}, {:five, 5}, {:two, 2}, {"three", 3}]

Enum

It is a set of algorithms to be used over collections. In this section we will just show some of them. You can check all of them over here.

All

all?/2
We supply a fn(x) where will be run for all items on our collection. Will return true if all invocations returns true, with just one that returns false the entire method will return false.
 
iex> Enum.all?([1,2,3], fn(number) -> number < 5 end )
true
 
iex> Enum.all?([1,2,3], fn(number) -> number < 2 end )
false

Any

any?/2
We supply a fn(x) where will be run for all items on our collection. Will return true if at list one invocation returns true, otherwise will return false.
 
iex> Enum.any?([1,2,3], fn(number) -> number < 2 end )
true
 
iex> Enum.any?([1,2,3], fn(number) -> number == 5 end )
false

Chunk By

chunk_by/2
Specially if we need to group our collections based in a given function.
 
iex> Enum.chunk_by(["one", "two", "three", "four", "five"], fn(x) -> String.length(x) end)
[["one", "two"], ["three"], ["four", "five"]]

Each

each/2
Invokes the given function for each item on the collection. It returns an atom :ok
 
iex> Enum.each(["one", "two", "three"], fn(x) -> IO.puts(x) end)
one
two
three
:ok

Map

map/2
Invokes the given function for each item on the collection. It returns a new collection with new values.
 
iex> Enum.map(["one", "two"], fn(x) -> String.upcase(x) end)
["ONE", "TWO"]

Member

member?/2
Checks if an item exists in a collection.
 
iex>  Enum.member?(["one", "two", "three"], "three")
true

Reject

reject/2
Return a new collection of items that returns false from the given fn(x).
 
iex> Enum.reject([1,2,3,4,5,6], fn(x) -> Integer.is_even(x) end)
[1, 3, 5]

Sort

sort/2
It sorts the collection by the given fn(x).
 
iex> Enum.sort([%{:val => 2}, %{:val => 3}, %{:val => 1}], fn(x, y) -> x[:val] > y[:val] end)
[%{val: 3}, %{val: 2}, %{val: 1}]

Unique By

unique_by/2
Remove all duplicated into our collection
 
iex> Enum.uniq([1, 2, 3, 2, 1]) 
[1, 2, 3]

Pipe Operator

The pipe operator |> passes the result of an expression as the first parameter of another expression.

When I was using elixir by the first time this operator called my attention immediately. Since functional programming is about sending data and transforming it thought functions it can get really messy, but the pipe operator is something to help us on that job.

Our problem:

# Return the final value of a product
formated_price(taxes(commision(product_value(), 0.01), 0.13))

Some OO solution:
prod_val = product_value()
prod_commision = commision(prod_val, 0.01)
prod_taxes = taxes(prod_commision, 0.13)
prod_final_value = formated_price(prod_taxes)
prod_final_value

Our Elixir Solution:

product_value()
|> commision(0.01)
|> taxes(0.13)
|> formated_price()
As you can see every return value of a function is passed as the first parameter of the following function. It makes our code really easy to read.

Pattern Matching. Isn’t it just assignment?

This is a deep functionality in Elixir. To understand this a little bit more I have to say that = operator doesn’t necessarily means “assign something to a variable”, instead it really means “match the left hand side to the right hand side”. It turns the whole expression into a equation.
 
iex> x = 1
1
 
iex> 1 = x
1
 
iex>  2 = x
** (MatchError) no match of right hand side value: 1

Useful approaches

Pattern matching becomes really useful when we use it with tuples, functions or recursion.

# We want to assign to match value with te number 2
iex> {:ok, value} = {:ok, 2}
{:ok, 2}
 
iex> value
2
# If the atom value :ok doesn't match It will return a fail

iex> {:ok, value} = {:none, 2}
** (MatchError) no match of right hand side value: {:none, 2}
It seems really cool, but check this, something more functional

defmodule Greet do
  def say_hi(tuple) do
    case tuple do
      {:morning, name} ->
        "Morning #{name} !"
      {:evening, name} ->
        "Good evening #{name} !"
      _ ->
        "Default Hi !!"
    end
  end
end
 
iex> Greet.say_hi({:morning, "Luke"})
"Morning Luke !"
 
iex> Greet.say_hi({:morning, "Han"})
"Morning Han !"
 
iex> Greet.say_hi({:defaut, "Nobody"})
"Default Hi !!"
Finally, the more useful approach to me is by using Pattern Matching on functions definitions:

defmodule Greet do
  def say_hi(:morning, name) do
    "Morning #{name} !"
  end
  def say_hi(:evening, name) do
    "Good Evening #{name} !"
  end
  def say_hi(name) do
    "Default Hi #{name} !"
  end
end

iex> Greet.say_hi(:morning, "Luke")
"Morning Luke !"
 
iex> Greet.say_hi(:morning, "Han")
"Morning Han !"
 
iex> Greet.say_hi("Leila")
"Default Hi Leila !"

Conclusion

To me, having a Ruby on Rails background, Elixir seems pretty nice and I’m looking forward go deeper and deeper into this language. This entrance is part of an introduction We did in 4geeks, you can check the full video:

Introducing the Geek Hour, 2nd season.

Hey guys! It’s been a while since we start the Geek Hour, today, I’m so happy to announce that, some years later, we releasing our Geek Hour again. We have learned so much during this time, so, we think, it’s the best moment to share all knowledge gain with the community.

The Geek Hour is an online show about technologybusiness and marketing, for free. Our idea is to share and create discussion.

If you want to be part of this release, we invite you to subscribe to the YouTube channel. All sessions will be recorded and published in there.

Since our goal is to create discussions we are happy to receive questions and feedback after each session. It would be great if you attend live to answer your questions.

We are putting together more and more sessions, which will be presented each month.

The first show will be on next Aug 31, 2017, and we will talk about Elixir.

Please, check out the schedule page, and share with your colleagues the next show. See you around!

 

Listen to The 4Geeks Podcast, weekly.Listen Now!