Passa ai contenuti principali

FUNCTIONAL (IT.6.2)

Tateo’s Interdisciplinary Lifelong Learning Project
T I L L L
LEARNING - SHARING - NETWORKING
Learning, knowledge sharing and Communities engagement about:
Artificial Intelligence, Augmented / Virtual / Mixed Reality, Automation, Electronics, Computer Science and Information Technology, Mobile Technologies, Problem Solving, Readings, Social Media, Simulation, Artificial Vision, Work and Soft Skills, Railway.
by Tateo Giovanni Battista
_____________________________
LEARNING
COMPUTER SCIENCE

The imperative era is now nearing its end.

L'era imperativa è ormai al tramonto.


Hashtag keywords: #computerScience #imperativeProgramming #functionalProgramming #softwareDevelopment #Clojure #lisp #parallelProgramming #TILLL #TateoBlog 

Summary. Limitations of the imperative programming paradigm that programmers are traditionally accustomed to using. Reasons and new technological conditions that have led today to the search for a new alternative methodology. Characteristics of "functional programming" and main differences compared to "imperative programming". The functional programming languages. 

Limiti del paradigma imperativo della programmazione che tradizionalmente i programmatori sono abituati ad utilizzare. Motivazioni e nuovi condizioni tecnologiche che hanno portato oggi alla ricerca di una nuova metodologia alternativa. Caratteristiche della "programmazione funzionale" e principali differenze rispetto alla "programmazione imperativa". I linguaggi di programmazione funzionale.


~ o ~

You are here (>>>) within the TILLL project
Ti trovi qui (>>>) all'interno del progetto TILLL

|
+->>> THE PROJECT 
      |
      +-> LEARNING
      |   +->>> IT. COMPUTER SCIENCE
      |         +->>> 1. BIG DATA
      |         +->>> 2. BUSINESS INTELLIGENCE
      |         +->>> 3. CLOUD COMPUTING
      |         +->>> 4. COMPUTER GRAPHICS
      |         +->>> 5. HPC
      |         +->>> 6. SW DEVELOPMENT
      |         |     +->>> 1. IMPERATIVE
      |         |     +->>> 2. FUNCTIONAL <<<
      |         |     +->>> 3. OOP
      |         |     +->>> 4. HTML
      |         +->>> 7. OPERATIONS RESEARCH
      |         +->>> 8. BLOCKCHAIN
      |         +->>> 9. EVENTS
      |
      +->>> SHARING
      |     |
      |     +->>> BLOG
      |
      +->>> COMMUNITY
      |
      +->>> ABOUT ME

~ o ~

Article content index.
Indice dei contenuti dell'articolo.

  The topics treated in this article are summarized below by means of the list of the titles of its paragraphs.

  Gli argomenti trattati in questo articolo vengono di seguito sintetizzati mediante l'elenco dei titoli dei suoi paragrafi.

 §1.  The end of the "imperative" era.
        La fine dell’era “imperativa”.
 §2.  Hardware resources are no longer critical.
        Le risorse hardware non sono più critiche.
 §3.  Parallel programming requires a different style.
        La programmazione parallela richiede uno stile differente.
 §4. Functional Programming takes the field.
       La Programmazione Funzionale scende in campo.
 §5. Spotlight on Functional Programming.
       Riflettori accesi sulla Programmazione Funzionale.
 §6. Functional programming languages.
       I linguaggi di programmazione Funzionali.
 §7.  Sources and References for insights.
        Fonti e riferimenti per approfondimenti.
 §8.  More generally.  
        Più in generale.
 §9.  Stay up to date.
        Rimani aggiornato.
§10.  Let's keep in touch.
       Teniamoci in contatto.
§11.  Something about the Tateo~Blog author.
       Qualcosa sull'autore di Tateo~Blog.

  I hope you find something interesting inside, something that is akin to your favorite topics and your way of thinking. Enjoy the reading.

  Spero che tu trovi qualcosa di interessante all'interno, qualcosa che sia affine ai tuoi argomenti preferiti ed al tuo modo di pensare. Buona lettura.



~ o ~

