<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Object Orientation on Roads Less Taken</title><link>https://goran.krampe.se/categories/object-orientation/</link><description>Recent content in Object Orientation on Roads Less Taken</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 14 May 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://goran.krampe.se/categories/object-orientation/index.xml" rel="self" type="application/rss+xml"/><item><title>Spry vs Allen</title><link>https://goran.krampe.se/2016/05/14/spry-vs-allen/</link><pubDate>Sat, 14 May 2016 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2016/05/14/spry-vs-allen/</guid><description>&lt;p>Allen Wirfs-Brock &lt;a href="http://www.wirfs-brock.com/allen/posts/754" target="_blank" rel="noopener noreferrer">wrote down a bullet list&lt;/a>
 of what he thought actually made it possible for the Alan Kay team to &lt;a href="http://worrydream.com/EarlyHistoryOfSmalltalk/" target="_blank" rel="noopener noreferrer">create Smalltalk&lt;/a>
, and many other ground breaking things, at Xerox PARC in the 70s. Let&amp;rsquo;s take a look at &lt;strong>his bullets one by one&lt;/strong> and see how it applies to Spry and my puny little effort around it :)&lt;/p>
&lt;img src="https://goran.krampe.se/spry/assume.jpg" alt="Assume" style="display:block; margin:0 auto;"></description></item><item><title>Adding objects to Ni!</title><link>https://goran.krampe.se/2015/09/25/adding-objects-to-ni/</link><pubDate>Fri, 25 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/25/adding-objects-to-ni/</guid><description>&lt;p>So&amp;hellip; Ni has almost reached the point where I can see objects appearing. The following describes the design I &lt;strong>currently&lt;/strong> have in mind, read it and tell me what you think so I can scrap it and start over ;)&lt;/p>
&lt;img src="https://goran.krampe.se/ni/ni.png" alt="Ni" style="float:right; margin:0 0 1em 1em;"></description></item><item><title>Ni design decisions!</title><link>https://goran.krampe.se/2015/09/23/ni-design-decisions/</link><pubDate>Wed, 23 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/23/ni-design-decisions/</guid><description>&lt;p>So&amp;hellip; my little Ni language got some attention since it was first &lt;a href="https://news.ycombinator.com/item?id=10235688" target="_blank" rel="noopener noreferrer">on Hackernews&lt;/a>
, then &lt;a href="http://www.theregister.co.uk/2015/09/18/we_are_the_knights_who_code_ni/" target="_blank" rel="noopener noreferrer">TheRegister&lt;/a>
, all over Twitter and also &lt;a href="https://www.reddit.com/r/programming/comments/3lfpym/ni_a_language_influenced_by_smalltalk_written_in/" target="_blank" rel="noopener noreferrer">Reddit&lt;/a>
.&lt;/p>
&lt;p>But I think it managed to come relatively unscathed out of it, although it &lt;strong>REALLY is pre-alpha-not-even-complete-eats-your-harddrive early&lt;/strong> and you know, I really have no idea if it ever will go the distance since it takes quite a bit of work to get a language to actually be used. But I am going to stick with it.&lt;/p>
&lt;p>Anyway, I have been experimenting with &amp;ldquo;arg words&amp;rdquo; and &amp;ldquo;lookup scoping&amp;rdquo; while thinking about how to add objects, and a few other things. This article doesn&amp;rsquo;t introduce how I want to do objects, but the next one does (I split it in two). This article however covers a bunch of loose ends and my ideas on how to tackle them in Ni. And I will try to make this understandable even if you don&amp;rsquo;t know Ni. ;)&lt;/p></description></item><item><title>Guts of Ni</title><link>https://goran.krampe.se/2015/09/22/guts-of-ni/</link><pubDate>Tue, 22 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/22/guts-of-ni/</guid><description>&lt;p>This article describes some core parts of the current implementation of the Ni (now known as &lt;a href="https://goran.krampe.se/spry" >Spry&lt;/a>
) language. It&amp;rsquo;s not a tutorial, introduction or manual. It&amp;rsquo;s in &lt;strong>fact kinda incoherent - but so is Ni&lt;/strong> :)&lt;/p></description></item><item><title>Who says Ni?</title><link>https://goran.krampe.se/2015/09/16/who-says-ni/</link><pubDate>Wed, 16 Sep 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/09/16/who-says-ni/</guid><description>&lt;p>Ni is my &lt;a href="https://goran.krampe.se/spry" >own little language&lt;/a>
 heavily influenced by &lt;a href="http://www.world.st" target="_blank" rel="noopener noreferrer">Smalltalk&lt;/a>
 but also other sources like Rebol, Forth, Lisp, Self and Nim. Ni is a bit strange, but it&amp;rsquo;s not academic and really meant to become something useful.&lt;/p>
