<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Making-the-Climb on Dr. Random</title><link>https://drrandom.org/tags/making-the-climb/</link><description>Recent content in Making-the-Climb on Dr. Random</description><generator>Hugo</generator><language>en-gb</language><lastBuildDate>Sun, 22 Jan 2012 20:23:58 +0000</lastBuildDate><atom:link href="https://drrandom.org/tags/making-the-climb/index.xml" rel="self" type="application/rss+xml"/><item><title>Making the Climb Part 4–Pattern Matching</title><link>https://drrandom.org/2012/01/22/making-the-climb-part-4-pattern-matching/</link><pubDate>Sun, 22 Jan 2012 20:23:58 +0000</pubDate><guid>https://drrandom.org/2012/01/22/making-the-climb-part-4-pattern-matching/</guid><description>&lt;p&gt;Continuing our journey down the path from the familiar to the down-right bizarre, we find ourselves at Pattern Matching.  This is a feature of the Scala language that shows it’s functional side in a strong way.  Pattern Matching is a fundamental part of functional languages in general, and provides a way to write very concise and expressive code.  On the surface, pattern matching in Scala looks an awful lot like switch statements in C# (and Java for that matter), but you shouldn’t cling too hard to that association.&lt;/p&gt;</description></item><item><title>Making the Climb Part 3 - Generics of a Higher Kind</title><link>https://drrandom.org/2011/10/05/making-the-climb-part-3-generics-of-a-higher-kind/</link><pubDate>Wed, 05 Oct 2011 16:24:00 +0000</pubDate><guid>https://drrandom.org/2011/10/05/making-the-climb-part-3-generics-of-a-higher-kind/</guid><description>&lt;p&gt;This is part 3 in a series.  If you’ve not followed-along so far, you may want to check out &lt;a href="https://drrandom.org/2011/07/31/making-the-climb-chronicling-the-journey-from-c-to-scala/"&gt;Part 1&lt;/a&gt; and &lt;a href="https://drrandom.org/2011/08/14/making-the-climb-part-2-object-oriented-programming-in-scala/"&gt;Part 2&lt;/a&gt; first.&lt;/p&gt;
&lt;p&gt;It’s time to start digging in to some of the crazy-goodness that makes Scala such a glorious and wonderful thing.  First things first, though, we have to talk a little bit about this history of Generics in Java and the JVM. &lt;/p&gt;
&lt;h4 id="type-erasure-and-you"&gt;Type Erasure and you…&lt;/h4&gt;
&lt;p&gt;Back around the time that .Net was adding support for generics, the folks in Java land were doing the same…sort of.  The biggest difference between the way Generics were implemented in .Net and Java is the fact that in .Net generics are supported directly in the CLR (sometimes called reified generics), whereas the JVM did not include direct support for generics.  Ok, so what does that actually &lt;em&gt;mean&lt;/em&gt;?  Well, for starters it means that when you’re dealing with Generics in Java you run into &lt;a href="http://download.oracle.com/javase/tutorial/java/generics/erasure.html"&gt;Type Erasure&lt;/a&gt;.  Type Erasure means that when Java code with generics are compiled, the generic type information is removed at compile time, so while you’re looking at an ArrayList&lt;String&gt; in Java, the JVM sees this as just an ArrayList, and things get cast as needed.  There are a couple of types which get reified into actual types (Arrays are the best example), but for the most part this doesn’t happen.  In contrast in the .Net world a List&lt;string&gt; gets compiled into a List`1&amp;lt;System.String&amp;gt; which is a real type at the IL level.  Now, I’m not going to get into the argument about whether or not type erasure is good or bad, but it is a fundamental difference between the two platforms. &lt;/p&gt;</description></item><item><title>Making the Climb Part 2–Object-Oriented Programming in Scala</title><link>https://drrandom.org/2011/08/14/making-the-climb-part-2-object-oriented-programming-in-scala/</link><pubDate>Sun, 14 Aug 2011 23:39:00 +0000</pubDate><guid>https://drrandom.org/2011/08/14/making-the-climb-part-2-object-oriented-programming-in-scala/</guid><description>&lt;p&gt;In Part 2 of this series we’re going to move into some of the object-oriented aspects of Scala.  For a primer on what Scala is, and a quick primer on syntax, check out &lt;a href="https://drrandom.org/2011/07/31/making-the-climb-chronicling-the-journey-from-c-to-scala/"&gt;part 1&lt;/a&gt;.&lt;/p&gt;
&lt;h4 id="lets-start-with-the-built-in-object-structure"&gt;Let’s start with the built-in object structure&lt;/h4&gt;
&lt;p&gt;Like C# and Java, Scala has a built-in object hierarchy, and a standard library full of goodies.  Unlike Java and C#, Scala tackled the issue of reference types and value types head-on, so while the root type in the Scala type system is the &lt;code&gt;Any&lt;/code&gt; type, there are two descendants of &lt;code&gt;Any&lt;/code&gt; that come into play before any other type. The two are: &lt;code&gt;AnyRef&lt;/code&gt;, and &lt;code&gt;AnyVal&lt;/code&gt;. As you might guess &lt;code&gt;AnyRef&lt;/code&gt; is the base type for all reference types (including types made available from Java), and &lt;code&gt;AnyVal&lt;/code&gt; is the base type for all value types. This is a little bit like the &lt;code&gt;class&lt;/code&gt; and &lt;code&gt;struct&lt;/code&gt; type constraints in C#, only you can use these as variables. They can also be used to limit type parameters, but Scala Generics are going to have to get their own post.&lt;/p&gt;</description></item><item><title>Making The Climb: Head-To-Head with Project Euler (questions #1 &amp; #2)</title><link>https://drrandom.org/2011/08/04/making-the-climb-head-to-head-with-project-euler-questions-1-2/</link><pubDate>Thu, 04 Aug 2011 01:50:00 +0000</pubDate><guid>https://drrandom.org/2011/08/04/making-the-climb-head-to-head-with-project-euler-questions-1-2/</guid><description>&lt;p&gt;I’m going to take a brief intermission in my &lt;a href="https://drrandom.org/2011/07/31/making-the-climb-chronicling-the-journey-from-c-to-scala/"&gt;Scala series&lt;/a&gt;, and show a head-to-head comparison of some code in Scala and C#.  To do this, I’m going to go with the first and second problems from &lt;a href="http://projecteuler.net"&gt;Project Euler&lt;/a&gt;.  If your not familiar with the site, it’s a playground full of problems that are absolutely perfect for functional languages (cause they tend to be mathematical functions).  So let’s get started with Question #1:&lt;/p&gt;</description></item><item><title>Making the Climb: Chronicling the journey from C# to Scala</title><link>https://drrandom.org/2011/07/31/making-the-climb-chronicling-the-journey-from-c-to-scala/</link><pubDate>Sun, 31 Jul 2011 19:41:00 +0000</pubDate><guid>https://drrandom.org/2011/07/31/making-the-climb-chronicling-the-journey-from-c-to-scala/</guid><description>&lt;p&gt;Hows that for a title, eh?  Yeah, I know, not great, but there is only so much creativity I can manage in a day, and as you will soon find out my mind is busy with all kinds of new and interesting thing, so any spare neural pathways which may have one been useful for something like clever titles are now just too busy to be bothered.&lt;/p&gt;
&lt;!-- missing image: /image.axd?picture=2011/10/Photoxpress_17379649_2.jpg --&gt;So what is this all about?  Several months ago I had an interesting experience.  One that I could almost compare to a religious experience, only not quite so….religious.  It started with the most excellent book [Seven Languages in Seven Weeks](http://pragprog.com/book/btlang/seven-languages-in-seven-weeks) by Bruce Tate, from our good friends at the [Pragmatic Programmers](http://pragprog.com/).  Now, I will admit that I’ve not actually read all of it…yet.  The reason is that while I found the first several languages (Ruby, Io, and Prolog) interesting, and challenging, it was [Scala](http://www.scala-lang.org) that had a certain something that kept me wanting to know more.  Mr. Tate actually didn’t care much for the syntax of Scala, and was rather pleased to move on to Erlang.  Meanwhile I was off and running downloading Eclipse and the Scala IDE, looking at testing frameworks, online documentations, and what’s this?  Android development with Scala!?!?  I was hooked.
&lt;h3 id="what-is-scala-all-about"&gt;What is Scala all about?&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;2003 - A drunken Martin Odersky sees a Reese&amp;rsquo;s Peanut Butter Cup ad featuring somebody&amp;rsquo;s peanut butter getting on somebody else&amp;rsquo;s chocolate and has an idea. He creates Scala, a language that unifies constructs from both object oriented and functional languages. This pisses off both groups and each promptly declares jihad.&lt;br&gt;
&lt;a href="http://james-iry.blogspot.com/"&gt;James Iry&lt;/a&gt; - &lt;a href="http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html"&gt;A Brief, Incomplete, and Mostly Wrong History of Programming Languages&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;</description></item></channel></rss>