Monday, January 21, 2019

Intentional Programming

"Intentional Programming is a programming paradigm (Charles Simonyi, Microsoft) that encodes in the software source code the precise intention which the programmers ( or users) have in mind."

A Java program that writes numbers from 1 to 10 looks like this.

for (int i = 1; i <= 10; i++) {
    System.out.println("the number is " + i);
 }

However, this does not "does not capture the intentions of the programmer". A modified code would look like this.

for (int i = 1; i <= 10; i++) {
    System.out.println("Printing the numbers 1 to 10 " + i);
 }

TDD encourages intentional programming. You are able to state your intentions (via TDD) even before you code.



No comments:

Post a Comment

Generative AI for Everyone - Andrew NG - contd.

Generative AI for everyone - Andrew NG - Week 2 https://quality-agile.blogspot.com/2024/05/introduction-to-generative-ai-andrew-ng.html Fine...