Friday, October 15, 2010

"Failure of State" by Uncle Bob - SCNA 2010

This is the first of many blog posts to come, with my notes on the talks given at SCNA 2010.

This morning, on the first day, Uncle Bob gave a talk titled "Failure of State." My notes on the talk are below.

SICP - Uncle Bob has mentioned this book many times, and I finally put it on my Kindle today. As a craftsman, you should definitely read this book. It's free but if you can, buy it to support the authors. There are also free lectures available as well.

The substitution model - you can replace function calls repeatedly, ending up with a "silly" version but one that is also stateless and thread-safe. The example given was a program that printed the squares of the first twenty (20) integers.

Many stateful programs exhibit temporal coupling; that is one statement (function/method/etc) must be called before another. In other words, time matters. For example, opening a file, then closing it.

However; in functional programming, y=f(x) no matter when you call it and every time you call it.

Programming has seen three failures so far: 1) the GOTO statement; 2) pointers to functions, and 3) state. Finally, Uncle Bob showed the CQRS pattern, where CRUD is separated into CUD and R.

No comments: