Tuesday, July 17, 2018

Agile is counterintuitive

A good Agile culture for a technology-based company is counterintuitive for most people. 
We were educated to use cost accounting and resource efficiency instead of flow efficiency. We don't know how to collaborate and work in teams. It is also very common to see Engineering as a team to control. As a service provider, instead of as part of the business.


At the organization and team level, at least the following practices are counterintuitive:
  • Increase Focus and reduce the work in progress (WIP).
  • Organize people around the work minimizing the hands offs (require generalists and collaboration), instead of in functional silos (need specialists) with central coordination.
  • Self-organized autonomous cross-functional product teams that require trust, power, and team responsibility, instead of a culture of Command and Control. 
  • The NoEstimates movement to avoid the waste.
  • A continuous flow of small increments (instead of large batches of work).
  • Maximizing the amount of work not done, that a lot of times can be confused with laziness, without keeping in mind that this is an excellent strategy to avoid complexity, reduce waste and reduce the maintenance cost.
  • And related to the previous one, Maximize the outcomes and minimize the outputs.



For reaching the technical excellence, and with the focus in software development, a lot of practices are initially counterintuitive. For example:

  • Test Driven Development (or for some people even automatic testing).
  • Pair programming. This practice is a classic one. Is very easy to measure the cost of two developers. But is very difficult to estimate the cost of a bad design, the reduction of the bus factor, the improvement in the knowledge about the code, the system, or about a technical practice. So if we try to annalize from a cost efficiency perspective in a command and control culture that doesn't understand our profession, is near impossible to understand the real benefits of this practice for the product/ the team/ the business.
  • Continuous integration (the practice) that encourages trunk based development or working in short-lived branches (less than one day). 
  • Continuous Delivery or even Continuous Deployment that requires technical excellence, self-testing code, and proper tooling for recovery in case of failure.
  • Introduce operability, security, quality in the process instead of having specific teams and phases to validate these activities.
  • Optimize for fast recovery (MTTR) instead to increase the mean time between failures (MTBF).


As we can see, in general, Agile is counterintuitive... and this is one of the reasons for the vast amount of fake agile cultures that are doing a lot of harm to a lot of companies.

In summary, agile software development is counterintuitive because it requires a culture of respect for people, collaboration and is incompatible with the classic low trust Command and Control organization. The problem is that be adaptable to changes is no longer optional...
Embrace the change, Embrace the failure, Embrace the uncertainty...

It is not necessary to change. Survival is not mandatory. W. Edwards Deming

Resources and related posts:

Thanks for the feedback and/or for the contributions to:

Sunday, June 24, 2018

Good talks/podcasts (May 2018 II)



These are some interesting talks/podcast that I've seen/heard during this month:

Saturday, June 16, 2018

Pamplona Software Crafters 2018

This post is in Spanish because this conference and all the content was in Spanish.

Otro año más (y van tres), he tenido la gran suerte de poder asistir a la conferencia Pamplona Crafters. Esta conferencia mezcla charlas preestablecidas con open space y este año, muy acertadamente, también han incluido una serie de talleres.

Aunque en todas las conferencias a las que voy, aprendo y disfruto mucho, tengo que confesar, que en estos últimos dos años, la Pamplona Software Crafters es la que más me gusta. Supongo que es la combinación de la gente que vamos, las charlas y la tematica, con que me gusta Pamplona y por supuesto la impecable organización de los amigos de 540.



