AirJD 焦点
AirJD

没有录音文件
00:00/00:00
加收藏

编程语言演变和趋势 by Paul Butcher

发布者 product
发布于 1466384419576  浏览 4597 关键词 行业报告 
分享到

第1页

Programming Language Trends

Paul Butcher



第2页

2016-4-



第10页

• Programming languages evolve over time • Evolution happens in “jumps” • The last “jump” was in the mid-1990s • Another big change is coming



第11页

Some history…



第12页

1979



第13页

1980



第14页

1981



第15页

1983



第16页

1984



第17页

1987



第18页

1988



第19页

TIOBE Index for February 2016



第20页

TIOBE Long Term History



第21页

When the language was created



(1995) (1995) (1995) (1991) (2000) (1985) (1995) (1996) (1972) (1983)



Something big happened in the mid-1990s!

(The Web)



RedMonk Rankings June 2015



第22页

(1987) (1971) (1993) (2004) (2009) (1990) (1984) (2014) (2007) (2003) (1964/2001)



Something big is happening again

(but what is it?)



RedMonk Rankings June 2015



第23页

This is what the programming world looked like in 2010 (according to RedMonk)



第24页

This is what it looked like in 2015



第25页

Watch how these languages move

over time



第27页

These languages didn’t even exist in 2010



第28页

These languages all support functional programming



第29页

These are all JavaScript alternatives



第30页

These are all JavaScript alternatives

(plus languages that compile to JS)



第31页

These all support parallelism or concurrency



第32页

• Client-side Web programming • Functional programming • Concurrent/Parallel programming



第33页

Sequential Sum in Java

public int sum(int[] numbers) {

int accumulator = 0; for (int n: numbers)

accumulator += n; return accumulator; }



第34页

Sequential Sum in Clojure

(defn sum [numbers] (reduce + numbers))



第35页

Parallel Sum in Clojure

(defn sum [numbers] (fold + numbers))



第36页

public class WordCount {



Parallel Word Count in Java



private static final int NUM_COUNTERS = 4;



public static void main(String[] args) throws Exception { ArrayBlockingQueue<Page> queue = new ArrayBlockingQueue<Page>(100); ConcurrentHashMap<String, Integer> counts = new ConcurrentHashMap<String, Integer>(); ExecutorService executor = Executors.newCachedThreadPool();



for (int i = 0; i < NUM_COUNTERS; ++i) executor.execute(new Counter(queue, counts));

Thread parser = new Thread(new Parser(queue)); parser.start(); parser.join(); for (int i = 0; i < NUM_COUNTERS; ++i)

queue.put(new PoisonPill()); executor.shutdown(); executor.awaitTermination(10L, TimeUnit.MINUTES); } }



第37页

Parallel Word Count in Java (continued)

class Parser implements Runnable { private BlockingQueue<Page> queue; public Parser(BlockingQueue<Page> queue) { this.queue = queue; } public void run() { try { Iterable<Page> pages = new Pages(100000, "enwiki.xml"); for (Page page: pages) queue.put(page); } catch (Exception e) { e.printStackTrace(); } }

}



第38页

Parallel Word Count



class Counter implements Runnable { private BlockingQueue<Page> queue;



in Java (continued)



private ConcurrentMap<String, Integer> counts;



private HashMap<String, Integer> localCounts;



public Counter(BlockingQueue<Page> queue, ConcurrentMap<String, Integer> counts) {

this.queue = queue; this.counts = counts; localCounts = new HashMap<String, Integer>(); }



public void run() { try { while(true) { Page page = queue.take(); if (page.isPoisonPill()) break; Iterable<String> words = new Words(page.getText()); for (String word: words) countWord(word); } mergeCounts(); } catch (Exception e) { e.printStackTrace(); }

}



第39页

private void countWord(String word) { Integer currentCount = localCounts.get(word); if (currentCount == null) localCounts.put(word, 1); else localCounts.put(word, currentCount + 1);

}



Parallel Word Count in Java (continued)



private void mergeCounts() { for (Map.Entry<String, Integer> e: localCounts.entrySet()) { String word = e.getKey(); Integer count = e.getValue(); while (true) { Integer currentCount = counts.get(word); if (currentCount == null) { if (counts.putIfAbsent(word, count) == null) break; } else if (counts.replace(word, currentCount, currentCount + count)) { break; } } }

} }



第40页

Parallel Word Count in Clojure

(defn count-words-sequential [pages] (frequencies (mapcat get-words pages)))

(defn count-words [pages] (reduce (partial merge-with +) (pmap count-words-sequential (partition-all 100 pages))))

(defn -main [& args] (count-words (take 100000 (get-pages "enwiki.xml"))))



第41页

Which language will “win”?

?



第42页

What does this mean for you?

• Learn a new language • Learn another new language • Learn functional programming • Learn concurrent/parallel programming



支持文件格式:*.pdf
上传最后阶段需要进行在线转换,可能需要1~2分钟,请耐心等待。