About software engineering

Standard

This blog post by Rob Pike, one of the fathers of the Go programming language, made me think in the shower so I wrote this list of things about building software:

  • as a software engineer you want to add value to your company building software solutions
  • software economy: you need to be agile to reduce time to market
  • devops is the culture where you build your solution AND ship it to production
  • also you are in charge of its maintenance - both infrastructure and code
  • since company requirements change fast, your code base must change to, and sometimes your infrastructure must too.
  • to adapt to these changes rapidly, you need to deliver those changes as fast as you can
  • if you want to be agile delivering those changes you need to automate as much as possible
  • Infrastructure-as-a-service providers (aka "The Cloud") automate building virtual infrastructure so use them
  • infrastructure-as-code tools automates defining the virtual infrastructure declaratively so use them
  • one of the best ways to improve and change the code is the red-green-refactor testing technique, therefore write good tests
  • Continuous Integration tools help you automating those tests
  • since you will probably work in a team, you want your solution to be as simplest as possible so it's understandable by the rest of the team
  • also the simpler the program, the easier is to test, refactor and change it.
  • making simple software solutions is hard, require years of practice and good tools
  • choosing the right programming language to build simple yet powerful tested software is key for success

I <3 Go

Some notes on Go error handling, FP and railway programming

Standard

These last months I've had the chance to implement some new microservices with the Social Point backend team. We have taken advantadge of some Go functional programming features to be more expressive when modeling our domain and be able to apply some techniques to make the code base simpler to understand, like implementing middlewares to decouple the domain logic from logging or tracing.

On the other hand, last year I attended Software Craftmanship BCN '16 conf and one of the talks I liked most was named Railway programming: all aboard! by Ignasi Marimon-Clos (thank you @ignasi35!) which explained how to use certain features found in some functional languages to avoid repeating error handling code bits all over your code base.

So with that in mind I tried to dive a little bit more in those concepts and I wrote some notes and references in this hackmd document to gather together techniques to apply this kind of approach when programming in Go.

I hope you find them interesting.

About IT learning & GolangUK '16

Standard

I'm addicted to learning about software engineering and IT. The last couple of years i've been focusing in topics like concurrent languages, distributed systems, cloud infrastructure, the web and mobile. If I stay some time without learning something new i feel unproductive. I think that's not very healthy but well here we are ¯\_(ツ)_/¯

My primary sources are twitter and HackerNews, which are social aggregators of information. I haven't found anything better. I try to follow the sources of knowledge and deactivate almost all retweets.

I also love tech talks. I watch most of them in YouTube: learn from the masters from home. Blowmind. I listen to some podcasts but not consistently. Basta ya de picar and We.Developers are my favourites in spanish. And i don't know why but i've tried some online courses platforms but i never finish any course. I guess i'm not very good at doing something consistently in my spare time.

Sometimes I like to attend in person to tech talks because later I can interact with the speaker and the attendees, which can give me different insights, even off-topic ones: I'm very interested in learning things from people who has a similar job in life related with time management, family, traveling, sports, hobbies, side projects etc. I also think that's why lately I'm very interested in remote work and the digital nomad movement.

So i try to go to local tech meetups and conferences. Lately I've been involved with the Golang Barcelona meetup guys and helped making a couple of events at my company offices and i've enjoyed it a lot. Even I made a couple of talks, which has been a great experience.

About conferences, I've had the chance (thanks Social Point & Trovit!) to attend to several international ones in the last years, mainly related with Erlang, Golang and the Symfony PHP framework. I also have attended the Craft Conf a couple of times and it's been the best experience by a BIG margin. One can always learn, but I've arrived to the conclusion that once you reach a certain seniority impact of the things that you can learn in certain conferences is limited if you are into that topic in your day job. By contrast, there are some confs that are more general and inspirational where I feel that I'm really learning a lot and that gives me inspiration and motivation to keep on improving. The CraftConf is one of them for sure. If you have more recommendations please share them with me!

Last week i attended to the Golang UK in London. I've been programming Go full time for almost the last two years, so it made sense to attend to a big Go conf, and since the GopherCon (Denver, US) is a little far from Barcelona I decided that going to the Golang UK was a good pick.

The overall experience has been really good: the colleagues I went with are amazing (Alberto, Ferran, Hernán & Sergio <3), London is one of the most interesting cities in the world and the thing that made it so great is that the first day we attended the Ultimate Go workshop done by Bill Kennedy. He's an outstanding speaker with a broad experience, kept everyone engaged with his presentation style and gave us tons of insights and advices related to computer architecture, data-driven programming, interface design, Go programming and tons of other things. In the first hour of the workshop i felt that going to London was worth the cost. We also took a lot of notes collaboratively with hackmd.io, a very powerful online editing tool based in markdown and web formats that i discovered recently and i'm using a lot. You can find our notes in the the workshop hackmd. Hope you enjoy them.

After the workshop, the following two days were the conference days. The organisation, food and venue were great. About the talks given, a few I really liked, some of them were OK and the rest they not were that much interesting being realistic. I think it's because 30 minutes was too short time for exposing a topic properly without being too general, and also there was no Q&A. But well, I also could attend more talks thanks to this format so in the end I'm not sure whether I really liked it or not. We also tooks tons of notes, you can find them in the conference hackmd.

the crew
crew

An Erlang journey, from start to... finish?

Standard

It's been more than a year since I wrote the last Erlang lines that went to production in a Social Point project and I thought that it would be cool to share the experience, so here it is. Also please keep in mind that this is my humble opinion, not from my employer.

First, we started with Erlang because we needed a high-concurrent platform to build a chat and some other real-time features for our games. Like many, did our research and found and studied ejabberd, but we found it too complex for our needs and decided to build it by ourselves from scratch.

So we went for it and invested a lot of time learning the things that surround the amazing world of distributed systems, concurrency and Erlang and OTP (the Open Telecom Platform): the behaviours, the BEAM VM, fault tolerance and the let it crash philosophy, functional programming, recursion, pattern matching, the concurrent programming model, the Actor Model VS the CSP model, the supervision tree, the benefits of message passing and immutability, distributed systems theory topics (high availability, replication, eventual consistency, CRDTs, consistent hashing rings, distributed hash tables, distributed process registers...), clustering BEAM VMs and epmd, benchmarking, OS tunning, compile/release/deploy strategies, dependency managers, remote debugging, learn and use amazing libraries (cowboy, ranch, riak core...), read some books and articles, went to a couple of Erlang User Conferences, did an in-house workshop with Loïc Hoguin...

Screenshot 2016-05-16 16.28.21

Lots and lots of really interesting and useful things there.

And the services we built worked rock-solid, no question.

But we found that to reach a good development speed and time-to-deploy a lot work had to be done, maybe too much. We found ourselves like we had hit a wall somehow. And we felt that it was not easy to introduce Erlang in other backend projects, there was too much friction. We couldn't engage the development team neither the systems team. We were fighting too much. And now I think it's somewhat related to the next tweet I posted the other day from the distributed framework Microsoft has built:

Are you a distributed systems expert? Maybe, but I know certainly I'm not.

Sometimes it felt that one had to be almost an expert (maybe not a distributed systems one, but an expert nevertheless) to succeed in Erlang development. We wanted our whole development team to participate in this journey, but found that the developer experience wasn't very good, the documentation looked somewhat old, the syntax wasn't familiar, the open source ecosystem and libraries are very small, almost no one knows how to put a serious Erlang project in production, we couldn't find developers in Spain.... It was like we had a very powerful tool but that's very difficult to master. Remember the concepts I wrote in the second paragraph? Certainly they are not something that your learn in a week or a month.

So we tried, succeeded in some aspects, failed in others, and moved on.