En cuanto a la conferencia en si, he asistido a las siguientes charlas/talleres:

  • Modelos mentales, complejidad y software (Arturo Herrero) (Video) Esta es una de las charlas que más me gustaron de toda la conferencia. Es un tema que me interesa, puesto que al igual que a Arturo he descubierto que el tema de interesarme por la complejidad y los modelos mentales me permite entender y relacionarme mucho mejor. Arturo ha escrito un muy interesante blogpost al respecto, incluyendo las slides que utilizo: https://arturoherrero.com/mental-models-complexity-and-software/ 
  • One Page Product Design (Jorge Barroso flipper83) Interesante charla sobre las ventajas de compactar, visualizar, gran cantidad de información mediante diagramas, screenshots, diseños en una única página/diagrama de forma que la podamos pegar por las paredaes, poner en alguna zona de paso, y la riqueza de conversaciones e impacto que esto genera… Una imagen vale más que mil palabras, y esa imagen pegada al lado de la máquina de café 
  • Sobreviviendo en producción. Construyendo una cultura de aprendizaje. (eferro) A petición de Modesto San Juan, propuse esta sesión para el Open Space. En ella, hable de como generar una cultura de aprendizaje comenzando a partir de la gestión de las inicidencias y usando como el Blameless Incident Report como medio. Esta aproximación la he usado en TheMotion y ahora en Nextail y la verdad es que ha funcionado muy bien. Tengo pendiente un blog post al respecto.
  • Taller Refactoring, aprendizaje y economía (Luis Artola, Guillermo Galmazor). Disfrute mucho en este taller, puesto que por necesidad temporal no le estoy pudiendo dedicar mucho tiempo al desarrollo, asi que cualquier oportunidad de hacer algo técnico lo disfruto muchisimo. El taller en si pretendia resolver la kata trivia de Jbrains (https://github.com/jbrains/trivia) aplicando Golden Master o Subclasses.  Como siempre con Luis y Guille, el disfrute viene de lo didacticos que son. Me gusto mucho y me quede con varias notas sobre la estrategia Golden Master para cuando tienes código legado cuyo compartamiento sólo puedes observar viendo su salida por consola.
  • El código como una forma de expresión (patxangas) Divertidisima e interesante charla sobre el uso creativo del código como medio de expresión. Muy impactante. Me trajo muchos recuerdos e ideas a la cabeza (Demoscene, videoarte, música experimental, etc). Además del contenido, siempre me encanta como se expresa y trasmite @patxangas sobre los temas más variopintos. Slides: https://slides.com/interzonas/el-cdigo-como-una-forma-de-expresin#/
  • Mide más y sufre menos (Modesto San Juan) Charla introductoria sobre la necesidad de instrumentar nuestro software de forma que dispongamos de información real para tomar decisiones. Quizás se me quedo algo corta, pero por lo que comente con Modesto, yo no era el público objetivo puesto que ya estoy convencido. En cualquier caso es importante que se mande de forma continua este mensaje ya que muchos de los desarrolladores se centran sólo en la parte funcional sin tener en cuenta que eso es sólo una parte de su trabajo.
  • Evolutionary Architecture (María Gómez) Esta charla me gusto mucho en contenido. Complementa desde un punto de vista algo más práctico a las charlas relacionadas de algunos de sus compañeros de ThoughtWorks. La charla se basa en lo descrito en el libro Building Evolutionary Architectures  (http://evolutionaryarchitecture.com/).
  • Cómo no ser un tech lead (Gamarra). Esta sesión de open space se organizó como una charla abierta en la que se comentó algunas ideas sobre cómo incentivar una a tus compañeros a formarse, crecer, etc. Cogi algunas ideas interesantes de lo que estaban haciendo en Tuenti y en Liferay, que espero poder poner en práctica.
  • ¿Arquitectura sin arquitectos? (German Del Zotto) Esta sesión planteo varias decisiones y balances que se tienen que tomar cuando estamos deciendo temas de artquitectura. German los describio como desciones a tomar, no por un arquitecto, sino como un habilidad que deberian poseer cualquier desarrollador. Me quede con ganas de más, pero seguro que puede quedar con German y profundizar en el tema. :)



Como siempre lo que más me ha gustado y lo que más me ha enriquecido han sido las grandes converaciones. Me vienen a la cabeza unas cuantas:

  • Con cataflu durante uno de los desayunos (además es una gran desvirtualizacion). 
  • Con nabaroa durante las cervezas del jueves (otra genial desvirtualización). Además hizó una impresionante lightning talk  acerca de las subidas y bajadas que experimentamos durante nuestra carrera y de cómo las ha gestionado ella.
  • Con Arturo Herrero sobre el mercado para desarrolladores de software en UK y sobre el value investing.
  • Con Helder y Marco Alacot sobre aprender/enseñar a programar, agilidad, y otras hierbas.
  • Con bberrycarmen  después de la sesión de Arturo sobre modelos  mentales. Con luisrovirosa sobre la charla que dio Martin Fowler en Madrid la semana anterior y de cómo “hemos sido engañados” con el tema de la agilidad, puesto que podemos resumirla en XP+DevOps.

Me resulto gracioso que rafaoe y algún que otro “milenial” tuviese curiosidad de cómo desarrollabamos en los 90s. :)
También disfrute de largas e interesantisimas conversaciones con jaceguzigiella, y mucha más gente…