&lt;p>So put on your helmet and let me take you to the shrubbery&amp;hellip;&lt;/p></description></item><item><title>Nim and super</title><link>https://goran.krampe.se/2015/05/06/nim-and-super/</link><pubDate>Wed, 06 May 2015 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2015/05/06/nim-and-super/</guid><description>&lt;p>As I described in &lt;a href="https://goran.krampe.se/2014/10/29/nim-and-oo" >the&lt;/a>
 &lt;a href="https://goran.krampe.se/2014/10/31/nim-and-oo-part-ii" >earlier&lt;/a>
 &lt;a href="https://goran.krampe.se/2014/10/31/nim-and-oo-part-iii" >posts&lt;/a>
 Nim didn&amp;rsquo;t support &amp;ldquo;super calls&amp;rdquo; when using &lt;strong>methods&lt;/strong> instead of statically bound &lt;strong>procs and generics&lt;/strong>. My article caused a little bit of discussion around this on IRC and Andreas decided to implement the mechanism he already had planned - but had not fully decided a good name for.&lt;/p>
&lt;p>The other day Nim 0.11.2 &lt;a href="http://nim-lang.org/news.html#Z2015-05-04-version-0-11-2-released" target="_blank" rel="noopener noreferrer">was released&lt;/a>
 and it includes this mechanism. Let&amp;rsquo;s have a look how it works in my sample code&amp;hellip;&lt;/p></description></item><item><title>Nim and OO, Part IV</title><link>https://goran.krampe.se/2014/11/30/nim-and-oo-part-iv/</link><pubDate>Sun, 30 Nov 2014 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2014/11/30/nim-and-oo-part-iv/</guid><description>&lt;p>As I described in &lt;a href="https://goran.krampe.se/2014/10/29/nim-and-oo" >the&lt;/a>
 &lt;a href="https://goran.krampe.se/2014/10/31/nim-and-oo-part-ii" >earlier&lt;/a>
 &lt;a href="https://goran.krampe.se/2014/10/31/nim-and-oo-part-iii" >posts&lt;/a>
 Nim didn&amp;rsquo;t support &amp;ldquo;super calls&amp;rdquo; when using &lt;strong>methods&lt;/strong> instead of statically bound &lt;strong>procs and generics&lt;/strong>. My article caused a little bit of discussion around this on IRC and Andreas decided to implement the mechanism he already had planned - but had not fully decided a good name for.&lt;/p>
&lt;p>The other day this mechanism &lt;a href="https://github.com/Araq/Nimrod/commit/105a0616a9da7c9c85adfa488a1db42eb17daafb" target="_blank" rel="noopener noreferrer">entered the devel branch&lt;/a>
 which means it will be official in the next release of Nim, which I suspect will be out before the end of 2014. It should be noted that devel is mainly undergoing bug fixing, so unless you are paranoid it&amp;rsquo;s pretty usable. Now&amp;hellip; of course I had to try out super calls in my sample code&amp;hellip;&lt;/p></description></item><item><title>Nim and OO, Part II</title><link>https://goran.krampe.se/2014/10/31/nim-and-oo-part-ii/</link><pubDate>Fri, 31 Oct 2014 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2014/10/31/nim-and-oo-part-ii/</guid><description>&lt;p>In the &lt;a href="https://goran.krampe.se/2014/10/29/nim-and-oo" >previous article&lt;/a>
 when I explored OO mechanisms in &lt;a href="http://nim-lang.org" target="_blank" rel="noopener noreferrer">Nim&lt;/a>
 I felt I dropped the ball a bit in my Fruit example. This is a followup.&lt;/p>
