Articles in category: Structured Programming

No Country For If Else

Questo articolo è disponibile anche in italiano

Elviro Rocca Elviro Rocca avatar

21 minute read

There is an unwanted guest with us as we write code and build software projects: it’s the code that’s already written, and we must take into account its complexity as the code base increases in size. High complexity of the existing code can make the following activities particularly difficult:

  • understanding the meaning of old code, written by others or ourselves;
  • tracing the causes of bugs, i.e. errors, in code;
  • making changes to a certain procedure;
  • adding features to existing structures;

Even if we approach the development of new software with agile methodologies, we always have to deal with the existing code, and to do that we must at least be able to understand it without overexertion. So when I talk about complexity I am referring in particular to the difficulty with which a programmer can reason about the existing code: the preface of the well-known academic textbook Structure and Interpretation of Computer Programs contains the following sentence:

No Country For If Else

This article is also available in english

Elviro Rocca Elviro Rocca avatar

21 minute read

C’è un ospite indesiderato che ci accompagna sempre mentre scriviamo codice e realizziamo progetti software: si tratta del codice già esistente, e dobbiamo tener conto della sua complessità man mano che la code base aumenta di dimensioni. Un’elevata complessità del codice può rendere le seguenti attività particolarmente difficili:

  • comprendere il significato di codice vecchio, scritto da altri o da se stessi;
  • tracciare le cause di bug, cioè errori, nel codice;
  • eseguire modifiche a una certa procedura;
  • aggiungere funzionalità a strutture già esistenti;

Anche approcciando lo sviluppo di nuovo software con metodologie agili, dobbiamo comunque fare i conti con il codice esistente, e per farlo dobbiamo almeno essere in grado di comprenderlo senza sforzi eccessivi. Dunque quando parlo di complessità mi riferisco in particolare alla difficoltà con la quale una programmatore è in grado di ragionare sul codice. La prefazione del noto testo accademico Structure and interpretation of computer programs contiene la seguente frase: