Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Trends in Programming Technologyyou might want to keep an eye on              Bent Thomsen              bt@cs.aau.dk      ...
2Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
3Source: http://langpop.com
Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html                                                  ...
Conclusions• Nothing has changed much• Main languages have their domain   –   Java – for web applications   –   C – for sy...
Web-based applications today          Presentation: HTML, CSS, Javascript, Flash,          Java applets, ActiveX controls,...
The Hardware world is changing!                         7
Moore’s Law• Popular belief:  – Moore’s Law stopped working in 2005!• Moore’s Law (misinterpreted):  – The processor speed...
The IT industry wakeup call• The super computing community  discovered the change in hardware first• The rest of the compu...
A programmer’s view of memory This model was pretty accurate in 1985. Processors (386, ARM, MIPS, SPARC) all ran at 1–10MH...
A modern view of memory timingsSo what happened?On-chip computation (clock-speed) sped upfaster (1985–2005) than off-chip ...
The Current Mainstream ProcessorWill scale to 2, 4 maybe 8 processors.But ultimately shared memory becomes the bottleneck ...
Programming model(s) reflecting    the new world are called for• Algorithm should do most work on local data !!• Programme...
Which languages are discussed?                             14Source: http://langpop.com
15Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
Three Trends• Declarative programming languages in  vogue again  – Especially functional• Dynamic Programming languages ar...
Declarative Programming• Lots of talk about declarative languages:  – Haskell  – Scheme, Lisp, Clojure  – F#, O’Caml, SML ...
What do we mean by           declarative/functional?• Say what you want, without saying how    – Not quite true – more a q...
Mainstream programming is going          declarative  Four years ago Anders Heilsberg (designer of C#) said:   ``Generally...
Name the language...                                                         C# 3.0• Quicksort revisited            parame...
C# 3.0 Language Extensions                                                   Query                 var contacts =         ...
C# 3.0 Features–   Implicitly Typed Local Variables–   Lambda Expressions–   Anonymous Types–   Expression Trees–   Query ...
F#• A .NET language (developed by Don Syme)   – Connects with all Microsoft foundation technologies   – 3rd official MS la...
F# on one slide    NOTE: type inferred        •   let data = (1,2,3)                                                      ...
Beyond Java"A Conversation With Guy Steele Jr."Dr. Dobbs Journal (04/05) Vol. 30, No. 4, P. 17; Woehr, Jack J.Guy Steele t...
Fortress• One of the three languages DARPA spent 1BN$ on     – Actually SUN only got 49.7M$ (IBM and CRAY got the rest)•  ...
“Advances” in Syntax• Extensible syntax – follows Guy Stell’s vision of  “Growing a language”  – The only language I know ...
Scala• Scala is an object-oriented and functional language which is  completely interoperable with Java    – Developed by ...
Scala is Object Oriented                                                         object instead of                        ...
Scala is functional sequences                        Arrays are instancesArray which                         map is a meth...
Scala’s approach• Scala applies Tennent’s design principles:  – concentrate on abstraction and composition    capabilities...
Clojure• Concurrent Lisp like language on JVM  – Developed by Rich Hickey• Everything is an expression, except:  – Symbols...
Java vs. Clojure                   33
Dynamic Programming• Lots of talk about dynamic languages  –   PhP, Perl, Ruby  –   JavaScript  –   Lisp/Scheme  –   Erlan...
35
36
Dynamic Language characteristics• (Perceived) to be less verbose     – Comes with good libraries/frameworks•   Interpreted...
Dynamic Programming in C# 4.0– Dynamic Lookup  • A new static type called: dynamic  • No static typing of operations with ...
Concurrent Programming• Lots of talk about Erlang• Fortress, X10 and Chapel• Java.util.concurrency• Actors in Scala• Cloju...
The problem with Threads• Threads  –   Program counter  –   Own stack  –   Shared Memory  –   Create, start (stop), yield ...
Several directions• (Software) Transactional Memory  – Enclose code in begin/end blocks or atomic    blocks  – Variations ...
Message Passing/Actors– Erlang– Scala Actors– F#/Axum                     42
Theoretical Models•   Actors•   CSP•   CCS•   pi-calculus•   join-calculus• All tried and tested in many languages  over t...
Problems with Actor like models• Actors (Agents, Process or Threads) are not free• Message sending is not free• Context sw...
Other concurrency models• Dataflow   – Stream Processing Functions• Futures• Tuple Spaces• Stop gap solutions based on par...
Other trends worth watching•   Development methods     –   Away from waterfall, top-down     –   Towards agile/XP/Scrum   ...
Implications for real-time• New ways of programming is back on the  agenda• But ..   – C as popular as ever!!   – ADA is s...
What about all the new declarative       and dynamic stuff?• Higher Order Programming  – Elegant programming styles  – Har...
Promises for real-time• New ways of programming is back on the agenda• Understanding of HW has (again) become necessary• S...
So how would you like toprogramme in 20 years?                   50
How would you like to program in 20 years?• Research project (codename P2025)  – Reviewing the state-of-the-art  – Experim...
Approach• Basic Research (Grundforskning) – someone has to do it  …• We want to influence the next generation of mainstrea...
Bent Thomsen•   MSc. (Cand. Scient) in CS and maths, AAU, 1981-1987     – Modal transition systems•   PhD Computing, Imper...
Some of my Background KnowledgeMapping and Visiting in Functional and Object Oriented ProgrammingKurt Nørmark, Bent Thomse...
Some of my Background Knowledge“Towards Global Computations Guided by Concurrency Theory”,Bent Thomsen and Lone Leth,in Ch...
Upcoming SlideShare
Loading in …5
×

Trends in Programming Technology you might want to keep an eye on af Bent Thomsen, AAU

5,817 views

Published on

Oplægget blev holdt ved et seminar i InfinIT-interessegruppen Højniveau sprog til indlejrede systemer den 11. november 2009.
Læs mere om interessegruppen på http://www.infinit.dk/dk/interessegrupper/hoejniveau_sprog_til_indlejrede_systemer/

Published in: Technology
  • Be the first to comment

Trends in Programming Technology you might want to keep an eye on af Bent Thomsen, AAU

  1. 1. Trends in Programming Technologyyou might want to keep an eye on Bent Thomsen bt@cs.aau.dk Department of Computer Science Aalborg University 1
  2. 2. 2Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  3. 3. 3Source: http://langpop.com
  4. 4. Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html 4October 2009
  5. 5. Conclusions• Nothing has changed much• Main languages have their domain – Java – for web applications – C – for system programming – (Visual) Basic – for desktop windows apps – PHP for serverside scripting – C++ when Java is (perceived) too slow• We can go home now• Wait a minute!• Something is changing – Software is getting more and more complex – Hardware has changed 5
  6. 6. Web-based applications today Presentation: HTML, CSS, Javascript, Flash, Java applets, ActiveX controls, Silverlight Application server Web server Content management system Business logic: C#, Java, VB, PHP, Perl, Python,Ruby … Beans, servlets, CGI, ASP.NET,… Operating System Database: SQL Sockets, HTTP, email, SMS, XML, SOAP, File system REST, Rails, reliable Replication, distribution, messaging, AJAX, … load-balancing, security, 6 concurrency
  7. 7. The Hardware world is changing! 7
  8. 8. Moore’s Law• Popular belief: – Moore’s Law stopped working in 2005!• Moore’s Law (misinterpreted): – The processor speed doubles every 18 months• Moore’s Law still going strong – the number of transistors per unit area on a chip doubles every 18 months• Instead of using more and more HW real-estate on cache memory it is now used for multiple cores 8
  9. 9. The IT industry wakeup call• The super computing community discovered the change in hardware first• The rest of the computing industry are in for an eye-opener soon!• Some have started to worry“Multicore: This is the one which will have the biggest impact on us.We have never had a problem to solve like this.A breakthrough is needed in how applications are done on multicore devices.”– Bill Gates 9
  10. 10. A programmer’s view of memory This model was pretty accurate in 1985. Processors (386, ARM, MIPS, SPARC) all ran at 1–10MHz clock speed and could access external memory in 1 cycle; and most instructions took 1 cycle. Indeed the C language was as expressively time-accurate as a language could be: almost all C operators took one or two cycles. But this model is no longer accurate! 10
  11. 11. A modern view of memory timingsSo what happened?On-chip computation (clock-speed) sped upfaster (1985–2005) than off-chip communication (with memory) as featuresizes shrank.The gap was filled by spending transistor budget on caches which(statistically) filled the mismatch until 2005 or so.Techniques like caches, deep pipelining with bypasses, andsuperscalar instruction issue burned power to preserve our illusions.2005 or so was crunch point as faster, hotter, single-CPU Pentiumswere scrapped. These techniques had delayed the inevitable. 11
  12. 12. The Current Mainstream ProcessorWill scale to 2, 4 maybe 8 processors.But ultimately shared memory becomes the bottleneck (1024 processors?!?). 12
  13. 13. Programming model(s) reflecting the new world are called for• Algorithm should do most work on local data !!• Programmers need to – know what is local and what is not – need to deal with communication – make decisions on parallel execution• But how can the poor programmer ensure this?• She/he has to exploit: – Data Parallelism – Task parallelism• She/he needs programming language constructs 13 to help her/him
  14. 14. Which languages are discussed? 14Source: http://langpop.com
  15. 15. 15Source: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  16. 16. Three Trends• Declarative programming languages in vogue again – Especially functional• Dynamic Programming languages are gaining momentum• Concurrent Programming languages are back on the agenda 16
  17. 17. Declarative Programming• Lots of talk about declarative languages: – Haskell – Scheme, Lisp, Clojure – F#, O’Caml, SML – Scala, Fortress• Lots of talk about declarative constructs in traditional languages – C# 17
  18. 18. What do we mean by declarative/functional?• Say what you want, without saying how – Not quite true – more a question of saying how implicitly• Functions as first class entities• Lazy or(/and) eager evaluation• Pure vs. impure• Value oriented (vs. state oriented)• Pattern matching• Generics (or parametric polymorphism) 18
  19. 19. Mainstream programming is going declarative Four years ago Anders Heilsberg (designer of C#) said: ``Generally speaking, its interesting to think about more declarative styles of programming vs. imperative styles. ... Functional programming languages and queries are actually a more declarative style of programming. ``programmers have to unlearn .. and to learn to trust that when theyre just stating the ``what The machine is smart enough to do the ``how the way they want it done, or the most efficient way. - Anders Hejlsberg 19
  20. 20. Name the language... C# 3.0• Quicksort revisited parameterized type of functions Func<intlist, intlist> Sort = xs => higher-order function xs.Case( lambda expression () => xs, (head,tail) => (Sort(tail.Where(x => x < head))) .Concat (Single(head)) append type inference .Concat (Sort(tail.Where(x => x >= head))) ); filter recursion 20
  21. 21. C# 3.0 Language Extensions Query var contacts = expressions from c in customers where c.State == "WA"Local variable select new { c.Name, c.Phone };type inference Lambda expressions var contacts = customers .Where(c => c.State == "WA") .Select(c => new { c.Name, c.Phone });Extensionmethods Anonymous Object types initializers 21
  22. 22. C# 3.0 Features– Implicitly Typed Local Variables– Lambda Expressions– Anonymous Types– Expression Trees– Query Expressions– Extension Methods– Object Initializers– Collection Initializers– Iterators– Lazy streams– Nullable value types– C# 2.0 already have: • Generics • Structured Value Types • First class anonymous functions (called delegates) 22
  23. 23. F#• A .NET language (developed by Don Syme) – Connects with all Microsoft foundation technologies – 3rd official MS language shipped with VS2010• Aims to combine the best of Lisp, ML, Scheme, Haskell, in the context of .NET – Actually based on O’Caml• Functional, math-oriented, scalable• Aimed particularly at the "Symbolic Programming" niche at Microsoft 23
  24. 24. F# on one slide NOTE: type inferred • let data = (1,2,3) val data: int * int * int • let sqr x = x * x val sqr: int -> int • let f (x,y,z) = (sqr x, sqr y, sqr z) NOTE: parentheses optional on • let sx,sy,sz = f (10,20,30) applicationNOTE: • print "hello world"; 1+2 NOTE: sequencingpatternmatching• let show x y z = • printf "x = %d y = %d y = %d n" x y z; • let sqrs= f (x,y,z) in • print "Hello worldn"; • sqrs NOTE: local binding, sequencing, return • let (|>) x f = f x NOTE: pipelining operator 24
  25. 25. Beyond Java"A Conversation With Guy Steele Jr."Dr. Dobbs Journal (04/05) Vol. 30, No. 4, P. 17; Woehr, Jack J.Guy Steele theorizes that programming languages arefinite, and argues that the time is right for a successorto Java, which has another two decades of life left. Sunis investigating whether aligning programminglanguages more closely to traditional mathematicalnotation can reduce the burden for scientificprogrammers Guy Steele co-wrote the original Java specifications and in 1996 was awarded the ACM SIGPLAN Programming Language Achievement Award. Steele is a distinguished engineer and principal investigator at Sun Microsystems Laboratories, where he heads the companys25 Programming Language Research Group.
  26. 26. Fortress• One of the three languages DARPA spent 1BN$ on – Actually SUN only got 49.7M$ (IBM and CRAY got the rest)• First class higher order functions• Type inference• immutable and mutable variables• Traits – Like Java interfaces with code, classes without fields• Objects – Consist of fields and methods• Designed to be parallel unless explicit sequential – For loops and generators, tuples – Transactional Memory – PGAS (Partitioned Global Address Space)• Runs on top of the JVM 26
  27. 27. “Advances” in Syntax• Extensible syntax – follows Guy Stell’s vision of “Growing a language” – The only language I know with overloadable whitespace! – Syntax based on Parsing Expression Grammars (PEG)• Syntax resembling mathematical notation 27
  28. 28. Scala• Scala is an object-oriented and functional language which is completely interoperable with Java – Developed by Martin Odersky, EPFL, Lausanne, Switzerland• Uniform object model – Everything is an object – Class based, single inheritance – Mixins and traits – Singleton objects defined directly• Higher Order and Anonymous functions with Pattern matching• Genericity• Extendible – All operators are overloadable, function symbols can be pre-, post- or infix – new control structures can be defined without using macros 28
  29. 29. Scala is Object Oriented object instead of var: Type instead of Type var static membersScala programsinteroperate seamlessly object Example1 {with Java class libraries: def main(args: Array[String]) { – Method calls – Field accesses val b = new StringBuilder() – Class inheritance for (i ← 0 until args.length) { – Interface implementation if (i > 0) b.append(" ")all work as in Java. b.append(args(i).toUpperCase)Scala programs compile to }JVM bytecodes. Console.println(b.toString)Scala’s syntax resembles }Java’s, but there are also }some differences. Scala’s version of the extended for loop Arrays are indexed (use <- as an alias for ←) args(i) instead of args[i] 29
  30. 30. Scala is functional sequences Arrays are instancesArray which map is a method of of with map and mkString methods. applies the function on its right to each array element.The last program can object Example2 {also def main(args: Array[String]) {be written in a println(args map (_.toUpperCase)completely mkString " ")different style: } }– Treat arrays as instances of general sequence abstractions. A closure which applies the mkString is a method of Array which to its toUpperCase method– Use higher-order forms a string of all elementsargument String with a functions instead of given separator between them. loops. 30
  31. 31. Scala’s approach• Scala applies Tennent’s design principles: – concentrate on abstraction and composition capabilities instead of basic language constructs – Minimal orthogonal set of core language constructs• But it is European  31
  32. 32. Clojure• Concurrent Lisp like language on JVM – Developed by Rich Hickey• Everything is an expression, except: – Symbols – Operations (op ...) – Special operations: • def if fn let loop recur do new . throw try set! quote var• Code is expressed in data structures• Functions are first-class values• Clojure is homoiconic 32
  33. 33. Java vs. Clojure 33
  34. 34. Dynamic Programming• Lots of talk about dynamic languages – PhP, Perl, Ruby – JavaScript – Lisp/Scheme – Erlang – Groovy – Clojure – Python • jPython for JVM and IronPyhon for .Net• Real-programmers don’t need types 34
  35. 35. 35
  36. 36. 36
  37. 37. Dynamic Language characteristics• (Perceived) to be less verbose – Comes with good libraries/frameworks• Interpreted or JIT to bytecode• Eval: string -> code• REPL style programming• Embeddable in larger applications as scripting language• Supports Higher Order Function!• Object oriented – JavaScript, Ruby and Python – Based on Self resp. SmallTalk• Meta Programming made easier 37
  38. 38. Dynamic Programming in C# 4.0– Dynamic Lookup • A new static type called: dynamic • No static typing of operations with dynamic • Exceptions on invalid usage at runtime dynamic d = GetDynamicObject(…); d.M(7); // calling methods d.f= d.P; // getting and settings fields and properties d[“one”] = d[“two”]; // getting and setting thorughindexers Int i= d + 3; // calling operators string s = d(5,7); // invoking as a delegate– Optional and Named Parameters– COM interop features– (Co-and Contra-variance) 38
  39. 39. Concurrent Programming• Lots of talk about Erlang• Fortress, X10 and Chapel• Java.util.concurrency• Actors in Scala• Clojure• C omega• F# - Accelerator on GPU• .Net Parallel Extensions 39
  40. 40. The problem with Threads• Threads – Program counter – Own stack – Shared Memory – Create, start (stop), yield ..• Locks – Wait, notify, notifyall – manually lock and unlock • or implicit via synchronized – lock ordering is a big problem – Not compositional 40
  41. 41. Several directions• (Software) Transactional Memory – Enclose code in begin/end blocks or atomic blocks – Variations • specify manual abort/retry • specify an alternate path (way of controlling manual abort) – Java STM2 library – Clojure, Fortress, X10, Chapel 41
  42. 42. Message Passing/Actors– Erlang– Scala Actors– F#/Axum 42
  43. 43. Theoretical Models• Actors• CSP• CCS• pi-calculus• join-calculus• All tried and tested in many languages over the years, but … 43
  44. 44. Problems with Actor like models• Actors (Agents, Process or Threads) are not free• Message sending is not free• Context switching is not free• Still need Lock acquire/release at some level and it is not free• Multiple actor coordination – reinvent transactions? – Actors can still deadlock and starve – Programmer defines granularity by choosing what is an actor 44
  45. 45. Other concurrency models• Dataflow – Stream Processing Functions• Futures• Tuple Spaces• Stop gap solutions based on parallelised libraries• Lots of R&D (again) in this area!!! 45
  46. 46. Other trends worth watching• Development methods – Away from waterfall, top-down – Towards agile/XP/Scrum – Refactoring – Frameworks, Patterns – test-driven-development• Tools – Powerful IDEs with plug-ins – Frameworks – VM and OS integrations • MS PowerShell, v8 in Android• Programming Language construction is becoming easier – Extendible Open (source) Compilers for most mainstream languages – AST (or expression trees in C#/F# and Fortress) – Generic code generators – Parsing Expression Grammars (PEG) 46
  47. 47. Implications for real-time• New ways of programming is back on the agenda• But .. – C as popular as ever!! – ADA is still around • No. 10 in list of languages talked about • No. 20 on skills in jobs advertised – Java still most popularity (albeit declining a little) • The only modern language serious about hard-real time! 47
  48. 48. What about all the new declarative and dynamic stuff?• Higher Order Programming – Elegant programming styles – Harder to analyse control flow – Usually imply use of GC• Dynamic Programming – Lots of run-time checks – Harder to analyse type violations• Frameworks written for average-time performance, not worst case analysis• VM technology is improving a lot – But special VMs are needed for RT 48
  49. 49. Promises for real-time• New ways of programming is back on the agenda• Understanding of HW has (again) become necessary• Semantics is back on the agenda – SOS/Calculi for Fortress, Scala, F# – Advanced type systems and type inference• Program Analysis and verification – JML and SPEC# (Design by contract) – SPIN, Blast, UPPAAL – ProVerif (Microsoft) – JavaPathfinder (NASA, Fujitsu) – WALA (IBM) osv. 49
  50. 50. So how would you like toprogramme in 20 years? 50
  51. 51. How would you like to program in 20 years?• Research project (codename P2025) – Reviewing the state-of-the-art – Experimenting with advanced programming • Functional and OO integration • Programmatic Program Construction – Developing a new programming language• ”The P-gang”: • Kurt Nørmark • Lone Leth • Bent Thomsen • Simon Kongshøj • (Petur Olsen og Thomas Bøgholm) • (Thomas Vestdam) 51
  52. 52. Approach• Basic Research (Grundforskning) – someone has to do it …• We want to influence the next generation of mainstream programming languages• Integration playground for new language ideas• Constructive: design and implement – languages and compilers – Experimental systems• Openness and open source• Umbrella covering the research work of the group in coming years – Research, Master Thesis (speciale), DAT7/8 and PhD 52• Several Master Student projects already done
  53. 53. Bent Thomsen• MSc. (Cand. Scient) in CS and maths, AAU, 1981-1987 – Modal transition systems• PhD Computing, Imperial College, 1987-1990 – Calculus of Higher Order Concurrent systems• European Computer Manufacturers Research Centre, Munich, 1990-1996 – Facile programming language – Calumet teleconferencing – Mobile service Agents• ICL (now Fujitsu), 1996-2002 – Agent programming – Mobile Enabling ICL• AAU, DPT, 2002-(2025??) – Programming – Compiler construction and language design – Mobile Software Technologies – Super Computer Programming – Hard-real time programming in Java – Indoor location based systems – P2025 53
  54. 54. Some of my Background KnowledgeMapping and Visiting in Functional and Object Oriented ProgrammingKurt Nørmark, Bent Thomsen, and Lone Leth ThomsenJOT: Journal of Object Technologyhttp://www.jot.fm/issues/issue_2008_09/article2/index.htmlComputational Abstraction StepsKurt Nørmark, Bent Thomsen, and Lone Leth ThomsenSubmitted for publication in JOT: Journal of Object TechnologyTowards Transactional Memory for Real-Time Systems.Martin Schoberl, Bent Thomsen and Lone Leth ThomsenTechnical report. 09-001 Department of Computer Science, AAU, 2009 54
  55. 55. Some of my Background Knowledge“Towards Global Computations Guided by Concurrency Theory”,Bent Thomsen and Lone Leth,in Chapter 4, in Current Trends in Theoretical Computer Science,Entering the 21st century, G. Paun, G. Rozenberg and A. Salomaa (Editors),World Scientific Publishing, 2001.“Programming Languages, Analysis Tools and Concurrency Theory”,Bent Thomsen,ACM Computing Surveys 28A(4), December 1996.(http://www.acm.org/pubs/articles/journals/surveys/1996-28-4es/a57- thomsen/a57-thomsen.html)“FACILE - from Toy to Tool”,Bent Thomsen, Lone Leth and Tsung-Min Kuo,Chapter 5 in ML with Concurrency: Design, Analysis, Implementation, and Application,Flemming Nielson (Editor), Springer- Verlag, 1996. 55

×