Buscar en Mind w/o Soul

jueves, agosto 23, 2007

Ejercicio de programación: zoom out para ver la estructura

Proponen como ejercicio reducir el tamaño del texto, para ver qué zonas de las funciones tienen un mal diseño estructural.

MM_Unix%20from%2010%2C000%20feet.jpg
Design Exercise: Zoom Out - Beautiful Code
Experienced programmers look at structure. How deeply nested is the code? How well encapsulated? Long subroutines with lots of nesting raise red flags and are immediate targets for extract method refactoring. Compound statements are looked upon with skepticism; would a temp variable make it simpler?

How do you think structurally? As with the artist-to-be turning their picture upside-down to eliminate the distraction of recognition, programmers must eliminate their bias towards syntax details. A simple way to do this is to zoom out, literally. Make your font so small the syntax details are no longer visible, only the indentation. There's nothing left to consider but structure.

No hay comentarios: