Com S 541 Lecture -*- Outline -*- * Overview of Scala based on: Odersky et al.'s An Overview of the Scala Programming Language (EPFL Tech Rep. IC/2004/64) Odersky et al.'s The Scala Language Specification (version 1.0 of Oct 15, 2005) other documents at scala.epfl.ch ** Problems ------------------------------------------ PROBLEMS ADDRESSED BY SCALA - How to program Web Services? - How to support component-based systems? ------------------------------------------ *** web service programming ------------------------------------------ WHY WEB SERVICES? RPC doesn't scale to large systems - delay - failures (of message delivery) Web service answers: - performance: - increase granularity of data (XML) - failures: - replication of servers ==> avoid server state ==> tree transformation ------------------------------------------ Q: Why does increasing granularity of data help solve delay problems? instead of several round-trip small communications N * 2 * transmit-time have one larger one 1 * 2 * transmit-time (more done at client computer) Q: Why does replication of servers lead to desire to avoid server state? otherwise have locking and coherence problems, which causes delay Q: Why does avoiding server state lead to viewing programs as tree transformations? get in XML document, send one out *** component-based programming ------------------------------------------ WHY COMPONENTS? - Programming is too expensive - Programming is too error-prone - Programmers don't generally have the necessary domain knowledge Idea: reusable components solve these problems ------------------------------------------ Q: How do components help cut the costs of programming? Q: How the components help reduce errors in programming? Q: How do components help reduce the necessary domain knowledge? ** Approach ------------------------------------------ APPROACH TO SOLVING PROBLEMS For web services: - support XML tree transformations ==> functional programming idioms: - algebraic data types - pattern matching - list/sequence comprehensions - higher-order functions - lazy evaluation For component-based systems: - better composition mechanisms - better abstraction mechanisms want these to be scalable: ==> work same for small and large hypothesis: unify functional and OO programming type system innovation: - virtual types, path-dependent - symmetric mixin composition - external extensions using "views" ------------------------------------------ So the approach is somewhat like: Haskell meets (Java+traits) But instead of desugaring towards Haskell, the sugars go the other way, towards the object-oriented core