<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kevin Grad &#187; erlang</title>
	<atom:link href="http://couchware.ca/www/kev/tag/erlang/feed/" rel="self" type="application/rss+xml" />
	<link>http://couchware.ca/www/kev</link>
	<description>Designer, Programmer and Co-Founder</description>
	<lastBuildDate>Fri, 30 Apr 2010 20:33:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Learning Scala</title>
		<link>http://couchware.ca/www/kev/2009/04/14/learning-scala/</link>
		<comments>http://couchware.ca/www/kev/2009/04/14/learning-scala/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 16:04:42 +0000</pubDate>
		<dc:creator>kev</dc:creator>
				<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[chapters]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[FP]]></category>
		<category><![CDATA[functional programming]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[lift]]></category>
		<category><![CDATA[object oriented programming]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[smalltalk]]></category>

		<guid isPermaLink="false">http://couchware.ca/blogs/kev/?p=152</guid>
		<description><![CDATA[My copy of Programming in Scala finally arrived yesterday, and I have had a chance to read the first chapter. It looks to be a very interesting language. I have had a desire to learn functional programming for a long time, and I have a giant fascination with programming languages in general. Scala seems to [...]]]></description>
			<content:encoded><![CDATA[<p>My copy of <a href="http://www.amazon.com/Programming-Scala-Comprehensive-Step-step/dp/0981531601/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1239717940&amp;sr=8-1">Programming in Scala</a> finally arrived yesterday, and I have had a chance to read the first chapter. It looks to be a very interesting language. I have had a desire to learn functional programming for a long time, and I have a giant fascination with programming languages in general. Scala seems to be getting a lot of hype right now, and the ability to program both <a href="http://en.wikipedia.org/wiki/Imperative_programming">Imperatively </a>and <a href="http://en.wikipedia.org/wiki/Functional_programming">Functionally </a>is too hard to pass up.<br />
<span id="more-152"></span><br />
Getting the book turned out to be more annoying than I had anticipated. The book is fairly new and as such, not yet available on <a href="http://www.chapter.ca">Chapters.ca</a>. It is available at <a href="http://www.amazon.ca">Amazon.ca</a>, however, the copy listed has a 2-3 week waiting period before shipping. I am an impatient person and I decided to order it from <a href="http://www.amazon.com">Amazon.com</a> because it listed the book as In Stock.</p>
<p>I placed the order on April 1, paying extra for the medium-tier shipping package so that I could get the book within 3-5 days of shipping. Since the book was in stock I was hoping to have the book by the end of the week. The only reason I ordered from the U.S. site (which obviously cost more for conversion, shipping, customs etc.) was so i could get the book without waiting 2-3 weeks. This prior weekend was a long weekend and it would have been nice to have had the book to read while I had some time at home. However, by April 8, the book still had not shipped. This was inconceivable to me as it was STILL listed as In Stock on their website, why would it not have shipped? </p>
<p>I sent a strongly worded letter to Amazon customer service, and to their credit, they upgraded me to premium shipping and sent it out the next day. The said there was a problem with the order that he fixed and sent it out at the next available opportunity. I highly doubt there was actually a problem other than the fact that I complained. Long story short, I finally have the book. Even though Amazon customer service was pretty good about the matter, I should not have had to contact them in the first place and I did not get to read the book over the long weekend as I had hoped.</p>
<p>Anyway, back to Scala. Scala seems to be a pretty cool language. From what I gather so far (and I will update you as I know more about it) it combines Object Oriented Programming (OOP) principles with Functional Programming (FP). It allows for both Imperative (think Java, C++) and Functional (Erlang, Haskell) programming styles. It is not the only language to do this, many languages provide functional programming features within the language, such as closures, functions as first class objects etc. The most notable languages to do this would be Python and Ruby.</p>
<p>However, Scala is not a dynamic language. It is statically typed, with type inference, which looks like it could be very nice. Additionally, Scala&#8217;s OO model is not implemented in a half-assed fashion like Java (primitives, statics, &#8230;) but rather, everything is an object (in the vein of Smalltalk, Ruby, etc.). Finally, it is lightweight, choosing to bundle most features in external libraries (comes with a standard library) rather than in the language itself, (such as BigIntegers, Actors).</p>
<p>The really interesting thing about Scala, is that it uses a lot of the Java types but extends them using something called Traits. For example, it uses primitive Java ints, but in order to make them objects, it defines a trait that will map Scala commands to a custom implementation (kinda). An example of this is if you want to call a function on an int, Scala will first look to the Java implementation, if the function doesn&#8217;t exist (which it wont because an int is a primitive) it will look to see if there are any traits defined, (which there are because its part of the Scala language) and then look for the function there. Scala uses these traits as means of wrapping the Java libraries in a nice way for use with the Scala language. It makes external libraries seem as if they are part of the Scala language, which is pretty nice. The beauty of this is, you can define your own traits and extend classes however you see fit. As well, you can use traits as lightweight interfaces, defining partial methods and enforcing multiple traits in a pseudo multiple inheritance scheme. Pretty powerful (if you understand what I just said anyway). I&#8217;m not 100% clear on traits so don&#8217;t get mad if some of the info I just mentioned is wrong.</p>
<p>Scala is also a fully functional language, borrowing some great ideas from other functional languages such as Haskell and Erlang. Of note, Scala uses an implementation of Erlang&#8217;s Actor&#8217;s shared memory model to accomplish parallel programming. Erlang&#8217;s model has been hugely successful and I am interested to see exactly how I can utilize this feature. </p>
<p>Scala&#8217;s name comes from &#8220;Scalable Language.&#8221; I&#8217;m not sure exactly what makes Scala so scalable, some of the things I&#8217;ve seen from my brief introduction is its use of traits, its integration with the Java standard library, its ability to run on the JVM and its Erlang-eque concurrency model. </p>
<p>There was a great question <a href="http://couchware.ca/blogs/cam">Cam</a> pointed out on <a href="http://stackoverflow.com/questions/648964/why-is-the-lift-web-framework-scalable">Stack Overflow</a> which talks a bit about what makes the <a href="http://liftweb.net/">Lift</a> web framework (written in Scala) so scalable. It is really interesting, and their take on threading is a good one in my opinion. Something I hope to maybe take advantage of with my own stuff.</p>
<p>I have to say that I am pretty excited to learn Scala. It seems like it could be a great language that is still undergoing heavy development and is very extendable. Ultimately I would like to combine Scala with some of my Java programming, something that I see as Scala&#8217;s (and all JVM languages) best feature. I believe this is still something that is not entirely EASY to accomplish. Something that I would like to see, and I am sure is on the list of things to do, is the ability to mix JVM languages transparently, without the need to call the specific compilers for the specific classes. Maybe I will work on that as a side project.</p>
<p>Scala is being touted by many as the next &#8220;Big&#8221; language. I don&#8217;t know if that&#8217;s necessarily the case, but it sure does seem like a nice language. Maybe it will quench my thirst for new languages temporarily? Who knows. I also purchased <a href="http://www.amazon.com/Programming-Language-Pragmatics-Third-Michael/dp/0123745144/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1239724031&amp;sr=1-1">Programming Language Pragmatics</a> with a mild desire to create my own language at some point. Perhaps I will be able to leverage some ideas from Scala when doing so.</p>
<p>This will be my first serious venture into the FP world (I have a little experience with Scheme, however, that was a long time ago, in a galaxy far far away&#8230;). I am already familiar with a bunch of functional techniques, such as closures/lambdas, but I have never really programmed in a functional way for something serious. Hopefully Scala turns out to be as nice as it appears to be, as I am excited to try the Lift framework and to start mixing functional programming with my current code.</p>
]]></content:encoded>
			<wfw:commentRss>http://couchware.ca/www/kev/2009/04/14/learning-scala/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
