refactoring

Recursos de programación de refactoring
8. Achieving Dependency Inversion by extracting an interface.Even though we are already injecting into Alarm the dependency on Sensor, we haven't inverted the dependency yet. Alarm still depends on a concrete implementation. Now we'll show how to invert the dependency by extracting an interface. Normally, it's better to defer this refactoring until you have more information, i.e., until the need for another sensor types arises, to avoid falling in the Speculative Generality code smell. However,...
1. Introduction.Last week I facilitated a guided kata for a Gran Canaria Ágil event in Aplicaciones Informáticas Domingo Alonso (thanks to both for inviting me) in which I explained a possible way to solve Luca Minudel's Tire Pressure Monitoring System exercise. This exercise is part of his TDD with Mock Objects: Design Principles and Emergent Properties exercises. I like these exercises very much because they contain clear violations of the SOLID principles but they are sill small enough to be...
Yesterday in the Barcelona Software Craftsmanship coding dojo we did the Binary Search Tree kata. Raúl Lorca and I paired using TDD in C# to get to a pretty OO solution. We didn't finish the exercise. We got to create the binary search tree but we didn't have time to code the in-order depth-first traversal. Well, it doesn't matter. The important thing is that we practiced TDD, recursion and OO by test-driving a recursive data structure. Today, with a bit more of time, I did the the whole kata i...
I've just watched this wonderful practical demonstration of using connascence to guide the refactoring step of TDD by James Jeffries and Kevin Rutherford: Red, Green, ... now what ?!These are the slides. These other slides explain more about each type of connascence. - por Garajeando
¿Cuándo lo hacemos? Hablamos sobre esto, sobre la utilidad que le encontramos y damos alguna bibliografía que a nosotros nos sirvió para asimilar conceptos. Bibliografía [LIBRO] Refactoring, by Martin Fowler [LIBRO] Refactoring to Patterns, by Joshua Kerievsky [LIBRO] Pro PHP Refactoring [VIDEO] Curso de Refactoring, by Xavi Gost [WIKI] Principios SOLID [VIDEO] Debate de “gurús” sobre cohesión y acoplamiento … Sigue leyendo 01×08 Refactoring →
Last week we started working on the String Calculator kata at the Clojure Developers Barcelona meetup. Finally, this week I found some time to finish it. These are the tests using Midje: The resulting code which is divided in several name spaces. The string-calculator.core name space: The string-calculator.numbers-parser which is where most of the logic lives: The string-calculator.numbers-validation name space: Finally, the string-calculator.numbers-filter name space: I used a mix of TDD a...
January- Software Architecture for Developers, Simon Brown - Functional Programming Patterns in Scala and Clojure, Michael Bevilacqua-Linn- Working Effectively with Unit Tests, Jay FieldsFebruary- Vida y Destino (Жизнь и судьба), Vasili Grossman. (2nd time)- Primer Libro de Lankhmar (The First Book of Lankhmar), Fritz Leiber- Drown, Junot Díaz- Los girasoles ciegos, Alberto Méndez- Smalltalk Best Practice Patterns, Kent BeckMarch- Las puertas del paraiso (The Vagrants), Yiyun Li- Growing Object-...
After the two previous posts (Clarifying conditional logic and Replacing conditional with polymorphism using multimethods), I had this version of the code: that was being used from the gilded-rose.core name space: Then I started introducing the new conjured items functionality using TDD. These are the new tests for conjured items: and these is the resulting code of the gilded-rose.item-quality name space: Notice the change in the update multimethod dispatch function. Now instead of being :name...
At the end of the previous post (Clarifying conditional logic), I had this version of the code: Even though the conditional logic in the update-item-quality function read much better than the original one, I completely got rid of it using the replace conditional with polymorphism refactoring. I used multimethods which is one of the ways of achieving polymorphism in Clojure. To start this refactoring, I first renamed the update-item-quality function to update-item-quality-old. Then I created a m...
Yesterday I did the Gilded Rose refactoring kata in Clojure which I started working on in the last Clojure Developers Barcelona meetup. This is the original code that I got from a Mike Jansen's GitHub repository: First of all I wrote tests following the description of the kata and had to fix several bugs related with items quality inferior and superior limits, 0 and 50 respectively. These are the tests using Midje: Once all the tests were in place, I started the refactoring by improving the in...