Artūras Šlajus VS through eyes of Ruby programmer.

Slides:



Advertisements
Similar presentations
Bean Scripting Framework.. What is Scripting Language Broader definition: all languages Narrower definition: those programming languages requiring no.
Advertisements

7-Jun-14 Lists. Arrays and Lists Arrays are a fixed length and occupy sequential locations in memory This makes random access (for example, getting the.
Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.
Language of the Month If it’s December, it must be Ruby! Adam Coffman and Brent Beer.
1 CS 312 – Lecture 28 Continuations –Probably the most confusing thing you’ve seen all semester… Course summary –Life after CS 312.
Chapter 3.2 C++, Java, and Scripting Languages. 2 C++ C used to be the most popular language for games Today, C++ is the language of choice for game development.
A guide to modern languages and interesting concepts for the busy Java programmer Cedric Beust Google Jazoon 2008, Zurich.
How to Create a Java program CS115 Fall George Koutsogiannakis.
Chapter 3.2 C++, Java, and Scripting Languages “The major programming languages used in game development.”
Programming 1 Feedback Session. The unit has improved my understanding of programming. 1.Strongly Agree 2.Agree 3.Neutral 4.Disagree 5.Strongly Disagree.
3-1 3 Compilers and interpreters  Compilers and other translators  Interpreters  Tombstone diagrams  Real vs virtual machines  Interpretive compilers.
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
Groovy WHAT IS IT? HOW DOES IT WORK? IS IT USEFUL?
Community Outreach (on 9/19/14) By: Jeffrey Cain.
JRuby: Bringing Ruby to the JVM™ Thomas E. Enebo, Aandtech Inc. Charles Oliver Nutter, Ventera Corp
Ruby! Useful as a scripting language – script: A small program meant for one time use – Targeted towards small to medium size projects Use by: – Amazon,
Scala Technion – Institute of Technology Software Design (236700) Based on slides by: Sagie Davidovich, Assaf Israel Author: Gal Lalouche - Technion 2015.
FRST JAVA PROGRAM. Getting Started with Java Programming A Simple Java Application Compiling Programs Executing Applications.
How Java becomes agile riding Rhino Xavier Casellato VP of engineering, Liligo.com.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
Ruby. Who am I? 1- Bunlong Van 2- Sreyleap Lay, 3- Chhon Meily Blog:
COP 3330 Notes 1/12. Today's topics Downloading Java and Eclipse Hello World Basic control structures Basic I/O Strings.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
Java is Awesome Sean Pierce. What is the JVM and Why do I care?
Eagle: Maturation and Evolution 17th Annual Tcl Conference Joe Mistachkin.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
We will talking about story of JAVA language. By Kristsada Songpartom.
Why Clojure? Adrian Miron. Using Java since Found both on a CD from Professionally (getting payed :-) since 2001 Back then I knew nothing.
CS162 Week 1 Kyle Dewey. Overview Basic Introduction CS Accounts Scala survival guide.
Final Version Olex Ponomarenko. Goals for the Project Create a fairly abstract map path-finding program Add more complex heuristics to account for things.
Java FilesOops - Mistake Java lingoSyntax
Functional Programming IN NON-FUNCTIONAL LANGUAGES.
Duke CPS Java: make it run, make it right, make it fast (see Byte, May 1998, for more details) l “Java isn’t fast enough for ‘real’ applications”
20-Feb-16 javap. Bytecode Java is compiled into bytecode, which is intermediate between Java and a “real” assembly language To implement Java, it is only.
Apache Avro CMSC 491 Hadoop-Based Distributed Computing Spring 2016 Adam Shook.
NetBeans & Ruby David Botterill Software Engineer Global Technology Manager - Campus Ambassador Program Sun Microsystems, Inc.
.... RuDy Perform like a Star Tomasz Stachewicz Euruko 2009 :: Barcelona.
GroovyOne: the first Groovy conference James Strachan Let's Get Groovy!
Introduction CMSC 202 Fall Instructors Mr. Ryan Bergeron – Lecture Section 01 Tues/Thu 1:00 – 2:15 am, Sondheim 111 – Lecture Section 04 Tues/Thu.
Optimizing The Optimizer: Improving Data Flow Analysis in Soot Michael Batchelder 4 / 6 / 2005 A COMP-621 Class Project.
RubyConf 2012 Artūras 'arturaz' Šlajus
COURSE DETAILS SPARK ONLINE TRAINING COURSE CONTENT
Basic Concepts: computer, program, programming …
CS240: Advanced Programming Concepts
COMP 2100 From Python to Java
14 Compilers, Interpreters and Debuggers
Programming Languages Dan Grossman 2013
Practical Programming in an Exception Free World
Programming Languages Dan Grossman 2013
SPSC: a Simple Supercompiler in Scala
JRuby Charles Oliver Nutter
Programming without BlueJ Week 12
Ruby, Rails, GUIs, and More
Compiling Java to Javascript
The Finch Robot and the While Loop
A quick introduction.
statically-typed JVM-targeted programming language
Java for IOI.
Java 6 Decompiler Joshua Cranmer.
(Computer fundamental Lab)
Eagle: Maturation and Evolution
CSC 253 Lecture 2.
Emerald - et OO-språk for distribuerte applikasjoner
Chapter 2: Java Fundamentals
Let’s Talk about… Smalltalk.
What is Programming Language
Interpreting Java Program Runtimes
Kotlin vs Java Will the Emerging Player Beat the Veteran?
Just In Time Compilation
Presentation transcript:

Artūras Šlajus VS through eyes of Ruby programmer

My experience

How everything started

Static Speedy JVM Open classes Strong OOP Mixins Syntax Functional Duck typing Threading Structural typing

Compiler optimizations! Esp. when using immutable structures Why? Compiler optimizations! Esp. when using immutable structures Map1, Map2, ... Map, Tail recursion

ScalaTest Has awesome libs to aid in testing (TDD, BDD, you name it). But we really use RSpec ;) Which brings me to...