§1. The end of the "imperative" era.
La fine dell’era “imperativa”.

  The approach that we software developers are traditionally used to follow is inspired by a very specific paradigm. Many of us were born with this methodology and perhaps we don't even suspect the existence of alternatives. Perhaps many like me who am writing know that the paradigm we usually use is called "imperative". No one has ever felt the need to question this methodology as the performance obtained in terms of resources used and processing times did not raise the need to consider other techniques.
  L’approccio che noi sviluppatori software siamo tradizionalmente abituati a seguire si ispira ad un paradigma ben preciso. Molti di noi sono nati con questa metodologia e forse neanche sospettiamo l’esistenza di alternative. Forse molti come me che sto scrivendo sanno che il paradigma che usualmente utilizziamo si chiama “imperativo”. Nessuno ha mai sentito l’esigenza di mettere in discussione questa metodologia in quanto le performance che si ottengono in termini di risorse impiegate e di tempi di processing non hanno sollevato l’esigenza di prendere in considerazione altre tecniche.


~ o ~

§2. Hardware resources are no longer critical.
Le risorse hardware non sono più critiche.

  Today, however, multicore hardware technologies are increasingly appearing on the market, making parallel processing more affordable. Memory is no longer a critical resource for processing. For example, my first PC had 64K of RAM, while the computer I'm writing from has 8GB of RAM: 130,000 times more !. Furthermore, my legendary Commodore 64 worked at a frequency of 1 MHz, while today I work with a 3.4 GHz multi-core processor: a good 3,400 times faster! Therefore, no longer having to preserve processing time and memory occupation, the style of our programming can be oriented towards the optimization of other aspects that until now were kept in the background.
  Oggi, però, sul mercato si affacciano sempre più prepotentemente tecnologie hardware multicore che rendono più abbordabile l’elaborazione parallela. La memoria non rappresenta più una risorsa critica per l’elaborazione. Si osservi a titolo di esempio che il mio primo PC aveva 64K di RAM, mentre il computer da cui sto scrivendo ha 8GB di RAM : ben 130’000 volte di più!. Il mio mitico Commodore 64, inoltre, lavorava ad una frequenza di 1 MHz, mentre oggi lavoro con un processore multi-core da 3.4 GHz : ben 3’400 volte più veloce! Quindi, non dovendo più preservare il tempo di elaborazione e l’occupazione di memoria, lo stile della nostra programmazione può essere orientato alla ottimizzazione di altri aspetti che fino ad ora erano tenuti in secondo piano.


~ o ~

§3. Parallel programming requires a different style.
La programmazione parallela richiede uno stile differente.

  The trend to engage in new code optimization techniques is not a fad of the moment and was not born to satisfy a desire for renewal. In reality it is the daughter of the same technological innovations introduced by the hardware. The multi-core architecture is enhanced only if the processing is parallelizable. But obviously, in order for the code to be sorted on several processors at the same time, it must offer greater guarantees in terms of memory sharing and management, stability of the algorithms, absence of side effects, referential transparency, etc.
  La tendenza a dedicarsi a nuove tecniche di ottimizzazione del codice non è una moda del momento e non è nata per soddisfare una voglia di rinnovamento. In realtà essa è figlia delle stesse innovazioni tecnologiche introdotte dall'hardware. L’architettura multi-core è valorizzata solo se la elaborazione è parallelizzabile. Ma ovviamente affinché il codice possa essere smistato su più processori contemporaneamente deve offrire delle garanzie maggiori in termini di condivisione e gestione della memoria, di stabilità degli algoritmi, di assenza di effetti collaterali (side-effect), di trasparenza referenziale, ecc.


~ o ~

§4. Functional Programming takes the field.
La Programmazione Funzionale scende in campo.

  There is a paradigm known as "functional programming" which appears to be suitable for current technology. This technique until now has remained confined to research centers and university campuses. Set aside by the development world as it is considered a resource-eater and very slow in the management of large databases. The availability of increasingly larger memories, the advent of fast and multi-core processors, have made this technique more affordable. Its weaknesses have faded in favor of strengths that would offer greater stability, optimization, and maintainability of code meant to run in parallel.
  Esiste un paradigma noto col nome di “programmazione funzionale” che sembrerebbe essere adatto alla tecnologia attuale. Questa tecnica fino ad oggi è rimasta confinata nei centri di ricerca e nei campus universitari. Messa da parte dal mondo dello sviluppo in quanto ritenuta mangia-risorse e molto lenta nella gestione di grosse basi di dati. La disponibilità di memorie di dimensioni sempre maggiori, l’avvento di processori veloci e multi-core, ha reso questa tecnica più abbordabile. I suoi punti deboli si sono affievoliti a favore dei punti di forza che offrirebbero una maggiore stabilità, ottimizzazione e manutenibilità di codice pensato per essere eseguito in modo parallelo.

Figure: main differences between the "imperative" and "functional" approaches
Figura: differenze generali tra l’approccio “imperativo” e quello “funzionale”


