Archive for July, 2013

Seven Languages – Scala

by Oliver on Friday, July 26th, 2013.

Yet another instalment in my journey through Seven Languages in Seven Weeks – this time on Scala. The iteration period has gone down significantly to almost an actual week, so that’s some marked improvement on previous chapters!

I would say that I haven’t even really used Java seriously – what little I did in my university time I’ve forgotten, and I don’t believe I was ever competent in the language. So I’m approaching Scala from what I imagine is a fairly different vector to the typical Java “refugee” (yes, there are actually many blog posts using that exact term). That being said, I found Scala to have a somewhat similar syntax to Ruby and thus familiar in a sense. The strict typing is welcome after programming for quite a few months in Go and the language clearly has some power behind it.

Much like the sentiment in the book in the closing of the Scala chapter, I also found some of the more complicated syntax hard to wrap my head around. The idiomatic patterns seem to leave out parentheses, dots and introduce all manner of curly bracket blocks and closures which are a bit confusing for just a few days of Scala practice. I’m sure I have misunderstood aspects of the typing system, and I was quite confused by situations where Option or Any types were being returned. There seems to be a very powerful functional programming environment lurking under the covers but sadly the book and my practice barely touched on it.

Having grown to love Golang’s channels and goroutines, actors felt quite familiar but in practice behave quite differently. I do like the concept and think I could grow to love the actor model in Scala and many other aspects of the language, but that will heavily depend on what use I have for it. With Golang in my tool belt, it doesn’t seem I’ll need to reach for Scala much at all, sadly.

The next chapter is on Erlang (also the subject of a great YouTube video) which I am looking forward to even more than Scala. Stay tuned.

Tags: , ,

Friday, July 26th, 2013 Tech 2 Comments

Seven Languages – Prolog

by Oliver on Sunday, July 7th, 2013.

Yet another installment in my journey through Seven Languages in Seven Weeks. At this stage it is so far off seven weeks, it’s definitely going to be more than seven months, and I’m just hoping it won’t take seven years! But it is enjoyable nonetheless – if a little painful.

This time, I’ve just completed the chapter on Prolog. The previous chapter, which I found reasonably painful as well (but for different reasons) was Io. In the meantime, I’ve been doing a lot more work in another prototype-based language – JavaScript – and grown accustomed to the paradigm somewhat. For all its flaws (perceived or otherwise), I find JavaScript much easier to work with than Io, although I have to admit the learning experience with Io was still worth some of the pain.

Prolog has a deeper hold on me than Io, though. I once took a second year university course on Logic Programming which had Prolog at the very core. The textbook and much of the workload for the course relied on using and understanding Prolog to learn the fundamentals of the course, and I did extremely poorly in it. In fact, I more or less gave up trying to understand and earned the worst grade out of my entire university career in that subject. So this time around I felt that I had something I needed to prove, at least to myself.

All of that said, it was still a big struggle. The paradigm is inherently unfamiliar to me, and it took a long time to understand even the basic exercises. The last couple of days I actually managed to implement something resembling a recursive insertion sort from scratch, which I was relatively pleased with, and the rest of the chapter was at least understandable. Take a look at my Github account if you feel like it – there are a lot of examples from the book and some of my own solutions to the exercises.

Would I use Prolog at my day job? Almost certainly not, but I feel like I’ve at least partially conquered the demons from university and I have definitely expanded my mind. Every time I learn a new language or new paradigm I feel the same exhilaration I did when moving permanently from shell script to Ruby. Now I couldn’t imagine even attempting any given problem in anything less than a complete programming language, and shudder at the memory of some of the horrors I used to write in Bash.

If you haven’t picked it up, I strongly recommend reading and working through this book, even if you don’t consider yourself a programmer (maybe you’ll find yourself one by the end of it).

Tags: , ,

Sunday, July 7th, 2013 Tech No Comments