Why the Next Five Years Will Be About Languages

Question

The question everybody asks is always the same:

What will be

the Next Big Thing (tm)

in our Industry?

Question

... which is usually just a mask for the real question:

What do I need to learn

to avoid being laid off

for the next decade?

Answer

I believe...

We stand on the threshold of a Renaissance in programming languages

Meaning the next N years will be all about:

History

A brief discussion

History

Programming language design has historically been split into two camps:

History

Academics

History

Practitioners

History

For the most part, these two groups have been uninterested in working together

In fact, they've been downright hostile towards one another

History

Practitioners complain that Academics...

History

Which means that Academic languages...

History

Which means that the feedback loop is broken

The Forces

Why it's different now

The Forces

Four Forces have come together into a perfect storm

The Forces

Virtualization

The same is true for language designers

The Forces

Tools

The Forces

Services/microservices

The Forces

Linguistics

The Forces

Linguistics

The Forces

Linguistics

Practicum

An example of the benefits of a polytechnical mindset

Practicum

Consider the Haskell concept of a list

  let numbers = [ 1, 2, 3 ]

Practicum

We can do a few things with a list

  let headOfList = head numbers
  print headOfList        {- 1 -}
    
  let lastNumber = last numbers
  print lastNumber        {- 3 -}
    
  let tailOfList = tail numbers
  print tailOfList        {- [2, 3] -}
    
  let takeSomeOfList = take 2 numbers 
  print takeSomeOfList    {- [1, 2] -}

Practicum

We can create a list out of a range of values

  let numberRange = [1..100]
  print numberRange {- [1, 2, 3, ... , 99, 100] -}
    
  let evens = [2, 4..100]
  print evens       {- [2, 4, 6, ... , 98, 100] -}

Practicum

We can create a list out of code

  let otherEvens = [x | x <- [1..10]]
  print otherEvens
    
  let squares = [x*x | x <- [1..10]]
  print squares
    
  let fizzBuzz = [ if x `mod` 5 == 0 then "BUZZFIZZ"
        else
          if x `mod` 3 == 0 then "BUZZ" 
          else
            if x `mod` 4 == 0 then "FIZZ" else show x 
            | x <- [1..25]]
  print fizzBuzz

Practicum

We can even create an infinite list

  let forever = [1..]
  {- printing forever is a bad idea.... -}
    
  let foreverLove = cycle ["LOVE"]
  print $ take 3 foreverLove {- ["LOVE", "LOVE", "LOVE"] -}

Practicum

What a silly idea... Infinite lists

I mean, who ever would have a collection that goes on forever?

What kind of list goes on forever?

Practicum

Haskell calls these infinite lists "streams", by the way

Practicum

What if we had a Java Iterator... without a Collection?

Practicum

An "evens" for-comprehension, in Java

class EvensToAHundredComprehensionIterator 
    implements Iterable<Integer> {
  public Iterator<Integer> iterator() {
    return new Iterator<Integer>() {
      int count = 0;
      public boolean hasNext() { return count <= 100; }
      public Integer next() {
        if (count % 2 == 0) return count++;
        else {
          count++;
          return next();
        }
      }
      public void remove() { }
    };
  }
}

Practicum

Using it in Java

    for (int val : new EvensToAHundredComprehensionIterator()) {
      System.out.print(val + "..");
    }
    System.out.println();

Practicum

How about an Iterator that knows how to read a file?

class FileIterator implements Iterable<String> {
  BufferedReader br;
    
  private FileIterator(BufferedReader br) {
    this.br = br;
  }
  public static FileIterator open(String filename)
    throws IOException {
      FileReader fr = new FileReader(filename);
      BufferedReader br = new BufferedReader(fr);
      return new FileIterator(br);
  }

Practicum

How about an Iterator that knows how to read a file?

  public Iterator<String> iterator() {
    Iterator<String> ret = new Iterator<String>() {
      String line = null;
      public boolean hasNext() {
        return line != null;
      }
      public String next() {
        String result = line;
        try { line = br.readLine(); }
        catch (IOException ioEx) { line = null; }
        return result;
      }
      public void remove() { }
    };
    ret.next();
    return ret;
  }
}

