Posts Tagged

Testing

Java By Comparison: Become a Java Craftsman in 70 Examples

This time I will comment on «Java By Comparison: Become a Java Craftsman in 70 Examples», a book aimed at the reader to improve his skills as a Java 8 developer. This is the first book that I read from the publisher, «The Pragmatic Bookshelf», which specializes in books focused on the knowledge and improvement of the different areas of software development. This book has helped me to review those refactoring techniques that I already knew, and to learn others that I didn’t know. To establish a comparison, we could say that this title is a much shorter and lighter version of the famous book «Clean Code».

The book consists of seventy examples grouped into nine chapters in which, first, a code fragment is shown that presents one or more elements that can be improved, and then a second fragment is shown that is refactored with the proposed solution. This format allows you to compare at a glance, the changes and improvements applied to the code by the authors.

Some of the areas that the book focuses on are exclusive to Java version 8, such as the use of the «Optional» object to avoid Null Pointer type exceptions or the optimization of the code through the use of Lambdas expressions. Other chapters, however, are applicable to previous versions of the language, and even to other languages, such as those dedicated to the correct naming of methods and variables, the handling of exceptions, the design of objects, or the improvement of unit tests, among many other examples up to seventy. The last chapter breaks this trend to present, in a more theoretical way, the concepts and tools used in modern software development, such as static code analysis tools or continuous integration.

In short, it is a book that, although it may be a little basic for an experienced developer, is well written and its explanations are clear and concise. It is a recommended book to consolidate or, depending on the reader’s previous knowledge, to acquire new skills in Java code refactoring.

Title: Java By Comparison: Become a Java Craftsman in 70 Examples
Authors: Simon Harrer, Jörg Lenhard, Linus Dietz
Editor: The Pragmatic Bookshelf
Year: 2018
Language: English
Pages: 302


En esta ocasión voy a comentar «Java By Comparison: Become a Java Craftsman in 70 Examples», un libro destinado a que el lector mejore sus habilidades como desarrollador de Java 8. Este es el primer libro que leo de la editorial, «The Pragmatic Bookshelf», especializada en libros enfocados en el conocimiento y perfeccionamiento de las distintas áreas del desarrollo de software. A mí particularmente, esta obra me ha servido para repasar aquellas técnicas de refactorización que ya conocía, y para aprender otras que desconocía. Por establecer una comparación, podríamos decir que este título es una versión mucho más breve y ligera del famoso libro «Clean Code».

El libro consta de setenta ejemplos agrupados en nueve capítulos en los que, primero se muestra un fragmento de código que presenta uno o varios elementos factibles de ser mejorados, para a continuación mostrar un segundo fragmento refactorizado con la solución propuesta. Este formato permite comparar de un vistazo, los cambios y mejoras aplicadas al código por los autores.

Algunas de las áreas en las que se centra el libro son exclusivas de la versión 8 de Java como el uso del objeto «Optional» para evitar excepciones de tipo Null Pointer o la optimización del código mediante el uso de expresiones Lambdas. Otros capítulos, en cambio, son aplicables a versiones anteriores del lenguaje, e incluso a otros lenguajes, como pueden ser los dedicados al correcto nombrado de métodos y variables, el manejo de excepciones, el diseño de objetos, o a la mejora de los test unitarios, entre otros muchos ejemplos hasta sumar setenta. En el último capítulo se rompe esta tónica para presentar, de una manera más teórica, los conceptos y herramientas que se usan en el desarrollo de software moderno, como pueden ser las herramientas de análisis de código estático o la integración continua.

En definitiva, es un libro que, aun pudiendo tener un nivel un poco básico para un desarrollador experimentado, está bien escrito y sus explicaciones son claras y concisas. Es un libro recomendable para afianzar o, dependiendo de los conocimientos previos del lector, adquirir nuevas habilidades en la refactorización de código Java.

Título: Java By Comparison: Become a Java Craftsman in 70 Examples
Autores: Simon Harrer, Jörg Lenhard, Linus Dietz
Editor: The Pragmatic Bookshelf
Año: 2018
Idioma: Inglés
Páginas: 302

The Programmer’s Black Book

In «The Programmer’s Black Book», its author Rafael Gómez Blanes, based on his extensive professional experience, makes us reflect on the habits, factors and circumstances that can lead to a successful software project or, on the contrary, ruin it. But what is a successful software project? When do we consider that a development has been a success? Do we only refer to delivering it within the stipulated time and budget? No, that is no longer enough. In this sense there is a definition in the software book that I liked very much. A project ends successfully when its result is software that is easy, and therefore cheap, to evolve and maintain.

Because, as the author points out, would you like to buy a car that would be an odyssey to maintain or repair? Obviously not. Well, with software it shouldn’t happen either. Backing up the software with tests, applying design patterns, following the SOLID development principles, etc. are practices that help us prevent that, over time, modifying a product will be so expensive that it will directly be cheaper to «throw it away» and start over. Or what is the same, they help us avoid the so common Pareto principle in software construction: 80% of the time spent on maintenance tasks and 20% on developing new functionalities.

In my own professional experience, I have been able to verify this lack of culture in testing that the book comments on. First, because in most cases they are not required, and second, and perhaps more importantly, because we are not in the habit of performing them before – TDD – or after building a new functionality. Besides, it is also difficult to justify to your manager that a good part of your development time – in the book he estimates that it can be more than half of it – is going to be spent in developing tests that, although initially they are a cost of time and money, really it is an investment, since the software will have less errors and therefore it will be necessary to spend less time to correct them.

From a team management point of view, there are certain habits that will favor the success of a project, such as trying to maintain a relaxed and friendly atmosphere, avoiding constant interruptions, trying to prevent a high rotation of team members or not assuming as a custom to do extra hours in our working day. That’s why in the author’s opinion, and mine too, a software project manager should, not be a computer engineer or have performed technical tasks, but at least know the nature of software development and the peculiarities involved. Good software project management, like learning a new technology or a new programming language, is a skill that can be learned and perfected with practice and effort.

In short, «The Programmer’s Black Book» is a book that will be useful, and also enjoyable, for anyone involved in software development and who wants to continue along the path of continuous improvement in their profession. It has motivated me personally to continue deepening in the good practices that it recommends.

Title: El Libro Negro del Programador
Author: Rafael Gómez Blanes
Editor: CreateSpace
Year: 2017 – Second Edition
Language: Spanish
Pages: 236


En «El Libro Negro del Programador», su autor Rafael Gómez Blanes, partiendo de su dilatada experiencia profesional, nos hace reflexionar sobre los hábitos, factores y circunstancias que pueden llevar a buen puerto un proyecto software o, por el contrario, arruinarlo. ¿Pero qué es llevar a buen puerto un proyecto software? ¿Cuándo consideramos que un desarrollo ha sido un éxito? ¿Nos referimos únicamente a entregarlo dentro del plazo y presupuesto estipulado? No, eso ya no es suficiente. En este sentido hay una definición en el libro software que me ha gustado mucho . Un proyecto termina con éxito cuando su resultado es un software fácil, y por tanto barato, de evolucionar y mantener.

Porque, tal y como señala el autor, ¿te gustaría comprar un coche que fuera una odisea mantener o reparar? Obviamente no. Pues con el software tampoco debería suceder. Respaldar el software con pruebas, aplicar patrones de diseño, seguir los principios de desarrollo SOLID etc. son prácticas que nos ayudan a prevenir que, con el paso del tiempo, modificar un producto sea tan caro que directamente salga más barato «tirarlo a la basura» y comenzar de nuevo. O lo que es lo mismo, nos ayudan a evitar el tan habitual principio de Pareto en la construcción de software: 80% del tiempo empleado en tareas de mantenimiento y un 20% en desarrollar nuevas funcionalidades.

En mi propia experiencia profesional, he podido comprobar esta falta de cultura en la realización de pruebas que comenta el libro. Primero porque en la mayoría de las ocasiones no se exigen, y segundo, y puede que más importante, porque no tenemos el hábito de realizarlas antes  – TDD – o después de construir una nueva funcionalidad. Además también resulta difícil justificar a tu responsable que buena parte de tu tiempo de desarrollo – en el libro estima que puede llegar a ser hasta más de la mitad – se va a emplear en desarrollar pruebas que, aunque inicialmente sean un coste de tiempo y dinero, realmente es una inversión, ya que el software tendrá menos errores y por tanto habrá que dedicar menos tiempo a corregirlos.

Desde un punto de vista de gestión del equipo, hay ciertos hábitos que favorecerán el éxito de un proyecto, como por ejemplo intentar mantener un ambiente relajado y de compañerismo, evitar las interrupciones constantes, intentar prevenir una alta rotación de los miembros del equipo o  no asumir como costumbre hacer horas de más en nuestra jornada laboral. Es por ello que en la opinión del autor, y en la mía también, un responsable de de proyecto software, debería, no ya ser ingeniero informático o haber desempeñado labores técnicas, pero sí al menos conocer la naturaleza del desarrollo de software y las peculiaridades que conlleva. La buena gestión de un proyecto software, al igual que aprender una nueva tecnología o un nuevo lenguaje de programación, es una habilidad que se puede aprender y perfeccionar con práctica y esfuerzo.

En definitiva, «El Libro Negro del Programador» es un libro que resultará útil , y además ameno, para cualquier persona vinculada al desarrollo del software y que desee continuar por el camino de la mejora continua en su profesión. A mí personalmente me ha motivado a seguir profundizando en las buenas prácticas que recomienda.

Título: El Libro Negro del Programador
Autor: Rafael Gómez Blanes
Editor: CreateSpace
Año: 2017 – Segunda Edición
Idioma: Castellano
Páginas: 236