~ o ~

§5. Spotlight on Functional Programming.
Riflettori accesi sulla Programmazione Funzionale.

  If in the future we want to continue to produce efficient software, we cannot ignore the adoption of this paradigm. In the next posts tagged with #FunctionalProgramming we will analyze in detail the merits of this paradigm: absence of side effects, referential transparency, recursion, thread-safe. We will also review the programming languages oriented to this style (Clojure, F #, Scala) and those usable in functional style (Ruby, Python, Perl). I look forward to the next post and I invite you to share your experiences in order to make this topic a little less mysterious.
  Se in futuro, vogliamo continuare a produrre software efficiente, non possiamo prescindere dalla adozione di questo paradigma. Nei prossimi post taggati con #FunctionalProgramming analizzeremo in dettaglio i pregi di questo paradigma : assenza di effetti collaterali, trasparenza referenziale, ricorsione, thread-safe. Inoltre prenderemo in rassegna i linguaggi di programmazione orientati a questo stile (Clojure, F#, Scala) e quelli utilizzabili in stile funzionale (Ruby, Python, Perl). Vi attendo al prossimo post e vi invito a condividere le vostre esperienze in modo da rendere questo argomento un pò meno misterioso.


~ o ~

§6. Functional programming languages.
I linguaggi di programmazione Funzionali.


  Programming languages are called functional when the fundamental technique for structuring programs is to use functions. The interesting aspect of functional programming is the ability to construct definitions. The purpose of a definition is to introduce a binding between a name and a value.
  I linguaggi di programmazione sono detti funzionali quando la tecnica fondamentale per strutturare i programmi è quella di utilizzare le funzioni. L'aspetto interessante della programmazione funzionale è la capacità di costruire definizioni. Lo scopo di una definizione è quello di introdurre un legame (binding) tra un nome ed un valore.

  Programming in a functional language consists of constructing definitions that the computer will later use to evaluate expressions and produce the result. Definitions are functions, usually expressed in mathematical terms. Each functional programming language has a series of auxiliary functions ready for solving simple problems, and which can be called up in the construction of a definition.
   In functional programming the calculator acts as a sort of pocket calculator, but with the possibility of expanding the basic capabilities by defining "new" functions.
   The expressions that contain within them the "new" functions, defined by the programmer, are evaluated using the definitions given through simplification rules ('reduction') to convert the expressions into simple forms (that is, not further reducible).
  Programmare in un linguaggio funzionale consiste nel costruire delle definizioni che successivamente il calcolatore utilizzerà per valutare delle espressioni e produrre il risultato. Le definizioni sono delle funzioni, normalmente espressa in termini matematici. Ogni linguaggio di programmazione funzionale possiede  una serie di funzioni ausiliarie già pronte per risolvere problemi semplici, e che possono essere richiamate nella costruzione di una definizione.
  Nella programmazione funzionale il calcolatore agisce come una sorta di una calcolatrice tascabile, ma con la possibilità di ampliare le capacità base per mezzo della definizione di funzioni “nuove”. 
  Le espressioni che contengono al loro interno le funzioni "nuove", definite dal programmatore, sono valutate utilizzando le definizioni date tramite regole di semplificazione (‘riduzione’) per convertire le espressioni in forme semplici (ovvero, non ulteriormente riducibili).

  The simplest definition is that which, by means of the special "let" construct and only the equality symbol "=", associates a value, for example numerical, to a symbol or a name:
  La definizione più semplice è quella che per mezzo dello speciale costrutto "let" e del solo simbolo di uguaglianza "=" associa un valore, per esempio numerico, ad un simbolo oppure ad un nome:

#let side = 12 ;;  

  The definitions become more complicated as more complex mathematical expressions are used. For example, let's consider the definition of a "square" function that allows you to calculate the square of a number, and in particular to calculate the area of a square whose side size is known:
  Le definizioni si complicano man mano che si utilizzano espressioni matematiche più articolate. Per esempio consideriamo la definizione di una funzione "square" che permette di calcolare il quadrato di un numero, ed in particolare di calcolare l'area di un quadrato di cui è nota la dimensione del lato:

#let square x = x * x ;;
#let area = square lato ;;

  As a further example we consider the definition of a function "min" which allows to calculate the minimum between two numbers:
  Come ulteriore esempio consideriamo la definizione di una funzione "min" che permette di calcolare il minimo tra due numeri:

#let min (x:int) (y:int) = if x>y then y else x ;;

  Indeed, the purpose of a definition is to introduce a binding between a name and a value. In the definitions seen above, the "square" identifier is associated with the function that calculates the square of its argument, and the "min" identifier is associated with the function that returns the smaller of two numbers. A set of bindings is called an evaluation environment or context.
  In effetti, lo scopo di una definizione `e quello di introdurre un legame (binding) tra un nome ed un valore. Nelle definizioni viste sopra, l’identificatore "square" è associato alla funzione che calcola il quadrato del suo argomento, e l’identificatore "min" è associato alla funzione che restituisce il più piccolo tra due numeri. Un insieme di legami (bindings) `e chiamato ambiente o contesto di valutazione.

   The evaluator is a program that uses definitions to simplify (or alternatively reduce or evaluate) expressions.
  Il valutatore è un programma che usa le definizioni per semplificare (o alternativamente ridurre o valutare) le espressioni.

   There are simplification rules, called primitives, which are defined in the evaluator himself.
  Esistono delle regole di semplificazione, dette primitive, che sono definite nel valutatore stesso.

   Expressions containing primitive operations do not need context to be evaluated.
  Le espressioni che contengono operazioni primitive non hanno bisogno del contesto per essere valutate.

   The user interacts with the system by submitting expressions that the evaluator simplifies using the context and / or primitives.  Un insieme di legami (bindings) è chiamato ambiente o contesto di valutazione.
  L'utente interagisce col sistema sottoponendo delle espressioni che il valutatore semplifica utilizzando il contesto e/o le primitive.


~ o ~

§7. Sources and References for insights.
Fonti e riferimenti per approfondimenti.

    Listed below are some references to sources (websites, videos and book) that I have consulted during the writing of this article, and that you could also use to learn more about the topics covered in this article. 
  Di seguito sono elencati alcuni riferimenti a fonti (siti web, video e libri) che ho consultato durante la stesura di questo articolo e che potresti utilizzare anche tu per approfondire gli argomenti trattati in questo articolo. 
1. Imperative programming -- Wikipedia -- (link)
Programmazione imperativa -- Wikipedia
2. Functional programming -- arcetri.astro.it -- (link)
La programmazione funzionale -- arcetri.astro.it
3. Imperative and functional languages -- okpanico.wordpress -- (link)
Linguaggi imperativi e linguaggi funzionali -- okpanico.wordpress 4. Differences between functional programming and imperative programming -- Microsoft -- (link)
Differenze tra programmazione funzionale e programmazione imperativa -- Microsoft
5. What is functional programming? A practical guide -- InfoWorld (link)
Che cos'è la programmazione funzionale? Una guida pratica -- InfoWorld


~ o ~

§8. More generally.

Più in generale.


  In this article we have analyzed the "imperative" paradigm of programming for software development.

   But if you want to examine all the other interesting aspects of the Information Technology, then allow me to suggest you the reading of the following article which is the main one of the thematic area dedicated to this discipline, within TILLL~Encyclopedia (En).

  In questo articolo abbiamo analizzato il paradigma "imperativo" della programmazione per lo sviluppo del software

    Ma se vuoi approfondire tutti gli altri aspetti interessanti dell'Information Technology, allora permettimi di suggerirti la lettura del seguente articolo che è il principale dell'area tematica dedicata a questa disciplina, all'interno di TILLL~Encyclopedia (En)}


Computer Science and Information Technology

Informatica e Tecnologie dell’Informazione

(IT)


~ o ~

§9. Stay up to date.

Rimani aggiornato.


If you are interested in the topics covered in the current article and want to be updated on my latest compositions dealing with them, then I invite you to register 


on the Facebook page: 

Computer Science and Information Technology by Tateo's Interdisciplinary Lifelong Learning" (>)


and at the Pinterest dashboard: 

Computer Science and Information Technology by Tateo's Interdisciplinary Lifelong Learning" (>)


which I dedicated specifically for sharing the most recent changes made to the corresponding thematic area of Tateo~Learning (>).

Se sei interessato agli argomenti trattati nell'articolo corrente e vuoi essere aggiornato sulle mie ultime composizioni che trattano di essi, allora ti invito a registrarti.


alla pagina Facebook

Computer Science and Information Technology by Tateo's Interdisciplinary Lifelong Learning" (>)


ed alla bacheca Pinterest:

Computer Science and Information Technology by Tateo's Interdisciplinary Lifelong Learning" (>)


che ho dedicato appositamente per la condivisione delle modifiche più recenti apportate all'area tematica corrispondente di Tateo~Learning (>).



~ o ~

§10. Let's keep in touch.
Teniamoci in contatto.

  I hope you enjoyed this article, belonging to the Learning (>) section of the Tateo's Interdisciplinary Lifelong Learning (TILLL) project (>), and that the notes and observations I gathered within it meets your interests. 

  If you want stay tuned with the TILLL project evolution, then I invite you to follow the next upgrades that are published on the TILLL's Blog and on the social media pages dedicated to the TILLL community.


  Spero che questo articolo, appartenente alla sezione Learning (>) del progetto Tateo's Interdisciplinary Lifelong Learning (TILLL) (>), ti sia piaciuto e che le note e le osservazioni che ho raccolto al suo interno soddisfino i tuoi interessi. 

  Se vuoi rimanere aggiornato sull'evoluzione del progetto TILLL, allora ti invito a seguire i prossimi aggiornamenti che vengono pubblicati sul Blog di TILLL e sulle pagine social dedicate alla community TILLL.


  (>Tateo-Blogofficial blog of TILL project

  (>LinkedIn page dedicated to TILL project

  (>Facebook page dedicated to TILL project

  (>Twitter account dedicated to TILL project

  (>Pinterest account dedicated to TILL project

  (>Instagram account dedicated to TILL project



~ o ~

§11. Something about me, the founder and author of Tateo~Blog Project.
Qualcosa su di me, il fondatore e sull'autore del progetto Tateo~Blog.

First of all, thank you for visiting one of the pages of my blog. My name is Giovanni Battista Tateo (shortly Bat) and I am the founder and author of a project of Interdisciplinary Lifelong Learning of which the Tateo~Blog (:::) blog is the means of sharing. I was initially an Information Technology expert, and later I became an electronic engineer, specializing in industrial Automation. I'm passionate about Artificial intelligenceVirtual RealitySimulation, and I'm an expert in Artificial Vision applied to industrial Automation. Currently, and starting four years ago, I am employed as a Proposal Engineer at Mer Mec S.p.A. (:::) company. Previously, starting in 2004, I was employed, always at the same company, as a Designer of Artificial Vision Systems and Image Processing Algorithms, applied in particular to Railway Diagnostics. I am a supporter and promoter of Lifelong LearningSocial Networking and Knowledge Sharing by means of the web. If you want more details about me, visit the About Me (:::) page.

Innanzitutto ti ringrazio per aver visitato una delle pagine del mio blog. Mi chiamo Giovanni Battista Tateo (brevemente Bat) e sono il fondatore e l'autore di un progetto Lifelong Learning Interdisciplinare di cui il blog Tateo~Blog (:::) ne è il mezzo di condivisione. Sono stato in principio un esperto di Informatica, e in seguito sono diventato un Ingegnere Elettronico, specializzato in Automazione Industriale. Sono un appassionato di Intelligenza ArtificialeRealtà VirtualeSimulazione, e sono un esperto di Visione Artificiale applicata all'Automazione Industriale. Attualmente, ed a partire dall'anno 2016, sono impiegato come Proposal Engineer presso la società Mer Mec S.p.A. (:::). Precedentemente, a partire dal 2004, sono stato impiegato, sempre presso la stessa società, come Progettista di Sistemi di Visione Artificiale e di Algoritmi di Elaborazione delle Immagini, applicati in particolare alla Diagnostica Ferroviaria. Sono un sostenitore e promotore dell'apprendimento permanente, dei social network e della condivisione delle conoscenze tramite il web. Se vuoi ulteriori dettagli su di me, visita la pagine About Me (:::).


  References to contact me. Following you can find my personal references that you can use if you want to contact me directly, and the links to my social accounts that you can use to follow me or to keep in touch with me by means of social media networks.

  Riferimenti per contattarmi. In seguito puoi trovare i miei riferimenti personali che puoi utilizzare se vuoi contattarmi personalmente, ed i collegamenti ai miei account social che puoi utilizzare per seguirmi e rimanere in contatto con me tramite le reti di social media


Eng. Tateo Giovanni Battista

    - e-mail: tateogb@libero.it (send e-mail)

    - phone / WhatsApp : (+39) 388 8419726

    - Skype (link)

    - LinkedIn account (link)

    - Facebook account (link)

    - Twitter account (link)

    - Instagram account (link)

    - Pinterest account (link)


-----------------------------------------

Originally published May 21, 2015,

updated April 16, 2022 

into the Learning section of

TILLL

the Lifelong and Interdisciplinary Learning project of Giovanni Battista Tateo

Commenti