Practicum

How about an Iterator that knows how to read a file?

    for (String line : FileIterator.open("./ItWithoutColl.java")) 
    {
      System.out.println("FOUND>>> " + line);
    }

Practicum

Gong down this path leads you to a number of interesting things... some of which were captured in Guava

... and some of which were captured in Java8

Practicum

But think about infinite streams again for a second

Practicum

But think about infinite streams again for a second

... what if we think about external events as streams?

... and our responses to those events as functions?

Practicum

Congratulations

Practicum

Congratulations

... for you have just taken your first steps to understanding

Challenges and Responses

A look....

Challenges and Responses

Challenges

The problems we face are very different from a few years ago

Challenges and Responses

Responses

And the industry has already started to respond!

Jolie: An Overview

What is this thing?

Jolie: An Overview

In Brief

Jolie: An Overview

From the Jolie docs:

"More in general, Jolie brings a structured linguistic approach to the programming of services, including constructs for access endpoints, APIs with synchronous and asynchronous operations, communications, behavioural workflows, and multiparty sessions. Additionally, Jolie embraces that service and microservice systems are often heterogeneous and interoperability should be a first-class citizen: all data in Jolie is structured as trees that can be semi-automatically (most of the time fully automatically) converted from/to different data formats (JSON, XML, etc.) and communicated over a variety of protocols (HTTP, binary protocols, etc.). Jolie is an attempt at making the first language for microservices, in the sense that it provides primitives to deal directly with the programming of common concerns regarding microservices without relying on frameworks or external libraries."

Challenges and Responses

Hello Jolie

type HelloRequest {
	name:string
}

interface HelloInterface {
requestResponse:
	hello( HelloRequest )( string )
}

service HelloService {
	execution: concurrent

	inputPort HelloService {
		location: "socket://localhost:9000"
		protocol: http { format = "json" }
		interfaces: HelloInterface
	}

	main {
		hello( request )( response ) { 
			response = "Hello " + request.name
		}
	}
}

The Wing Programming Language

... in a nutshell

The Wing Programming Language

What is it?

The Wing Programming Language

bring cloud;

let q = new cloud.Queue();
let b = new cloud.Bucket() as "Bucket: Last Message";

q.addConsumer(inflight (m: str) => {
    b.put("latest.txt", m);
});

new cloud.Function(inflight (s: str) => {
    log("Cloud Function was called with ${s}");
    q.push(s);
});

Inform

A human-friendly language for interactive fiction

Inform

Inform

Inform

Example Inform7 code


Before taking the crate:
    if the player is wearing the hat:
        now the hat is in the crate;
        say "As you stoop down, your hat falls into the crate.“

Inform

Literate Programming

Challenges and Responses

More responses!

It's easier than ever to design your own

You can build a toy language in a week; a substantive one, in months

Challenges and Responses

More responses!

Or take an existing language and mod it

Challenges and Responses

Consider... Scala

select (
  "age" is smallint,
  "name" is clob,
  "salary" is int )
from ("persons" naturalJoin "employees")
where (
  "gender" == "M" and
  ("city" == "Seattle" or "city" == "Geneva"))
orderBy "age"

Challenges and Responses

Or... Javascript + XML (e4x)

// Use an XML literal to create an XML object
var order = <order>
  <customer>
    <firstname>John</firstname>
    <lastname>Doe</lastname>
  </customer>
  <item>
    <description>Big Screen Television</description>
    <price>1299.99</price>
    <quantity>1</quantity>
  </item>
</order>

// Construct the full customer name
var name = order.customer.firstname + " " + order.customer.lastname;

// Calculate the total price
var total = order.item.price * order.item.quantity;

Challenges and Responses

How "real" are these languages?

Challenges and Responses

Challenges and Responses

Challenges and Responses

Adoption

But.... wait....

Adoption

"I Want to Use This..."

Adoption

"... but my boss won't let me!"

Adoption

"... but my team won't let me!"

Adoption

"... but what if I'm wrong?!?"

Summary

Wrapping up

Summary

Languages, languages, languages

Summary

Remember:

Tools were meant to serve the human; not the other way around

So should it be for programming languages