View Full Document


Unformatted text preview:

Scala Your Next Programming Language or if it is good enough for Twitter it is good enough for me WORLDCOMP 2011 By Dr Mark C Lewis Trinity University Disclaimer I am writing a Scala textbook that is under contract with CRC Press I would do this tutorial anyway just because I like Scala that much Compiled Links http www cs trinity edu mlewis ScalaLinks html This is a collection of links for those who want more information on Scala How I got into Scala Grad schools and type systems Functional Programming and ML Interest in X10 and Fortress Basics of Scala Scalable Language Multi Paradigm Productivity of scripting languages Expressivity of functional languages Scalability of standard OO languages Speed of compiled statically typed languages All OO Highly Functional Static typing with local type inference Too Complex Reasons for perception Scala is different Functional isn t broadly known Scalability power Bloggers show cool examples Simpler in many ways Uniform syntax Shorter Language Specification Static Typed Language Spec Length pages Dynamic Typed Spec Length Language pages C C C Java VB NET Scala F 552 1325 553 684 597 191 250 Common LISP Ruby PHP JavaScript Python 3 1 Scheme 1153 341 244 252 119 50 Fewer Keywords http carlosqt blogspot com 2011 01 how many keywords in your source code html Past Complaints Documentation API Books Web resources Tools Improved IDE support Support Typesafe Current Challenges Compile Time Smart multipass compiler Optimization in progress Binary Compatibility Changes in traits require recompilation Uniform Style Many paradigms Need guidelines Tools coming Jobs Language Intro General rules All values are objects Operators are methods All expressions are valid statements Almost everything is an expression Declarations Begin with keyword val var def type class object trait Value parameters use Type parameters use Syntactic Sugar Semicolon inference Newlines become semicolons when it fits Explicit works too Operator notation Leave off dot and parens Methods with arity 0 or 1 Usage Methods REPL for simple tests Scripting for short programs Good for gluing things together Applications Declare object with main Model is much like Java Difference for Classes Take arguments No body required Code in body run at construction Special methods Symbols Property assignment apply update Case classes Object Declarations Creates singleton objects No static in Scala Companion objects Apply method commonly used for object construction No arguments Can inherit Traits Not interfaces Allow method implementations and data No arguments Can inherit from many Call order is linearized Key benefits Rich interfaces Extension of supertypes Type Hierarchy Collections Rich collection libraries Array List Set Map etc Multiple varieties Creation Companion object methods Mutable immutable fill tabulate Higher Order Methods map filter foreach Views Streams Standard Immutable Mutable Match Patterns Match is not just switch Cases can be patterns and bind

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...

Join to view Scala and access 3M+ class-specific study document.

We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Scala and access 3M+ class-specific study document.


By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?