Upgrade to Pro — share decks privately, control downloads, hide ads and more …

7 Languages in 7 Hours

7 Languages in 7 Hours

The slides to go with my precompiler from Codemash 2016. Codebase available at https://github.com/crebma/7-languages

7c2a83b93fe0e5f2ed4c95c59367259c?s=128

Amber Conville

January 05, 2016
Tweet

More Decks by Amber Conville

Other Decks in Programming

Transcript

  1. 7 Languages in 7 Hours

  2. $> whois crebma I’m Amber Conville! You can find me

    on the internet at these places: twitter: @crebma
 email: crebma@gmail.com
 github: crebma
 website: crebma.com I develop software at Test Double (@testdouble), which is an awesome group of consultants if you’re looking for work or your company might need help! I also run Self.conference (@selfconference) in Detroit, MI - scheduled for May 20-21st, 2016!
  3. What Are We Doing Today? Today, we’ll be looking at

    the basic syntax of 7 different languages and then working through the same kata in each of them. The kata we’ll be working through is the Prime Factors kata. The languages we’ll be exploring are:
 •ruby •clojure •haskell •rust •scala •elixir •go
  4. The Kata Given an integer, return a list of factors

    for that integer that are prime numbers. For example: Given Result 1 [] 2 [2] 3 [3] 4 [2, 2] And so on.
  5. The Rules 1. TDD • Write the simplest test you

    can to make progress • Write only enough code to make your test pass • Only refactor on green! 2. Pairing is encouraged, but you don't have to. Here's an example of ping-pong style pairing if you want to try it out: • You write a very simple failing test (non-compiling counts as failing) • You pass the keyboard to your pair to make it pass writing only enough code as is necessary • Your pair writes another simple failing test and passes the keyboard back 3. You may not finish the exercise in the allotted time - that's fine! You still have the rest of your life outside of this session to work on it. :) 4. Don't be a jerk.
  6. Our Kata in Java

  7. Our Kata in Java

  8. Our Kata in Java

  9. Our Kata in Java

  10. Our Kata in Java

  11. Our Kata in Java

  12. Our Kata in Java

  13. Our Kata in Java

  14. Our Kata in Java

  15. Our Kata in Java

  16. Our Kata in Java

  17. Our Kata in Java

  18. Our Kata in Java

  19. Our Kata in Java

  20. Our Kata in Java

  21. Our Kata in Java

  22. Ruby

  23. Ruby Ruby is a dynamic language that is relatively easy

    to read and write. It supports recursion and has many functional concepts, though it is not a functional language.
  24. Ruby - Project Structure Gemfile The Gemfile is where we

    declare our external dependencies for our project. Ours includes a source (where to find gems), as well as a reference to rspec (a bdd testing library) at version 3.4 or higher.
  25. Ruby - The Basics Ruby convention is to use underscores

    in place of spaces. This is true for file names, variable names, method names, everything. The _spec bit is convention for saying that this is a test file, as opposed to production code. All ruby files must end in *.rb.
  26. Ruby - Basic Anatomy

  27. Ruby - Basic Anatomy

  28. Ruby - Basic Anatomy

  29. Ruby - Basic Anatomy

  30. Ruby - Basic Anatomy

  31. Ruby - Basic Anatomy

  32. Ruby - Basic Anatomy

  33. Ruby - Basic Anatomy

  34. Ruby - Basic Anatomy

  35. None
  36. None
  37. None
  38. None
  39. None
  40. None
  41. None
  42. None
  43. Thoughts?

  44. Clojure

  45. Clojure Clojure is another dynamic programming language, although perhaps a

    little harder to read and write at first blush. It runs on top of the Java Virtual Machine (JVM), and is a Lisp.
  46. Clojure - Project Structure project.clj This is where we define

    various things about our project, as well as our dependencies, using clojure. Ours has a lot of generated stuff that we don’t really care about right now, as well as a dependency for clojure 1.6.0.
  47. Clojure - The Basics Clojure convention is to use dashes

    in place of spaces. This is true for file names, variable names, method names, everything. The _test bit is convention for saying that this is a test file, as opposed to production code. All clojure files must end in *.clj.
  48. Clojure - Basic Anatomy

  49. Clojure - Basic Anatomy

  50. Clojure - Basic Anatomy

  51. Clojure - Basic Anatomy

  52. Clojure - Basic Anatomy

  53. Clojure - Basic Anatomy

  54. Clojure - Basic Anatomy

  55. Clojure - Basic Anatomy

  56. Clojure - Basic Anatomy

  57. None
  58. None
  59. None
  60. None
  61. None
  62. None
  63. None
  64. None
  65. Thoughts?

  66. Haskell

  67. Haskell Haskell is a statically typed, purely functional programming language.

    This one gets a little trickier for those starting out with it, but like the rest of them, is very fun to play with.
  68. Haskell - The Basics Haskell convention is to use camel

    case, likeThis. Its modules and types are all camel cased, but start with a capital letter, unlike functions and variables. The _Test bit is convention for saying that this is a test file, as opposed to production code. All haskell files must end in *.hs.
  69. Haskell - Basic Anatomy

  70. Haskell - Basic Anatomy

  71. Haskell - Basic Anatomy

  72. Haskell - Basic Anatomy

  73. Haskell - Basic Anatomy

  74. Haskell - Basic Anatomy

  75. Haskell - Basic Anatomy

  76. Haskell - Basic Anatomy

  77. None
  78. None
  79. None
  80. None
  81. None
  82. None
  83. None
  84. None
  85. Thoughts?

  86. Rust

  87. Rust Rust is a statically typed language, but has type

    inference, which can make it feel kind of dynamic when you’re using it.
  88. Rust - The Basics Rust convention is to use underscores

    in place of spaces. This is true for file names, variable names, method names, everything. The _Test bit is convention for saying that this is a test file, as opposed to production code. All rust files must end in *.rs.
  89. Rust - Basic Anatomy

  90. Rust - Basic Anatomy

  91. Rust - Basic Anatomy

  92. Rust - Basic Anatomy

  93. Rust - Basic Anatomy

  94. None
  95. None
  96. None
  97. None
  98. None
  99. None
  100. None
  101. None
  102. Thoughts?

  103. Scala

  104. Scala Scala is a statically typed language, but has type

    inference, which can make it feel kind of dynamic when you’re using it. It also runs on top of the JVM, like clojure.
  105. Scala - The Basics Scala convention is to use camel

    case for method names and variables. It uses camel case for objects and classes, starting with a capital letter. The Spec bit is convention for saying that this is a test file, as opposed to production code. All scala files must end in *.scala.
  106. Scala - Basic Anatomy

  107. Scala - Basic Anatomy

  108. Scala - Basic Anatomy

  109. Scala - Basic Anatomy

  110. Scala - Basic Anatomy

  111. Scala - Basic Anatomy

  112. Scala - Basic Anatomy

  113. Scala - Basic Anatomy

  114. Scala - Basic Anatomy

  115. None
  116. None
  117. None
  118. None
  119. None
  120. None
  121. None
  122. None
  123. Thoughts?

  124. Elixir

  125. Elixir Elixir is a dynamic, functional language. It runs on

    top of the Erlang VM.
  126. Elixir - The Basics Elixir convention is to use underscores

    in place of spaces, for method names and variables. It uses camel case starting with a capital letter for modules, and namespaces are just capital letter acronyms. The _test bit is convention for saying that this is a test file, as opposed to production code. All elixir files must end in either *.ex or *.exs (for a script).
  127. Elixir - Basic Anatomy

  128. Elixir - Basic Anatomy

  129. Elixir - Basic Anatomy

  130. Elixir - Basic Anatomy

  131. Elixir - Basic Anatomy

  132. Elixir - Basic Anatomy

  133. Elixir - Basic Anatomy

  134. None
  135. None
  136. None
  137. None
  138. None
  139. None
  140. None
  141. None
  142. Thoughts?

  143. Go

  144. Go Go is a statically typed language.

  145. Go - The Basics Go convention is to use underscores

    in place of spaces for packages and file names. It uses camel case starting with a capital letter for methods which are public. The _test bit is convention for saying that this is a test file, as opposed to production code. All go files must end in*.go.
  146. Go - Basic Anatomy

  147. Go - Basic Anatomy

  148. Go - Basic Anatomy

  149. Go - Basic Anatomy

  150. Go - Basic Anatomy

  151. Go - Basic Anatomy

  152. Go - Basic Anatomy

  153. Go - Basic Anatomy

  154. Go - Basic Anatomy

  155. Go - Basic Anatomy

  156. None
  157. None
  158. None
  159. None
  160. None
  161. None
  162. None
  163. None
  164. Thoughts?

  165. Thanks for coming! Amber Conville
 crebma.com
 @crebma
 @testdouble
 @selfconference