Category ArchiveScala



Agile & Code Quality & Languages & Scala 16 Oct 2008 07:15 am

Rules of structured programming and Scala

Recently I have been reading “Clean Code A Handbook of Agile Software Craftsmanship” by Robert C. Martin. I was originally inspired to read this book after attending a talk given by Robert Martin at JAOO earlier this year in Brisbane where he talked about “Clean Code”.

With my current focus being on Scala, I find myself constantly thinking about some of the opinions and ideas expressed in the book in the context of the Scala Language.

While discussing techniques defining functions in “Clean Code”, Robert Martin refers to Edsger Dijkstra’s rules of structured programming.

Dijkstra said that every function, and every block within a function, should have one entry and one exit. Following these rules means that there should only be one return statement in a function, no break or continue statements in a loop, and never, ever, any goto statements.

… an excerpt from “Clean Code A Handbook of Agile Software Craftsmanship” by Robert C. Martin.

Why does this make me think of Scala? While the Scala language has both the for and while control structures built-in, the implementers of the language have chosen not to include the break or continue commands as part of the language.

I think it is a brave decisions for language designers to make the decision to exclude such entrenched concepts as the break or the continue command from a language. This exclusion will force coders to think a little harder about the best way to describe their intent in code. I think Scala have got it right.

Languages & Scala 14 Oct 2008 09:15 pm

Implicit Conversions in Scala

Scala 06 Oct 2008 09:15 pm

Testing Scala using specs

Scala 05 Oct 2008 05:26 pm

IDE and Ant support for Scala

Scala 05 Oct 2008 02:48 pm

Introduction to Scala