&lt;p>In that article we first implemented some Fruit &amp;ldquo;classes&amp;rdquo; mixing methods and procs. Then I presented a cleaned up version using methods only, and a teeny template in order to reuse a base method. This template was needed since Nim currently doesn&amp;rsquo;t have a &amp;ldquo;call-next-method-matching&amp;rdquo; for multimethods like Dylan or CLOS have. This is being discussed and I think all agree that there needs to be &lt;strong>some&lt;/strong> mechanism so that you can call a &amp;ldquo;next lesser match&amp;rdquo; of all matching multimethods.&lt;/p>
&lt;p>But I also wrote that the example &lt;strong>can be written perfectly well using generics and procs only&lt;/strong>, thus ensuring static binding and maximum speed. But the &amp;ldquo;super call&amp;rdquo; problem also existed for procs, and the template hack was just a hack. After more experimentation I now &lt;strong>think I found the proper Nim way&lt;/strong> to do this so let&amp;rsquo;s take a look&amp;hellip;&lt;/p></description></item><item><title>Nim and OO, Part III</title><link>https://goran.krampe.se/2014/10/31/nim-and-oo-part-iii/</link><pubDate>Fri, 31 Oct 2014 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2014/10/31/nim-and-oo-part-iii/</guid><description>&lt;p>So previously in &lt;a href="https://goran.krampe.se/2014/10/31/nim-and-oo-part-ii" >Nim and OO Part II&lt;/a>
 we saw how we could solve the &amp;ldquo;super call&amp;rdquo; issue using only procs and generics in &lt;a href="http://nim-lang.org" target="_blank" rel="noopener noreferrer">Nim&lt;/a>
. This means that all code is statically bound.&lt;/p>
&lt;p>But if you have read all these article you know I also tried the more appropriate mechanism for OO - so called &lt;strong>methods&lt;/strong>. In Nim a proc is a regular statically bound function, simple and fast. A &lt;strong>method&lt;/strong> on the other hand uses dynamic multimethod dispatch on the &lt;strong>runtime types&lt;/strong> of all object parameters. The easy way to do objects in Nim (with inheritance of behavior) is using methods - but of course, this means dynamic lookup that has a runtime cost, but quite small as we will see.&lt;/p>
&lt;p>Time for benchmarking!&lt;/p></description></item><item><title>Nim and OO</title><link>https://goran.krampe.se/2014/10/29/nim-and-oo/</link><pubDate>Wed, 29 Oct 2014 00:00:00 +0000</pubDate><guid>https://goran.krampe.se/2014/10/29/nim-and-oo/</guid><description>&lt;p>&lt;a href="http://nim-lang.org" target="_blank" rel="noopener noreferrer">Nim&lt;/a>
 is presented as an &lt;strong>imperative&lt;/strong> language. And yes, it has some of its roots in the Pascal line of languages, but it also has a set of powerful abstraction mechanisms making it very suitable for object oriented programming. And when I write &lt;em>&amp;ldquo;object oriented&amp;rdquo;&lt;/em> I am referring to a broader flexible sense of OO in which objects can be formulated with attached behavior, polymorphism between different objects, some kind of reuse model of code (inheritance etc) and some type of dynamic dispatch.&lt;/p>
&lt;p>Since I am a &lt;a href="http://www.squeak.org" target="_blank" rel="noopener noreferrer">long time&lt;/a>
 &lt;a href="http://pharo.org" target="_blank" rel="noopener noreferrer">Smalltalker&lt;/a>
 that is my main reference for &lt;em>&amp;ldquo;good OO&amp;rdquo;&lt;/em> and not the &amp;hellip; monstrous OO often seen in Java or C++. Its hard to explain the differences, but let me just say that OO in Smalltalk is elegant and natural, very much like in Ruby or Python - but ever so more streamlined. Smalltalk is a dynamically strongly typed reflective language with a heavily closure based style.&lt;/p>
&lt;p>In this article I will try to make &amp;ldquo;sense&amp;rdquo; out of how to do OO in Nim.&lt;/p></description></item><item><title>ESUG 2011 in Edinburgh</title><link>https://goran.krampe.se/2011/08/11/esug-2011-in-edinburgh/</link><pubDate>Thu, 11 Aug 2011 11:59:57 +0000</pubDate><guid>https://goran.krampe.se/2011/08/11/esug-2011-in-edinburgh/</guid><description>&lt;p>Each year I try to attend at least one developer conference. Earlier OOPSLA was a given but it lost its appeal quite a few years back and now it is not even called OOPSLA anymore. As a die hard &lt;a href="http://www.world.st" target="_blank" rel="noopener noreferrer">Smalltalker&lt;/a>
 I instead attended the &lt;a href="http://www.esug.org/wiki/pier/Conferences" target="_blank" rel="noopener noreferrer">ESUG conference&lt;/a>
 in Brest 2009 and it was easily the most rewarding conference I ever have attended! Missed last year in Barcelona but this year I am going to &lt;a href="http://www.esug.org/wiki/pier/Conferences/2011" target="_blank" rel="noopener noreferrer">Edinburgh&lt;/a>
 for a week of Smalltalking.&lt;/p></description></item><item><title>Skype interview with Dan Ingalls</title><link>https://goran.krampe.se/2010/09/10/skype-interview-with-dan-ingalls/</link><pubDate>Fri, 10 Sep 2010 08:49:54 +0000</pubDate><guid>https://goran.krampe.se/2010/09/10/skype-interview-with-dan-ingalls/</guid><description>&lt;p>Before the summer I had the opportunity to do a Skype interview with Dan &lt;a href="http://en.wikipedia.org/wiki/Daniel_Henry_Holmes_Ingalls,_Jr." target="_blank" rel="noopener noreferrer">Ingalls&lt;/a>
, the &amp;ldquo;Guido/Larry/Linus&amp;rdquo; of Smalltalk.&lt;/p>
&lt;p>The interview was part of a guest lecture I did at &lt;a href="http://dsv.su.se/" target="_blank" rel="noopener noreferrer">DSV&lt;/a>
 for the &lt;a href="http://people.dsv.su.se/~beatrice/DYPL" target="_blank" rel="noopener noreferrer">DYPL&lt;/a>
 course (dynamic programming languages) held by Beatrice Akerblom. In the end I only used a smaller quote because most of the topics in the interview ended up being more interesting to &amp;ldquo;true believers&amp;rdquo; than to Smalltalk newcomers.&lt;/p></description></item><item><title>Joe is wrong</title><link>https://goran.krampe.se/2009/06/26/joe-is-wrong/</link><pubDate>Fri, 26 Jun 2009 17:12:06 +0000</pubDate><guid>https://goran.krampe.se/2009/06/26/joe-is-wrong/</guid><description>&lt;p>I just read Joe Armstrong’s old &amp;ldquo;Why OO sucks&amp;rdquo; &lt;a href="http://www.sics.se/~joe/bluetail/vol1/v1_oo.html" target="_blank" rel="noopener noreferrer">article&lt;/a>
, Joe Armstrong being the inventor of &lt;a href="http://erlang.org/" target="_blank" rel="noopener noreferrer">Erlang&lt;/a>
. Granted, the article is from year 2000 I think, so perhaps I should cut him some slack… nah! :)&lt;/p>
&lt;p>First of all - no, I haven’t programmed in Erlang (yet), but quite a lot of other programming languages. My favorite language is the grand father OO language - &lt;a href="http://squeak.org/" target="_blank" rel="noopener noreferrer">Smalltalk&lt;/a>
. So sure, I am biased in favor of OO.&lt;/p></description></item></channel></rss>