Ruby and Scala integration JRuby allows for native integration, meaning no C code for you! However, JRuby is still slow (at least for us). We use JSON IPC bridge (it's ugly, but it works).

Other thingies

{alliance_id => [Player, Player]} Functional thinking I need to: [Player, Player, nil, ...] => {alliance_id => [Player, Player]}

In Ruby I'd have done hash = {} players.each do |player| unless player.nil? hash[player.alliance_id] ||= [] hash[player.alliance_id].push player end hash

players.flatten.groupBy { _.allianceId } In Scala I do players.flatten.groupBy { _.allianceId }

Compiles to JVM bytecode. Can call Java code natively. Java integration Compiles to JVM bytecode. Can call Java code natively. Can be called from Java. However it looks a bit ugly: scalaObject.$plus$equals(javaObj) scalaObject.push(javaObj)

scala> def getCowN ame(colo r: String) = { Ditch those nulls! scala> def getCowN ame(colo r: String) = { | color match { | case "Black" | "White" => Some("C OW") | case _ => None | } } getCowN ame: (color: String)O ption[jav a.lang.St ring] scala> getCowN ame("Bla ck") res0: Option[ja va.lang.S tring] = Some(C OW) scala> getCowN ame("Yel low") res2: Option[ja va.lang.S tring] = None

Ditch those nulls! scala> getCowName("Black").get res1: java.lang.String = COW scala> getCowName("White") match { | case Some(cow) => println("We've got a " + cow) | case None => println("No cows here") | } We've got a COW

Ugly things

Complex type annotations def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That What? But you don't need that often.

Compiler speed It has a lot of things to do. A lot slower than javac. Use Simple Build Tool or Fast Scala Compiler!

Conclusion If I knew Scala existed when I started Nebula 44 - I probably wouldn't have used Ruby. Well, except perhaps for scripting. Scala is a kick-ass language combining best from Ruby and Java worlds.