Por supuesto disfrute como un enano con tejones como Saski, Fran Ortiz, amigotes de Alea como Apa, Ruben y Nestor y con muchisima gente más (sharpbitesalfredodev, Toño, jorgeuriarte, alfredocasado, ...)
Me quedé con pena por no haber podido hablar y disfrutar con todos, pero llega un punto en el que es prácticamente imposible.

He estado repasando la lista de asistentes (https://twitter.com/pamplonaswcraft/lists/asistentes-2018) y he estado tentado de pegarla por aquí, puesto que compartir tiempo con todos ellos ha sido un autentico placer...


Bola extra:
Este año no he podido ir con familia, lo que por un lado me da algo de pena, pero que por otro lado me ha permitido aprovechar el viaje de otra forma. Me he organizado para poder ir con Alberto Paz, Modesto San Juan y Jerolba. La verdad que ha sido como tener dos dias más de confencia…  Grandes conversaciones y mucho aprendizaje.

Foto de @benjymontoya (usada con autorización)

Muchas gracias a los organizadores (@wricka69, @pabloalbizu, @gorkma, Mikel Ros) … Sois muy Top!!!

PD: Iré actualizando el post según vaya recopilando recursos.

Saturday, June 02, 2018

Immutable infrastructure (tech pill)

Immutable infrastructure is a pattern to change/evolve processes without modifying the running code, actual configuration, and the base components (library, auxiliary processes, SO configuration, SO packages, etc).  In summary, avoid any manual or automatic configuration change to the running systems.
But if we don't allow changes, how can we evolve our application and service?  Easy, change the whole piece (function, container, machine) in one shot...



So to make any kind of change (code, configuration, SO) we don't connect to the target box to execute commands, we "cook" a new artifact (container image or machine image) and use it to create a new instance (container or machine) with the changes. In the past, the cost/time to create a new instance was huge, so in order to optimize the process, we tend to execute the minimal change needed to run the new version. I mean, use a manual or automatic process to ssh to the box, install the needed packages, change the configuration, update the code, etc.

But...
¿What happens when the ssh dies in the middle of an update?
¿And if we have a problem installing a package?
¿How can we be sure about the actual state of a machine?
¿How can we calculate the changes to execute if we are not sure about the actual state of a machine?

Making changes in a machine using ssh, is not a transactional operation so we can have a failure in the middle of the process.

The solution, Immutable Infrastructure...
Create a new artifact and run it. Without intermediate states. Only "Not Ready" or "Ready". Simple.  And if something is wrong, destroy the artifact and try again.

This pattern is at the core of the principals container-orchestration systems and PaaS (kubernetes, swarm, mesos, heroku, open shift, Deis, etc).

Why is a good idea

  • Simplicity. Is an order of magnitude easier to destroy a resource and create a new one from scratch than to calculate the deltas to apply and execute them. 
  • If we need scalability we need to support this patter anyway.
  • Right now is easy to implement with the help of the different clouds and PaaS providers.
  • Very easy to return to the previous version.
  • Very easy to troubleshoot a problem, because there are no intermediate states. You can know the exact content of a running version (the SO state, the concrete conf, the concrete code, etc).
  • With this approach, there is no difference between languages and running environment (python, jruby, java, all the same...).  Is a general solution for all the technology your systems requires.

What are the downsides

  • In some cases, the bootstrapping/setup time to use a new machine is larger than modifying an existing one. But the time is improving continuously and if we have a scalable architecture we already are dealing with it. Another solution is to use the patter at a different level, for example, functions or containers instead of at the machine level.
  • This pattern requires more and longer steps that the classic approach so it is not practical to do it without automation. But not automatize this kind of task is shooting in your foot anyway.

Implementation Samples

As a general implementation strategy we need to be capable to make the following steps:
  1. Start a new running process (without processing workload).
  2. Detect when this running process is ready to accept real workload.
  3. Connect the running process to start processing workload.
  4. Disconnect the old running process to stop receiving new workload.
  5. The old running process completes the workload that already has.
  6. Detect that all the pending workload of the old process is completed.
  7. Destroy the old process.


If we talk about web servers the steps can be:
  1. Start a new machine/container running the web server in an internal endpoint.
  2. Detect when the web server is ready using the health check endpoint.
  3. Connect the new web server internal endpoint to the load balancer with the external endpoint.
  4. Inform the old web server to stop processing new traffic and disconnect from the load balancer.
  5. Detect when the old web server finished.
  6. Destroy the old web server.
If we talk about a background queue job processor the workflow can be:
  1. Start a new machine/container running the background queue job processor.
  2. Detect that the new machine is processing jobs from the queue.
  3. Inform the old background queue job processor to not get new jobs.
  4. Detect when the old background queue job processor has completed its pending work.
  5. Destroy the old background queue job processor.
We can think similar steps for other kinds of processes.

Design Notes

As we can see, this pattern requires collaboration from our code and support from the platform, but I assume that this is part of designing scalable systems that make great use of the capabilities of the cloud. For a good reference about designing applications for the cloud, please read The 12 Factor Apps

We can apply the same pattern at different levels. Virtual machines, Containers, Functions... The ideas are the same but the granularity is different.

Using Infrastructure as Code is recommended prerequisite to implement this pattern.

Conclusions

  • The platforms are going in this direction so they have a lot of help to implement it.
  • This is the fundamental pattern for:
    • Scale up and down in the cloud.
    • Advance patterns for deploy with zero downtime (blue-green deploy, rolling deploy, canary releasing, etc).

Other tech pills:


Saturday, May 26, 2018

Infrastructure as code IaC (tech pill)

Infrastructure as code (IaC) is the practice of defining/declaring the infrastructure we need for a system using some kind of machine-readable source files. These source files are used by a tool to provision, create or maintain in a defined state our infrastructure.

These definitions help to provision/create a different kind of resources, compute, storage, communication services, network



For cloud-based infrastructures, we can use these definitions to create "virtual resources" and to configure them to be in a certain state. For example, we can create a virtual machine with an initial  OS image and later install some software and configure it.

In a bare-metal environment, we can use the definition to configure a fixed number of machines and devices already defined in an inventory.

The goals of this practice are:

  • Avoid server configuration drifting
  • Avoid proliferation of Snow flake Servers.
  • Reduce drastically the maintenance cost and the total cost of ownership.
  • Allow easy and infrastructure evolution.

As a collateral effect, this practice also allows:
  • Use development practices for the infrastructure (version control, testing, audit, collaboration, live documentation...).
  • Create on-demand systems for development, QA, testing, and experimentation.
  • Developers collaboration.

Cons:  really, it's 2018... no, seriously I don't find a good reason to not to create infrastructure as code. And when the problem is that these resources are difficult or impossible to define using code or some kind of definition, we should avoid them as much as possible.

General Approaches and styles


  • Push. We execute a tool that parses the definitions, calculate the changes to do and execute them.
  • Pull. Each node/device have its definition and execute all the time in a loop executing the needed changes.
  • Push + Pull. A combination of the previous ones, so we can push a change (when we need to be sure or force some changes) or wait until each node/device update its configuration 
Sometimes we can restrict the IaC to provision the low-level infrastructure. For example, we can use this practice to create a PaaS (using Kubernetes, or similar), so the rest of elements are dynamically provision inside the PaaS we have created.

Related Tools:


In summary, IaC is a core DevOps practice and is the base for a lot of the innovations and evolution that the cloud brings us. It is a must for modern development in the cloud and also very recommendable for on-premise deployments.



Other tech pills: