Hace tiempo que pensaba en cambiar de blog. Quería algo que no implicara acceder a la web para escribir y publicar, y quería ser yo el que alojara los posts (y no google).
Hace poco encontré lo que estaba buscando en Github, y ahora podéis seguirme en:
http://blog.plagelao.com
Un saludo y ¡Adios blogger!
sábado, 23 de julio de 2011
domingo, 15 de mayo de 2011
Autotest: friend or foe
For all of you who don't know what autotest is, it's just a ruby gem that lets you run your tests automatically in the background every time you make a change either in your code or in your tests. It is very clever, and a lot of people use it. You can see some examples in almost every screencast of a kata written in ruby.
Why I don't like autotest
Well, it's not that I don't like it. It is a very cool project and I've used it sometimes while performing a kata. My real problem with it is that it breaks the TDD cycle. Let me explain myself.
Running the test should be a blocking step
When we are doing TDD, we run the tests to get feedback. Then, we use that feedback to guide our code/design.
When we use autotest we are not waiting for the tests to fail, we just continue coding, ruining the TDD cycle.
Wait a second, I do not write any code till autotest tells me that there is a failing test.
Well done. Why are you using autotest then?
Update: Talking with Tom Brand the other day, he said that maybe it is ok to use autotest in the refactoring phase. I think he is right :)
Why I don't like autotest
Well, it's not that I don't like it. It is a very cool project and I've used it sometimes while performing a kata. My real problem with it is that it breaks the TDD cycle. Let me explain myself.
Running the test should be a blocking step
When we are doing TDD, we run the tests to get feedback. Then, we use that feedback to guide our code/design.
When we use autotest we are not waiting for the tests to fail, we just continue coding, ruining the TDD cycle.
Wait a second, I do not write any code till autotest tells me that there is a failing test.
Well done. Why are you using autotest then?
Update: Talking with Tom Brand the other day, he said that maybe it is ok to use autotest in the refactoring phase. I think he is right :)
miércoles, 27 de abril de 2011
XGN y Software Craftsmanship
Hace una semana estuve pasándomelo pipa en la #XGN de Santiago de Compostela (Muchas gracias a la organización, que nos trató muy bien y muchas gracias a mis anfitriones de agil-az, que me llevaron a cenar cosas muy ricas). Alfredo Casado y yo dimos un par de charlas técnicas (refactorización y continuous delivery) y una charla sobre Software Craftsmanship.
Si quieres ver la presentación de la charla, aquí la tienes:
Pete McBreen - Software Craftsmanship: The new imperative
Si quieres ver la presentación de la charla, aquí la tienes:
Software Craftsmanship: Convierte tu vida profesional en una Lan Party
No tiene mucho sentido verla sin nosotros, porque casi todo son imágenes, pero podemos resumirla en esta cita de Pete McBreen:View more presentations from plagelao
Software development is meant to be fun, if it isn't, the process is wrong
El desarrollo de software se supone que es divertido, si no lo es, el proceso es incorrecto
Pete McBreen - Software Craftsmanship: The new imperative
lunes, 25 de abril de 2011
5 Things I want to do today!
Two weeks ago I was in Edinburgh. I attended the Scottish Ruby Conference and it was awesome! I met a lot of great people and I enjoyed a lot of great talks. But I want to talk today about one of the lightning talks that I had the pleasure to attend. It was not about code, technology or robots, it was about how to manage your time and how to set your priorities.
The idea
The idea is very simple. Before going to sleep, you have to write down the 5 most important things you want to do tomorrow. Once you've written them down, you have to prioritize them. Then, the next day you have to do the first task in your list. Once you finish the first task, you have to start with the second task. It goes on and on until you finish the 5 tasks or the day ends :P
The reality (My reality)
I've been doing this for two weeks, so I'm not an "expert" :P but I have some conclusions to share.
First of all, I feel much more productive :D "Planning" what to do the next day helps me to focus on the important things and shows me how difficult it is to achieve everything I want to do (pretty obvious. You can't do everything you want in a day :D )
Second, it is not easy to follow your plan :D I always start with my first task, and most of the times I continue with the second one, but, eventually, I get distracted. The thing is, there are a lot of things I want to do, and limiting myself to only five is not easy. Also, some of the tasks on the list are really bored (but still important), so sometimes I just ignore them...
Some other times, I just "forget" the priorities :)
And last, but not least, is not easy to write down the five most important things you have to do the next day.
Anyway, I think that this simple method is helping me a lot, and I recommend all of you to give it a try. Even if you are not able to follow "the rules", it is a great exercise.
The idea
The idea is very simple. Before going to sleep, you have to write down the 5 most important things you want to do tomorrow. Once you've written them down, you have to prioritize them. Then, the next day you have to do the first task in your list. Once you finish the first task, you have to start with the second task. It goes on and on until you finish the 5 tasks or the day ends :P
The reality (My reality)
I've been doing this for two weeks, so I'm not an "expert" :P but I have some conclusions to share.
First of all, I feel much more productive :D "Planning" what to do the next day helps me to focus on the important things and shows me how difficult it is to achieve everything I want to do (pretty obvious. You can't do everything you want in a day :D )
Second, it is not easy to follow your plan :D I always start with my first task, and most of the times I continue with the second one, but, eventually, I get distracted. The thing is, there are a lot of things I want to do, and limiting myself to only five is not easy. Also, some of the tasks on the list are really bored (but still important), so sometimes I just ignore them...
Some other times, I just "forget" the priorities :)
And last, but not least, is not easy to write down the five most important things you have to do the next day.
Anyway, I think that this simple method is helping me a lot, and I recommend all of you to give it a try. Even if you are not able to follow "the rules", it is a great exercise.
martes, 12 de abril de 2011
BDD y Continuous Delivery en la XGN
Este fin de semana estaré en la XGN de Santiago de Compostela y voy a intentar picaros un poco para que os animéis a venir. Como ya os conté, tengo tres sesiones junto con Alfredo Casado, pero hoy os voy a hablar de Teo crea su primera aplicación web (con Rails, Git y Heroku). La idea para esta sesión es hacer un taller en el que crearemos una aplicación web en Heroku utilizando Rails. Sin embargo, para hacerlo un poco más interesante, lo vamos a hacer al estilo Software Craftsmanship, lo vamos a hacer usando BDD y Continuous Delivery. ¿Os hace?
Continuous Delivery
Vamos a aprovechar lo fácil que nos pone las cosas Heroku para practicar (y entender) un poco eso de Continuous Delivery. Veremos lo que mola desplegar con cada commit y el nos daremos cuenta del cuidado que hay que tener cuando desarrollamos software (y no solo mientras escribimos el código).
BDD
Dado que vamos a desplegar la aplicación en el entorno de producción prácticamente con cada commit, necesitamos definir exactamente cada feature que vamos a desplegar. Para ello utilizaremos BDD (Utilizaremos Cucumber) de forma que cada vez que todas nuestras features ejecutables estén verdes podamos desplegar la aplicación sin ningún temor :D
Una pequeña cuña aquí. Nos vamos a dar cuenta de la importancia que tiene definir buenas historias de usuario de forma que nos sea sencillo crear features pequeñas y deployables. Por eso, os recomiendo el dojo de historias de usuario de los agilismo.es
Entorno
Si os apetece participar en el taller tenéis un par de opciones, podéis traer vuestro ordenador con git y ruby instalado o podéis traer vuestro ordenador con VirtualBox instalado y yo me encargo de daros una máquina virtual con todo instalado (Eso sí, esa máquina será un Linux con Vim como editor, ya os aviso :P).
Si os da tiempo, nos ahorraríamos algo de tiempo si os hacéis una cuenta en Heroku antes de asistir al taller.
Otra opción es que vengáis a cotillear, que también vale, pero es un poco más aburrido.
Ya sabéis, si quereis darle caña al continuous delivery no os podéis perder esta sesión. ¡Os espero!
PS: Por cierto, la aplicación que vamos a crear nos va a servir para sortear un par de Apprenticeship Patterns en la sesión sobre Software Craftsmanship, así que no podemos fallar :P
ACTUALIZACIÓN: Os cuento un poco las versiones de ruby y de las gemas que vamos a utilizar:
La versión de ruby será la 1.8.7
La versión de Rails será la 3.0.3.
Necesitamos también la gema de heroku, claro.
Después usaremos cucumber-rails y capybara. También le daremos al haml (haml-rails es la gema) y al Sass :D
Continuous Delivery
Vamos a aprovechar lo fácil que nos pone las cosas Heroku para practicar (y entender) un poco eso de Continuous Delivery. Veremos lo que mola desplegar con cada commit y el nos daremos cuenta del cuidado que hay que tener cuando desarrollamos software (y no solo mientras escribimos el código).
BDD
Dado que vamos a desplegar la aplicación en el entorno de producción prácticamente con cada commit, necesitamos definir exactamente cada feature que vamos a desplegar. Para ello utilizaremos BDD (Utilizaremos Cucumber) de forma que cada vez que todas nuestras features ejecutables estén verdes podamos desplegar la aplicación sin ningún temor :D
Una pequeña cuña aquí. Nos vamos a dar cuenta de la importancia que tiene definir buenas historias de usuario de forma que nos sea sencillo crear features pequeñas y deployables. Por eso, os recomiendo el dojo de historias de usuario de los agilismo.es
Entorno
Si os apetece participar en el taller tenéis un par de opciones, podéis traer vuestro ordenador con git y ruby instalado o podéis traer vuestro ordenador con VirtualBox instalado y yo me encargo de daros una máquina virtual con todo instalado (Eso sí, esa máquina será un Linux con Vim como editor, ya os aviso :P).
Si os da tiempo, nos ahorraríamos algo de tiempo si os hacéis una cuenta en Heroku antes de asistir al taller.
Otra opción es que vengáis a cotillear, que también vale, pero es un poco más aburrido.
Ya sabéis, si quereis darle caña al continuous delivery no os podéis perder esta sesión. ¡Os espero!
PS: Por cierto, la aplicación que vamos a crear nos va a servir para sortear un par de Apprenticeship Patterns en la sesión sobre Software Craftsmanship, así que no podemos fallar :P
ACTUALIZACIÓN: Os cuento un poco las versiones de ruby y de las gemas que vamos a utilizar:
La versión de ruby será la 1.8.7
La versión de Rails será la 3.0.3.
Necesitamos también la gema de heroku, claro.
Después usaremos cucumber-rails y capybara. También le daremos al haml (haml-rails es la gema) y al Sass :D
viernes, 1 de abril de 2011
My Vim configuration. Part 4 - Vim as an IDE
Today I'm going to finish my Vim configuration explanation (Have a look at the previous articles). The final part of my configuration is related to the "IDE behaviour" in Vim.
Encoding
First of all, I have set my encoding to utf-8 with:
Indentation
I prefer spaces to tabs, so this is how I configure it in Vim.
Line numbers
If you want to see the line numbers in Vim you only need to do:
Backspace
Default backspace behaves in a strange way :P I've changed it so it behaves in a more "normal" way:
Search
One of the most important features in Vim is searching. I've configured mine so it is case insensitive (except if what I search has an uppercase character, then it is case sensitive)
I also want Vim to highlight my search terms:
And I have a shortcut to remove the highlighting:
There are some more little things that can help you in making a more "personal" Vim, but I'm going to stop here :) Feel free to have a look to my vimrc file or, you know, google it :P
Thanks for reading :)
Encoding
First of all, I have set my encoding to utf-8 with:
set encoding=utf-8
Indentation
I prefer spaces to tabs, so this is how I configure it in Vim.
filetype indent on set tabstop=2 set softtabstop=2 set smarttab set expandtab set autoindent
Line numbers
If you want to see the line numbers in Vim you only need to do:
set number
Backspace
Default backspace behaves in a strange way :P I've changed it so it behaves in a more "normal" way:
set backspace=indent,eol,start
Search
One of the most important features in Vim is searching. I've configured mine so it is case insensitive (except if what I search has an uppercase character, then it is case sensitive)
set ignorecase set smartcase
I also want Vim to highlight my search terms:
set incsearch set hlsearch
And I have a shortcut to remove the highlighting:
nnoremap <leader><space> :noh<cr>
There are some more little things that can help you in making a more "personal" Vim, but I'm going to stop here :) Feel free to have a look to my vimrc file or, you know, google it :P
Thanks for reading :)
martes, 22 de marzo de 2011
XGN en Santiago de Compostela
Los próximos 15, 16 y 17 de Abril estaré en la XGN presentando algunas charlas junto a Alfredo Casado. La verdad es que tengo muchas ganas de estar por allí con todos los demás participantes (la gente de axilmente, las agile girls, los agilismo.es, los funius, los 1up talent, etc). Vamos a aprender mogollón y nos lo vamos a pasar piruleta :)
He podido cotillear algunas de las charlas propuestas por algunos de estos cracks y son realmente alucinantes :) Nosotros intentaremos mantener el nivel, que no va a ser fácil. Para ello, estamos preparando:
Además, si todo lo que os he contado no os termina de convencer, se está organizando un openspace para el sábado en el que seguiremos hablando de desarrollo, agilismo, etc.
Si no tenéis reservada la fecha, reservadla ya. En serio, nos lo vamos a pasar piruleta.
PS: Iré publicando por aquí pequeños spoilers de las charlas para ir abriendo boca :P
He podido cotillear algunas de las charlas propuestas por algunos de estos cracks y son realmente alucinantes :) Nosotros intentaremos mantener el nivel, que no va a ser fácil. Para ello, estamos preparando:
- Convierte tu vida profesional en una lan party: software craftsmanship
- Teo crea su primera aplicación web (con Rails, Git y Heroku)
- ¡Si funciona no lo toques!, ¿o sí?
Además, si todo lo que os he contado no os termina de convencer, se está organizando un openspace para el sábado en el que seguiremos hablando de desarrollo, agilismo, etc.
Si no tenéis reservada la fecha, reservadla ya. En serio, nos lo vamos a pasar piruleta.
PS: Iré publicando por aquí pequeños spoilers de las charlas para ir abriendo boca :P
viernes, 11 de marzo de 2011
Elige tu propia aventura
Tras un par de semanas algo turbulentas, hoy ha sido mi último día como edenita.
El tiempo que he formado parte de Eden ha sido espectacular. Estoy muy agradecido a todos y cada uno de mis compañeros por creer en mi y por hacerme crecer tanto en lo personal como en lo profesional :) De verdad, muchas, muchas gracias por haberme brindado esta oportunidad.
Supongo que os preguntaréis qué ha pasado. Tranquilos, no he suspendido durante mi aprendizaje :P De hecho, voy a seguir siendo aprendiz de Aimee (¡yuju!). Simplemente, a veces las cosas no salen como uno espera y entonces es cuando tenemos que abrazar el cambio :D
Ahora empieza otra aventura :D Me voy a quedar en Inglaterra mejorando mi inglés y trabajando como autónomo. Después de mi internship pense en hacerlo en España, pero no terminé de atreverme. Ahora sí que me voy a lanzar :D Todavía no tengo muy claro los pasos a seguir (tengo bastante lectura acumulada para el fin de semana :D ), pero tengo compañeros que me van a ayudar en esta nueva etapa del largo camino (y también tengo un cliente :P ).
¡Nos vemos!
PS: Mañana tenemos code retreat en el taller :D Ya os contaré que tal.
El tiempo que he formado parte de Eden ha sido espectacular. Estoy muy agradecido a todos y cada uno de mis compañeros por creer en mi y por hacerme crecer tanto en lo personal como en lo profesional :) De verdad, muchas, muchas gracias por haberme brindado esta oportunidad.
Supongo que os preguntaréis qué ha pasado. Tranquilos, no he suspendido durante mi aprendizaje :P De hecho, voy a seguir siendo aprendiz de Aimee (¡yuju!). Simplemente, a veces las cosas no salen como uno espera y entonces es cuando tenemos que abrazar el cambio :D
Ahora empieza otra aventura :D Me voy a quedar en Inglaterra mejorando mi inglés y trabajando como autónomo. Después de mi internship pense en hacerlo en España, pero no terminé de atreverme. Ahora sí que me voy a lanzar :D Todavía no tengo muy claro los pasos a seguir (tengo bastante lectura acumulada para el fin de semana :D ), pero tengo compañeros que me van a ayudar en esta nueva etapa del largo camino (y también tengo un cliente :P ).
¡Nos vemos!
PS: Mañana tenemos code retreat en el taller :D Ya os contaré que tal.
Etiquetas:
apprenticeship,
eden,
resistencia
My Vim configuration. Part 3 - Vim shortcuts
Continuing with my explanation of my Vim configuration (you can have a look at my view settings and my plugin settings), today is the day of the shortcuts :)
Everyone of us love the shortcuts our favorite IDE has. Vim is no less and you can define whatever shortcut you need :)
How to define a shortcut in Vim
It is very easy to define a shortcut in Vim, you only need to map the key combination you one to use with the actual command you want to execute.
To map a combination you can use map or noremap (and all the variants for each mode, like imap, inoremap, nmap, nnoremap, etc...). The difference between map and noremap is that the second one is not recursive. You have a very good explanation here.
You can see an example of a shortcut definition:
This shortcut closes Vim without saving the file and can be executed by pressing the keys 'c', 'l', 'o', 's' and 'e'
Leader
The previous example is more or less a "hard code" shortcut :) A better way to map commands is using the leader variable, so you start your shortcut by pressing your leader combination.
To define your leader combination you only need to do something like this:
In this case, my leader combination is just the ',' key :)
It is important to define your leader combination because a lot of the existing plugins for Vim use it for their own shortcuts (mappings).
My shortcuts
Ok, now that we have defined the leader, let's have a look to my actual shortcuts.
The first one I want to show you is how to change between the actual buffer and the alternative buffer (If you don't know anything about Vim buffers, take a look at this video, it is great!)
What I'm doing here is mapping ',' and '6' to ':b#' (:b# is what you have to type to switch buffers when in normal mode. means that, after the command, I want to press 'return', executing the command). I'm using nnoremap for this shortcut because I want to use it only in normal mode (the first n of nnoremap) and because if some of my plugins map any ':', 'b' or '#' key to any command I don't want to execute that shortcut (not recursive), I just want to execute ':b#'.
The next shortcuts are related to some plugins I use:
I just map the NERD tree to ',d' and a little bit of help every time I want to use ack (only in normal mode) :P
Then, I have two shortcut for removing the extra spaces (at the end of the line) and to change tabs with 2 spaces :)
I also have a shortcut that changes the ruby hashes (with a symbol as key) from 1.8 syntax to 1.9 syntax:
And last, but not least, I map the tab as a match bracket finder:
I probably change all of this shortcuts in the future, when I get more experience with Vim, but I hope it shows you how powerful (and customizable) Vim is :)
PS: I know that the gist are not visible on google reader. Sorry about that! I want to move my blog and fix that :)
Everyone of us love the shortcuts our favorite IDE has. Vim is no less and you can define whatever shortcut you need :)
How to define a shortcut in Vim
It is very easy to define a shortcut in Vim, you only need to map the key combination you one to use with the actual command you want to execute.
To map a combination you can use map or noremap (and all the variants for each mode, like imap, inoremap, nmap, nnoremap, etc...). The difference between map and noremap is that the second one is not recursive. You have a very good explanation here.
You can see an example of a shortcut definition:
This shortcut closes Vim without saving the file and can be executed by pressing the keys 'c', 'l', 'o', 's' and 'e'
Leader
The previous example is more or less a "hard code" shortcut :) A better way to map commands is using the leader variable, so you start your shortcut by pressing your leader combination.
To define your leader combination you only need to do something like this:
In this case, my leader combination is just the ',' key :)
It is important to define your leader combination because a lot of the existing plugins for Vim use it for their own shortcuts (mappings).
My shortcuts
Ok, now that we have defined the leader, let's have a look to my actual shortcuts.
The first one I want to show you is how to change between the actual buffer and the alternative buffer (If you don't know anything about Vim buffers, take a look at this video, it is great!)
What I'm doing here is mapping ',' and '6' to ':b#
The next shortcuts are related to some plugins I use:
I just map the NERD tree to ',d' and a little bit of help every time I want to use ack (only in normal mode) :P
Then, I have two shortcut for removing the extra spaces (at the end of the line) and to change tabs with 2 spaces :)
I also have a shortcut that changes the ruby hashes (with a symbol as key) from 1.8 syntax to 1.9 syntax:
And last, but not least, I map the tab as a match bracket finder:
I probably change all of this shortcuts in the future, when I get more experience with Vim, but I hope it shows you how powerful (and customizable) Vim is :)
PS: I know that the gist are not visible on google reader. Sorry about that! I want to move my blog and fix that :)
martes, 8 de marzo de 2011
Sass is so cool!
I have to admit that I didn´t know almost anything about CSS six months ago. I was an API developer and I never needed it. But now, everything has changed (I know, it should have changed before, but it didn´t). I need to improve my CSS skills and I need to do it quickly!
The thing is, I don't really like CSS. I find it a bit confusing and, every time I try to do something I end up doing a mess. What can I do? I need to learn SASS (Syntactically Awesome StyleSheets)!
SASS to the rescue
This is the first line you can read on the SASS page:
What makes SASS funny
For me, SASS is funny because it brings programming concepts to CSS, and I love programming :D
Variables in SASS
Corey Haines said on Twitter that this year's color was #CB6586. If I start to use this color on my CSS I have two problems:
And we can use that variable everywhere we want:
Mixins in SASS
Another DRY violation that I used to do with CSS is when I have to define effects (round borders, shadows, gradients, etc...) to the elements. I end up writing the same more than once (probably because I don't know almost anything about CSS, but probably because it is a very easy thing to do with CSS). SASS helps me to define mixins so I don't repeat my "code" every now and then.
An example of how to define a mixin to apply a gradient can be this one:
And we can use it like this:
Did you notice it? Mixins accepts arguments! How awesome is that?
More SASS awesomeness
You can find more cool SASS features on the official page. It is very simple and very useful!
Enjoy it!
The thing is, I don't really like CSS. I find it a bit confusing and, every time I try to do something I end up doing a mess. What can I do? I need to learn SASS (Syntactically Awesome StyleSheets)!
SASS to the rescue
This is the first line you can read on the SASS page:
Sass makes CSS fun again.And, do you know what? It is true!
What makes SASS funny
For me, SASS is funny because it brings programming concepts to CSS, and I love programming :D
Variables in SASS
Corey Haines said on Twitter that this year's color was #CB6586. If I start to use this color on my CSS I have two problems:
- If I want to change it on january 1st of 2012 with the 2012 color I'm going to find all the places I'm using it (DRY violation).
- I am not a color machine. #CB6586 does not mean anything to me (Not readable).
And we can use that variable everywhere we want:
Mixins in SASS
Another DRY violation that I used to do with CSS is when I have to define effects (round borders, shadows, gradients, etc...) to the elements. I end up writing the same more than once (probably because I don't know almost anything about CSS, but probably because it is a very easy thing to do with CSS). SASS helps me to define mixins so I don't repeat my "code" every now and then.
An example of how to define a mixin to apply a gradient can be this one:
And we can use it like this:
Did you notice it? Mixins accepts arguments! How awesome is that?
More SASS awesomeness
You can find more cool SASS features on the official page. It is very simple and very useful!
Enjoy it!
domingo, 6 de marzo de 2011
My Vim configuration. Part 2 - Vim plugins
I was supposed to talk about shortcuts in Vim, but I've changed my mind :P I'm going to talk about how to install plugins for Vim :)
Vim plugins
Vim has a lot of plugins, a lot :D So, how do I choose the plugins I need? Well, fist of all, you have to know what you need. This is very important, you shouldn't use a plugin if you're not sure about why you need it!
Once you've decided which plugins do you want you only need to install them!
How to install a vim plugin
Vim plugins are just scripts and to install them you only need to copy the script file in the right directory. Ok, this looks very similar to the way we add color schemes to our Vim, doesn't it? Yes, the only thing we need to change is the directory. When we install a plugin, we have to add the script file to the 'plugin' (or 'ftplugin' if it is a file-type-dependent script) directory in our .vim directory. Sooo easy :D
Yes, so easy. But, do I have to do that every time I get a new plugin or every time I update an old one? Cannot this process be automated? Yes, it can! There are a lot of tools to manage your plugin dependencies. I am using Vundle right now.
Vundle
Vundle is a plugin management tool for vim. It is very easy to set up and it is very easy to use. You only need to follow their instructions to "install" it. Once you have everything in its right place, you have to add those two lines to your .vimrc file:
This makes bundle available while you're using Vim :D
Vim plugins
Ok, so, how do I install plugins with Vundle? You only need to add the plugins you want to your .vimrc file (with the Vundler format). I have those:
As you can see, you can ask for the plugin by its "official" name or you can linked it to its github repository.
Once you've defined the plugins you want you only need to type:
on Vim to install or update your plugins :D
Ok, that's all for today. Soon on your screens "How to create shortcuts with Vim" (Although maybe I'll talk a little bit about why I choose those plugins)
Vim plugins
Vim has a lot of plugins, a lot :D So, how do I choose the plugins I need? Well, fist of all, you have to know what you need. This is very important, you shouldn't use a plugin if you're not sure about why you need it!
Once you've decided which plugins do you want you only need to install them!
How to install a vim plugin
Vim plugins are just scripts and to install them you only need to copy the script file in the right directory. Ok, this looks very similar to the way we add color schemes to our Vim, doesn't it? Yes, the only thing we need to change is the directory. When we install a plugin, we have to add the script file to the 'plugin' (or 'ftplugin' if it is a file-type-dependent script) directory in our .vim directory. Sooo easy :D
Yes, so easy. But, do I have to do that every time I get a new plugin or every time I update an old one? Cannot this process be automated? Yes, it can! There are a lot of tools to manage your plugin dependencies. I am using Vundle right now.
Vundle
Vundle is a plugin management tool for vim. It is very easy to set up and it is very easy to use. You only need to follow their instructions to "install" it. Once you have everything in its right place, you have to add those two lines to your .vimrc file:
This makes bundle available while you're using Vim :D
Vim plugins
Ok, so, how do I install plugins with Vundle? You only need to add the plugins you want to your .vimrc file (with the Vundler format). I have those:
As you can see, you can ask for the plugin by its "official" name or you can linked it to its github repository.
Once you've defined the plugins you want you only need to type:
on Vim to install or update your plugins :D
Ok, that's all for today. Soon on your screens "How to create shortcuts with Vim" (Although maybe I'll talk a little bit about why I choose those plugins)
domingo, 27 de febrero de 2011
My Vim configuration. Part 1 - View settings
Lately, I've been trying to understand better how Vim works, so I've started looking at its configuration files. I forked Chris's configuration (that was the easy part :D ) and I removed everything I'm not using at the moment. You can see my actual configuration files here.
It was not easy for me to understand how everything works, that's why I'm going to write about it :D Let's start from the beginning, the vimrc file.
.vimrc file
You can find an explanation about the .vimrc file here. Basically, this file is loaded just before entering Vim and it contains our personal Vim configuration settings.
I'll try to explain every line of my vimrc file during the week but, today, I'm going to show you how to configure the "view" part (colors, syntax highlighting, status line, etc).
My Vim view settings
Now, we have a nice Vim window much more friendly than the initial one :D The only problem is that the color scheme is just the default one (which is not very good).
Adding color schemes to Vim
To add a color scheme to vim we first need to get one :D There are a lot of them. I'm actually using tir_black, but I have to try some more :D
Ok, you've selected one color scheme, how does Vim know about it? First of all, you need to create a .vim/colors directory in your home directory. Then, you have to copy the color scheme vim file to that directory.
That's all! Now, you can go to Vim and type
The only problem with this is that it is not a permanent change. Every time you close Vim, it will lose your color scheme preference.
What can we do about it? Easy, we just need to open our .vimrc file and add the following line:
Now, Vim knows our preferences :D
Ok, that's all for today. Soon on your screens "How to create shortcuts with Vim"
It was not easy for me to understand how everything works, that's why I'm going to write about it :D Let's start from the beginning, the vimrc file.
.vimrc file
You can find an explanation about the .vimrc file here. Basically, this file is loaded just before entering Vim and it contains our personal Vim configuration settings.
I'll try to explain every line of my vimrc file during the week but, today, I'm going to show you how to configure the "view" part (colors, syntax highlighting, status line, etc).
My Vim view settings
Now, we have a nice Vim window much more friendly than the initial one :D The only problem is that the color scheme is just the default one (which is not very good).
Adding color schemes to Vim
To add a color scheme to vim we first need to get one :D There are a lot of them. I'm actually using tir_black, but I have to try some more :D
Ok, you've selected one color scheme, how does Vim know about it? First of all, you need to create a .vim/colors directory in your home directory. Then, you have to copy the color scheme vim file to that directory.
That's all! Now, you can go to Vim and type
The only problem with this is that it is not a permanent change. Every time you close Vim, it will lose your color scheme preference.
What can we do about it? Easy, we just need to open our .vimrc file and add the following line:
Now, Vim knows our preferences :D
Ok, that's all for today. Soon on your screens "How to create shortcuts with Vim"
jueves, 24 de febrero de 2011
Vim macros
I'm a total noob with vim, so I'm going to start a very basic series of blog posts writing down everything I learn :) Those are going to be very short posts explaining a vim feature. So, let's get started.
Today, I've been working with Tooky the whole day and he has taught me how macros work in Vim.
I can only imagine how powerful they are :D We've used one to rename a method (including everyplace it was called)
How to record a macro
First of all, we need to be on command mode. Then, we have to press 'q' and the key to store the macro ('qa' will store the macro in the key 'a'). We'll see the word 'recording' on the last line.
Everything we do then will be recorded (And I mean everything and on any mode).
To stop recording the macro, all we need to do is press 'q' on command mode.
How to execute a macro
All we have to do is to press 'q' and the key where we stored the macro (on command mode). To execute a macro stored in the key 'a' we have to press '@a'.
Recursive macros
We can make a recursive macro by recording a '@<key that stores the macro>'
Hope you find it useful :)
Today, I've been working with Tooky the whole day and he has taught me how macros work in Vim.
I can only imagine how powerful they are :D We've used one to rename a method (including everyplace it was called)
How to record a macro
First of all, we need to be on command mode. Then, we have to press 'q' and the key to store the macro ('qa' will store the macro in the key 'a'). We'll see the word 'recording' on the last line.
Everything we do then will be recorded (And I mean everything and on any mode).
To stop recording the macro, all we need to do is press 'q' on command mode.
How to execute a macro
All we have to do is to press 'q' and the key where we stored the macro (on command mode). To execute a macro stored in the key 'a' we have to press '@a'.
Recursive macros
We can make a recursive macro by recording a '@<key that stores the macro>'
Hope you find it useful :)
martes, 22 de febrero de 2011
Estado de un plagelao
Hoy voy a escribir un poco sobre como han sido mis tres primeras semanas en Eden a nivel personal. Os advierto desde ya que va a ser un post sobre como me siento yo, no sobre como funciona Eden. Si no os apetece leerlo, lo entiendo :D
Enrique continúa su largo camino
Estas tres semanas han dado para mucho pero, probablemente, lo más importante es la marcha de Enrique.
Como para muchos de vosotros, Enrique es una fuente de inspiración tanto en lo personal como en la profesional. Creo que soy muy afortunado por haberle conocido y por poder trabajar con él. ¡Gracias, Enrique! ¡Te deseo muchos éxitos y felicidad mientras cumples tus sueños!
Por suerte, Enrique se queda hasta abril (o no, depende de varias cosas :D ) en Winchester, así que aún podré disfrutar de su compañía algún tiempo más :)
Pero entonces ¿tú que haces?, ¿te quedas en Winchester o te vuelves a Madrid? ¿Qué pasa con Eden Madrid?
Estas preguntas me las habéis hecho varios y creo que a todos os he contestado lo mismo. De momento, yo me quedo en Winchester continuando con mi apprenticeship. Si todo va bien espero quedarme en Eden una vez termine, ya os iré contando. Respecto a Eden Madrid, aún no se nada.
Los edenitas
Como ya os conté durante mi internship, los edenitas molan todo y más :D Todos me están ayudando mucho a integrarme en Eden (tanto personalmente como profesionalmente), especialmente mi mentora, Aimee :)
Quiero hacer una mención especial para mi compañera de aprendizaje, Despo :D Compartir el apprenticeship con alguien que está pasando por la misma experiencia ayuda a no sucumbir a la presión que nos auto-imponemos. ¡Gracias, Despo!
Pair programming
Todo lo que programo en Eden lo programo haciendo pair programming. No estaba acostumbrado pero tengo que decir que es muy divertido, muy cansado y mucho más productivo (al menos para mi).
Es más divertido porque no estás solo :D Siempre tienes alguien con quien hablar :P
Es muy cansado porque te obliga a estar a tope de concentración. Echando cuentas, creo que el máximo de pomodoros que he conseguido terminar en un día han sido 10, que vienen a ser 4 horas y cuarto... Y sin embargo termino mucho más cansado que cuando trabajo solo en casa.
Es más productivo porque es mucho más difícil relajar las buenas prácticas. Siempre tienes a alguien al lado diciendo cosas como "Creo que ese nombre no es correcto" o "¿No deberíamos hacer un test antes?".
Futuro
No se lo que me deparará el futuro. Lo que tengo claro es que pienso disfrutar el presente :D
¡Abrazos!
Enrique continúa su largo camino
Estas tres semanas han dado para mucho pero, probablemente, lo más importante es la marcha de Enrique.
Como para muchos de vosotros, Enrique es una fuente de inspiración tanto en lo personal como en la profesional. Creo que soy muy afortunado por haberle conocido y por poder trabajar con él. ¡Gracias, Enrique! ¡Te deseo muchos éxitos y felicidad mientras cumples tus sueños!
Por suerte, Enrique se queda hasta abril (o no, depende de varias cosas :D ) en Winchester, así que aún podré disfrutar de su compañía algún tiempo más :)
Pero entonces ¿tú que haces?, ¿te quedas en Winchester o te vuelves a Madrid? ¿Qué pasa con Eden Madrid?
Estas preguntas me las habéis hecho varios y creo que a todos os he contestado lo mismo. De momento, yo me quedo en Winchester continuando con mi apprenticeship. Si todo va bien espero quedarme en Eden una vez termine, ya os iré contando. Respecto a Eden Madrid, aún no se nada.
Los edenitas
Como ya os conté durante mi internship, los edenitas molan todo y más :D Todos me están ayudando mucho a integrarme en Eden (tanto personalmente como profesionalmente), especialmente mi mentora, Aimee :)
Quiero hacer una mención especial para mi compañera de aprendizaje, Despo :D Compartir el apprenticeship con alguien que está pasando por la misma experiencia ayuda a no sucumbir a la presión que nos auto-imponemos. ¡Gracias, Despo!
Pair programming
Todo lo que programo en Eden lo programo haciendo pair programming. No estaba acostumbrado pero tengo que decir que es muy divertido, muy cansado y mucho más productivo (al menos para mi).
Es más divertido porque no estás solo :D Siempre tienes alguien con quien hablar :P
Es muy cansado porque te obliga a estar a tope de concentración. Echando cuentas, creo que el máximo de pomodoros que he conseguido terminar en un día han sido 10, que vienen a ser 4 horas y cuarto... Y sin embargo termino mucho más cansado que cuando trabajo solo en casa.
Es más productivo porque es mucho más difícil relajar las buenas prácticas. Siempre tienes a alguien al lado diciendo cosas como "Creo que ese nombre no es correcto" o "¿No deberíamos hacer un test antes?".
Futuro
No se lo que me deparará el futuro. Lo que tengo claro es que pienso disfrutar el presente :D
¡Abrazos!
domingo, 20 de febrero de 2011
Omniauth, Twitter and BDD
Today I've (almost) integrated Twitter authentication for Let's walk the path together! I've used the omniauth gem to achieve this task. Thanks to this railscast, it is very easy to understand how to do it. But, we are doing BDD, aren't we? How do we do BDD against Twitter? That's what I'm going to tell you today :D
Omniauth
OmniAuth is a Rack-based authentication system for twitter (and many other services). Its rack middleware is the one that talks with twitter and puts the twitter user data in the env variable. You can watch the railcast to see an explanation of how it works (it's only 8 minutes).
BDD
Ok, I know how to integrate Twitter authentication in my application. How do I test it? How do I continue with my BDD cycle? When we are testing our application, we don't want to rely on the actual Twitter service. It will make our tests slower and brittle. We need to have control of our tests, so we need to fake the Twitter server. Fortunately, doing it with omniauth is very easy.
We only need to put omniauth in test mode and give it the information we want to receive from Twitter in our test:
In this case, we're telling omniauth to, when asked about Twitter, give us the provider, the user uid and the user name.
We can integrate this easy in a cucumber hook, or even in a cucumber step, to mock the Twitter server and continue with our BDD cycle :D
Omniauth
OmniAuth is a Rack-based authentication system for twitter (and many other services). Its rack middleware is the one that talks with twitter and puts the twitter user data in the env variable. You can watch the railcast to see an explanation of how it works (it's only 8 minutes).
BDD
Ok, I know how to integrate Twitter authentication in my application. How do I test it? How do I continue with my BDD cycle? When we are testing our application, we don't want to rely on the actual Twitter service. It will make our tests slower and brittle. We need to have control of our tests, so we need to fake the Twitter server. Fortunately, doing it with omniauth is very easy.
We only need to put omniauth in test mode and give it the information we want to receive from Twitter in our test:
In this case, we're telling omniauth to, when asked about Twitter, give us the provider, the user uid and the user name.
We can integrate this easy in a cucumber hook, or even in a cucumber step, to mock the Twitter server and continue with our BDD cycle :D
Etiquetas:
apprenticeship,
BDD,
eden,
omniauth,
twitter
jueves, 17 de febrero de 2011
BDD y descargas de ficheros auto-generados
La semana pasada, Tom y yo necesitábamos comprobar que un informe se descargaba correctamente desde la aplicación. Dicho informe era una hoja excel generada a partir de los datos contenidos en la base de datos. ¿Os interesa saber cómo lo hicimos? Os lo voy a contar con un ejemplo algo más simple :D
Escenario
Empecemos creando un escenario en cucumber. Queremos descargar un catálogo de productos generado por nuestra aplicación:
Steps
El given simplemente crea un producto en el sistema y el when descarga el catálogo:
Muy bien, hemos descargado el fichero al pulsar el enlace pero, ¿cómo accedemos a dicho fichero cuando estoy usando capybara y rack-test? Se me ocurren dos cosas. La primera es usar selenium en lugar de rack-test, haciendo que nuestros tests sean muuucho más lentos. La otra es obtener el bytestream del fichero descargado que, por si no lo sabíais, está en el body de la página obtenida tras hacer click en el enlace de descarga:
Esto tan simple funciona porque, en nuestro caso, estamos descargando un fichero de texto plano. Si en lugar de un texto plano tenemos, por ejemplo, un fichero Excel solo necesitamos parsear los bytes que nos llegan en el body con un objeto que entienda el formato Excel. Nosotros utilizamos la gema Spreadsheet (Cuidado con pronunciarlo spred-shit que queda muy feo :P )
¡Esto es todo, amigos! Un saludo
Escenario
Empecemos creando un escenario en cucumber. Queremos descargar un catálogo de productos generado por nuestra aplicación:
Steps
El given simplemente crea un producto en el sistema y el when descarga el catálogo:
Muy bien, hemos descargado el fichero al pulsar el enlace pero, ¿cómo accedemos a dicho fichero cuando estoy usando capybara y rack-test? Se me ocurren dos cosas. La primera es usar selenium en lugar de rack-test, haciendo que nuestros tests sean muuucho más lentos. La otra es obtener el bytestream del fichero descargado que, por si no lo sabíais, está en el body de la página obtenida tras hacer click en el enlace de descarga:
Esto tan simple funciona porque, en nuestro caso, estamos descargando un fichero de texto plano. Si en lugar de un texto plano tenemos, por ejemplo, un fichero Excel solo necesitamos parsear los bytes que nos llegan en el body con un objeto que entienda el formato Excel. Nosotros utilizamos la gema Spreadsheet (Cuidado con pronunciarlo spred-shit que queda muy feo :P )
¡Esto es todo, amigos! Un saludo
Etiquetas:
apprenticeship,
BDD,
capybara,
eden,
racktest
miércoles, 9 de febrero de 2011
Specify exactly what you want to happen and no more
There is a discussion in the spanish TDD group about whether it is good or bad, when you have a stub object, to return a different value depending on the input arguments of the method. I don't think it's the right thing to do because, normally, when a stub object cares about the input arguments in its method calls it's because it should not be a stub object, it should be a mock object. Let me explain it with an example:
The payment gateway is a stub that returns true when user_has_funds is called with an input argument of 50.
If we look carefully at the test, what we are really doing is testing more than one behavior. First, we're asserting that a user can buy stuff if she has sufficient funds. Second, we are expecting that the payment gateway is called with the right amount.
So, if it is an expectation, why don't we use a mock instead of a stub? We're mixing the concepts of mock and stub and, as a consequence, we're testing more than one thing.We're breaking the single responsibility principle.
Steve Freeman and Nat Pryce, authors of the great Growing objects oriented software, guided by tests, recommend to follow a simple rule of thumb, "specify exactly what you want to happen and no more". If we listen to them (and we should!), those are the resulting tests:
The first test specifies the relationship between the order and the payment gateway (The message protocol). It uses a mock object to replace the gateway payment object and it expects a call at user_has_funds method with the order amount as an input argument. We want to know that the payment gateway is going to be called with the right amount, so we are interested in its input argument (which is right when mocking). The second one specifies the behavior of the order when the user has funds, and I don't really care about how the order interacts with the payment gateway. I just want to know that the user has sufficient funds. That's why, in this case, we use a stub.
What I like about the new tests is that, if we change the order behavior by adding some taxes to the product price, the second test is not going to break (we still confirm the order if the payment gateway says that the user has funds, nothing has changed in that specification). Only the first one would be red (and for the right cause, we've changed exactly that specification).
What do you think?
PS: I know that, in RSpec:mocks, stub() is an alias for mock() and I don't like it very much :P
The payment gateway is a stub that returns true when user_has_funds is called with an input argument of 50.
If we look carefully at the test, what we are really doing is testing more than one behavior. First, we're asserting that a user can buy stuff if she has sufficient funds. Second, we are expecting that the payment gateway is called with the right amount.
So, if it is an expectation, why don't we use a mock instead of a stub? We're mixing the concepts of mock and stub and, as a consequence, we're testing more than one thing.We're breaking the single responsibility principle.
Steve Freeman and Nat Pryce, authors of the great Growing objects oriented software, guided by tests, recommend to follow a simple rule of thumb, "specify exactly what you want to happen and no more". If we listen to them (and we should!), those are the resulting tests:
The first test specifies the relationship between the order and the payment gateway (The message protocol). It uses a mock object to replace the gateway payment object and it expects a call at user_has_funds method with the order amount as an input argument. We want to know that the payment gateway is going to be called with the right amount, so we are interested in its input argument (which is right when mocking). The second one specifies the behavior of the order when the user has funds, and I don't really care about how the order interacts with the payment gateway. I just want to know that the user has sufficient funds. That's why, in this case, we use a stub.
What I like about the new tests is that, if we change the order behavior by adding some taxes to the product price, the second test is not going to break (we still confirm the order if the payment gateway says that the user has funds, nothing has changed in that specification). Only the first one would be red (and for the right cause, we've changed exactly that specification).
What do you think?
PS: I know that, in RSpec:mocks, stub() is an alias for mock() and I don't like it very much :P
lunes, 7 de febrero de 2011
Resistencia
Hace más o menos un mes, mi novia me regaló "Linchpin", un libro de Seth Godin. Si no lo habéis leido, leedlo.
Aunque prácticamente debería copiar el libro palabra por palabra, hoy solo voy a hablar de una de las partes que más me han llamado la atención, la resistencia
La resistencia
¿Alguna vez os habéis puesto una excusa para no hacer algo? Yo os pongo algunas de las mías:
"Me gusta esa chica pero no voy a decirle nada no vaya a ser que pase de mi"
"No voy a proponer nada para el open porque eso de hablar en público no me gusta nada"
"Podría solicitar ese puesto pero ¿que va a pasar con mi vida si me cogen? Mejor lo dejo pasar"
Lo que tienen en común todas esas frases es que yo soy el que pone los impedimentos, nadie más. Yo soy el que me impide alcanzar nuevas metas, yo soy el que no me deja evolucionar, yo soy el único responsable de mi propio futuro. Cualquier otra causa que sea capaz de pensar es una excusa creada por la resistencia.
Pasar a la acción
Últimamente estoy intentando vencer siempre que puedo a esa resistencia. Cada vez que me doy cuenta de que estoy pensando alguna excusa para no hacer una tarea, dejo de pensar y me pongo a hacerla. Así es como he decidido que mi primera charla en Eden trate sobre javascript (un lenguaje que desconozco), o que la tecnología que quiero enseñar al resto de edenitas (españolizando el término) sea node.js.
¿Qué puede ser lo peor que puede pasar? Por mucho que mi cerebro de reptil me diga lo contrario, lo peor que puede pasar es que aprenda algo nuevo.
Un saludo
Aunque prácticamente debería copiar el libro palabra por palabra, hoy solo voy a hablar de una de las partes que más me han llamado la atención, la resistencia
La resistencia
¿Alguna vez os habéis puesto una excusa para no hacer algo? Yo os pongo algunas de las mías:
"Me gusta esa chica pero no voy a decirle nada no vaya a ser que pase de mi"
"No voy a proponer nada para el open porque eso de hablar en público no me gusta nada"
"Podría solicitar ese puesto pero ¿que va a pasar con mi vida si me cogen? Mejor lo dejo pasar"
Lo que tienen en común todas esas frases es que yo soy el que pone los impedimentos, nadie más. Yo soy el que me impide alcanzar nuevas metas, yo soy el que no me deja evolucionar, yo soy el único responsable de mi propio futuro. Cualquier otra causa que sea capaz de pensar es una excusa creada por la resistencia.
Pasar a la acción
Últimamente estoy intentando vencer siempre que puedo a esa resistencia. Cada vez que me doy cuenta de que estoy pensando alguna excusa para no hacer una tarea, dejo de pensar y me pongo a hacerla. Así es como he decidido que mi primera charla en Eden trate sobre javascript (un lenguaje que desconozco), o que la tecnología que quiero enseñar al resto de edenitas (españolizando el término) sea node.js.
¿Qué puede ser lo peor que puede pasar? Por mucho que mi cerebro de reptil me diga lo contrario, lo peor que puede pasar es que aprenda algo nuevo.
Un saludo
Etiquetas:
apprenticeship,
eden,
resistencia,
seth godin
jueves, 3 de febrero de 2011
Apprentice at Eden Development
Here I am! I'm an apprentice at Eden Development :D I'm very happy to be here and I want to share this experience with you.
Apprenticeship and Eden
Even though Eden is all into the Software craftsmanship, Despo and I are their first full-time apprentices, so we'll improve the process as we walk the road :D We're going to do two month iterations with all Eden and one week iterations with Aimee (our mentor).
Apprentice expectations
Last monday, Chris and Aimee told us about the kind of things they're expecting from us.
Apprentice tasks
Apart from the expectations, they also told us some "mandatory" things, so I have a lot of homework :P
I must write one blog post every week. I don't really think that's going to be a problem given my previous internship ;) I'll try to write twice a week (once in English and once in Spanish)
I must give an Eden talk every month. Since all Eden talks are already booked until March, I'll do the first one on March 1st. The talk is titled "Javascript, I didn't know that!" and I'm going to do a javascript koans session.
I must do an apprenticeship ongoing project. I want to continue growing Let's walk the path together! I want it to be a useful resource for the spanish developer community so, if you want me to add some features just tell me about it. I also have to do a presentation about the project every two months (code review and retrospective included).
There is one more thing I have to do during my apprenticeship. I have to teach some technology to the edenites! I don't know yet what I'm going to do with that...
As you can see, I have a big challenge ahead!
Apprenticeship and Eden
Even though Eden is all into the Software craftsmanship, Despo and I are their first full-time apprentices, so we'll improve the process as we walk the road :D We're going to do two month iterations with all Eden and one week iterations with Aimee (our mentor).
Apprentice expectations
Last monday, Chris and Aimee told us about the kind of things they're expecting from us.
- Real world experience of client work
- Ability to grasp complex logic
- Confidence to change code (sometimes unattended)
- Humility
- Admitting to mistakes
- A good grasp of TDD
Apprentice tasks
Apart from the expectations, they also told us some "mandatory" things, so I have a lot of homework :P
I must write one blog post every week. I don't really think that's going to be a problem given my previous internship ;) I'll try to write twice a week (once in English and once in Spanish)
I must give an Eden talk every month. Since all Eden talks are already booked until March, I'll do the first one on March 1st. The talk is titled "Javascript, I didn't know that!" and I'm going to do a javascript koans session.
I must do an apprenticeship ongoing project. I want to continue growing Let's walk the path together! I want it to be a useful resource for the spanish developer community so, if you want me to add some features just tell me about it. I also have to do a presentation about the project every two months (code review and retrospective included).
There is one more thing I have to do during my apprenticeship. I have to teach some technology to the edenites! I don't know yet what I'm going to do with that...
As you can see, I have a big challenge ahead!
Suscribirse a:
Entradas (Atom)