refactoring

Recursos de programación de refactoring
Yesterday Álvaro García (@alvarobiz) and I paired working on a possible solution to the Unconditional rock, paper, scissors kata that I facilitated in the recent SCBCN14 event. This is the last version of the tests so far: And this is the last version of the code: We managed to write the code without having to use conditionals in any moment. You can follow the process if you like since we did commits after every passing test and every refactoring. You can check the code in this GitHub reposito...
Yesterday Álvaro (@alvarobiz) and I facilitated the Fractions Arithmetic kata. It was an activity organized by the Barcelona Java Users Group and the Barcelona Software Craftsmanship Community. Thanks to Ignacio Cougil and Jonathan Vila for having the idea and making this event possible. Since the kata was meant to be an introducction to TDD, we had first a short talk explaining a bit what TDD is about. The talk took longer than I expected because we discussed about topics, such as, TDD, object-...
I've just watched this wonderful talk by Tom Stuart; Refactoring Ruby with Monads - por Garajeando
These are the links mentioned in this week's conversation about the second chapter: Talks Boundaries by Gary BernhardtBooks Object Design: Roles, Responsibilities, and Collaborations by Rebecca Wirfs-Brock and Alan McKeanOn Lisp by Paul GrahamPosts Tell Don't Ask by Martin FowlerTell, Don't Ask in The Pragmatic bookshelfTelling, Asking, and the Power of Jargon by Dave ThomasKeep It DRY, Shy, and Tell the Other Guy by Dave Thomas and Andy HuntLaw Of Demeter in C2 WikiThe Law of Demeter Is Not A...
Xavi nos presenta el curso de Refactoring a patrones
I refactored my my previous version of generalized FizzBuzz, so that, it doesn't use neither for loops nor recursion. Now it only uses: reduce and map. This is the new code: The tests are exactly the same as in the previous version: - por Garajeando
Cuando hemos aprendido el dar cera pulir cera del refactoring y nuestras funciones ya no pasan de las 20 lineas y nuestro código es semántico y limpio como una patena, entonces empezamos a ver que nuestra estructura, nuestro diseño también necesita atención, aplicando las mecanicas de refactoring y convergiendo a patrones bien conocidos. Hablaremos de como reconocer estas situaciones y mostraremos un ejemplo de aplicación sencillo pero escla recedor.
Álvaro García and I were pairing yesterday after work.We practised coding the Rotate an array in place kata in Python.It was great fun and we discussed about naming, scaffolding tests, closures, free variables and deleting tests.Once back at home, I redid the kata in JavaScript. You can see the resulting code in GitHub. I commited every time I got to green and after every refactoring so you can follow the process.In this post I just want to highlight what Álvaro and I did to optimize the code a...
This is my solution to the Beer song problem in Clojure:I wrote a first version using just regular functions:and a second one using multimethods:I enjoyed refactoring the code once all tests were passing. I also practised how to use multimethods and how to pass parameters with default values.You can nitpick my solution here or see all the exercises I've done so far in this repository. - por Garajeando
Last weekend I did the UglyTrivia legacy code refactoring kata in Java.Before starting to refactor, I added a characterization test to describe (characterize) the actual behavior of the original code. Since the only "visible effects" of the code were the lines it was writing to the standard output, I had to use that output to create the characterization test.This is the code of the characterization test:Although in this final version, the expected output reflects the fixing of two bugs in the or...