As I said, learning Erlang brought a lot of knowledge and experiences about concurrency and distributed systems and many other things. We knew we wanted to move from some parts of our software from a stateless, request/response based, monocore model in PHP to a stateful multicore model and bring those big performance improvements we saw in some projects. We knew we wanted to implement new services with soft real-time capabilities because in game development this paradigm is key in making awesome game experiences.

And this is were Golang matched and now is succeeding in our company, because it was designed to be rapid: rapid to learn (the language syntax is super simple), rapid to develop (amazing standard library), rapid to build and deploy (compile times, no VM, just package and copy), rapid to execute (the performance is stunning) and rapid evolution (vibrant ecosystem, new release every 6 months).

We have been writing Golang code for almost a year and we are very happy about our development speed. We know it's not Erlang, the great platform which has been battle-tested for 30 years in production by some of the biggest telecoms, we don't have OTP and distribution and fault-tolerance for free so we have to do it ourselves if we want those features... but this is fine. Like everything, all decisions have trade-offs and we have decided to change, and in our experience, for the better.

Going back to Erlang, it seems that lately (i mean the last few years, since Erlang is from 1986!) Ericsson has taken more seriously some of these DX issues. They moved the code to GitHub and are more open to user's feedback, releases are faster and bring many goodies (maps, several performance improvements in many areas, new FSM behaviour)... Looks like exciting times are comming for the Erlang community. Maybe it's because the Elixir project, a Ruby-inspired language that compiles to the BEAM VM, is getting some traction lately and I think is trying in some ways to fix some of these Erlang developer experience issues. Or maybe not, anyway we all are lucky that it's happening. I haven't studied it deeply but it looks promising and its documentation looks very good. And the latest ElixirConfEU '16 videos look very interesting.

Finally I hope some day I can hack again in Erlang in my work time, because it's been an amazing experience and I think we are far better software engineers thanks to diving in it.

What i learnt today #1

Standard

I don't blog much, that's why i decided to do some microblogging series about things i learn from day to day. Hope someone likes it, anyway so i do ;-P

So i aliased today='vi ~/md/today/$(date "+%Y-%m-%d").md' from this tweet so i can take quick notes over the day quickly and easily with vim.

I also red about Project Orleans from Microsoft, which is more or less Erlang/OTP written in C# under the .NET framework umbrella with a better DX (Developer Experience). It started as a Azure cloud-based backend for the game Halo. Somewhat related i remembered one of the best talks i attented to at last year's Craft Conf from Caitie McCaffrey explaining the Saga Pattern and how they applied it in Halo. More info in this InfoQ article.

I still enjoy 3D FPS, i don't play anymore and i hope i don't play again (too addictive) but i enjoy watching videos from time to time, mostly Q3A 1vs1. I also whatch them in one of the Social Point's gym bicycles which is great because the time somewhat pass faster. I particularly have enjoyed The Story of Overwatch video series, which has great inside about how important is gameplay in shooters and how they have been inspired by the classics, and this latest DOOM video at 1080p from the NVidia guys.

Also i red somewhere that chapters 20 and 21 from the Google SRE book are a must if do microservices so i will take a look there. Now i'm in 4th chapter so i'll jump straight to there this weekend.

Finally there are some enthusiasts of the Rust language like Alberto Fernández and Guillem Nieto at Social Point backend team. Talking with Marcos Quesada i arrived at the conclusion that ideally we should learn all languages with concurrency primitives and pick the best one for the tool since all of them have its prons and cons. The Learn X in Y tutorials are great for having a bird-eye view if you are an experienced programmer. So far i think i can say i know Erlang and Golang, so others in my list are, in my order of preference: Elixir (since like Erlang compiles to the BEAM VM but looks like Ruby), Rust (i find its syntax ugly but being free of memory bugs at compile time seems amazing), Clojure (since i hadn't had the chance to learn LISP at the university), Java/Scala+Akka (JavaVM is everywhere and the ecosystem is huge), Pony (why not?) and Haskell (this is the last one because i don't know anything about Category theory). Oh, and this is why i didn't choose Stackless Python in the list nor NodeJS.

How to make Canon Selphy CP900 photography printer work in OSX El Capitan

Standard

Since Canon does not provide CP900 drivers for latest OSX versions (shame on you Canon!) maybe these steps will help you:

  • Start the printer and connect it to your Mac via USB interface (yes, does not work with Wifi). Check out that the printer screen shows a computer connected to a printer.
  • Download the Gunterprint free software drivers for OSX from here.
  • Unpackage and install the drivers.
  • Go to Printers & Scanners in the control panel.
  • Add a new printer.
  • A Canon CP900 printer will appear with USB Kind value. Wait a little, a new one will appear with Kind guttenprint52+usb (52 because i downloaded drivers version 5.2). Click on the latter, and then click on the Use selector, and then choose the Canon SELPHY Cp900 - CUPS+Gutenprint Simplified. For some obscure reason just the Simplified driver worked for me. Now click on Add.
  • Try to print and voilà! Bear in mind that this printer sheets are 15x10 so change it accordingly in the print configuration dialog.

Ubuntu upgrade and apache 2.4 virtualhost configuration

Standard

I decided to upgrade my old Digital Ocean droplet to Ubuntu 15.10 which brings apache 2.4. Since i have this WordPress blog hosted in that server i had to change some things to make it work:

    • Change the Directory directives with Order allow,deny and Allow from all to Require all granted
    • Prepend the positive conditions with a '+' in the Options lines that had also negative conditions.
    • The sites-enabled symlinks now need the .conf extension as the sites-available configuration files do, so i had to rename them.

Source: Digital Ocean

Technological procrastionation, chapters zero and one

Standard

Chapter zero

Procrastination is the art of [...] putting off or delaying, especially something requiring immediate attention, and i think i'm quite a good artist in that, specifically in the tech side. I have a Trello list with a board full of project ideas but, except this blog and some minimum stuff at GitHub, i haven't done much. I think it's in part because i'm lazy and in part because i have already my 40h job and i like to enjoy weekend life in a spontaneous way, so if i have to do something i see it as an obligation and i don't like it. On the other hand i think side projects are a big contribution for IT résumés so i should find something that motivates me enough that i don't see it as work.

So during my free time i usually prefer to dive in reading tech literature, most of it from Hacker News (with this style extension to avoid the horrible design) and Reddit (mostly subreddits via RSS/feedly). In the tech side read mostly about programming languages, frameworks, software engineering and programming techniques, databases, compilers, text editors, cloud computing and virtual machines, processors and hardware architectures, operating systems and devops, networking, security, design, UX and any other random stuff that appears in those web pages and i think it's worth checking.

In the long term i think it's not a very good tactic, because i learn about tons of stuff, but since i don't go deep with any of them unless i can do it at work, i'm not particularly good at any of them. But hey, i do all this research as a hobby, i really like it and for now i think it's really OK.

So what i'll try to do is write a "technological procrastination" series of posts about random i thinks i find interesting around so at least i have something to write about :-)

Chapter one

  • WordPress >= 4.1 has a distraction free writing mode for posts.
  • “What happens when you type Google.com into your browser and press enter?” is an old question that was asked to interviewees in Google's interview processes. Someone has opened a GitHub repo where anyone can contribute to answer this question in depth, and there are many pull requests ready to merge.
  • What blocks Ruby, Python to get Javascript V8 speed? is an interesting question posted in Stack Overflow, which led me to learn about Lars Bak, who now works at Google's V8 team but has worked, among others, as the programming leader of the current Java VM. Also one of the comments references the GIL or Global Interpreter Lock which is how CPython (the "normal" Python interpreter written in C, more about Python's GIL here and here) and RubyMRI/CRuby deal with concurrency in multiprocessor machines in a simple but not in the most very efficient way in some cases, e.g. works really good in I/O-bounded tasks but not in CPU-bounded ones.