It has been said that immutability changes everything. But what does that mean in practice? What does it mean for existing code that looks more like the mutant apocalypse than an elegant application of mathematical thinking?
Full immutability is not always possible. Refactoring, on the other hand, is all about the art of the possible. In this hands-on workshop (bring a laptop!), we'll be looking at some tricks and tips to help reduce mutability in code.
Maximum number of participants: 16
Target Audience: Developers, Architects
Prerequisites: Java or C# knowledge
Level: Advanced
Extended Abstract:
It has been said that immutability changes everything. But what does that mean in practice? What does it mean for existing code that looks more like the mutant apocalypse than an elegant application of mathematical thinking? Mainstream programming languages are normally grounded in imperative styles — from updating local variables to updating records in databases. But although they have grown from imperative roots, languages such as C# and Java are expressive and evolved enough that they can embrace many different approaches. Indeed, trends in the development of many languages have made immutability and the reduction of mutability easier to support.
Immutability is attractive because it makes code easier to reason about, reduces the possibility of many classes of bug, improves the testability of code, reduces the amount of validation and error-handling code, makes code more scalable when threaded and makes code more thread-safe. However, immutability can be an ideal that is hard to reach, and much advice doesn’t cover enough of the situations developers find in their codebases. Refactoring, on the other hand, is all about the art of the possible.
Whether you’re working in the cloud or on the desktop, in the mobile space or on the web, steering your code and design style towards immutability offers both short-term and long-term practical benefits. In this hands-on workshop, we’ll be looking at guidance and practice to help reduce the mutability of state in your codebase.
So bring a laptop, but don't worry about IDEs, editors, compilers and all that — just a browser and WiFi access! We'll be running the hands-on part using cyber-dojo.org, working with unit tests and good humour :-)
Kevlin Henney is an independent consultant, speaker, writer and trainer. His development interests are in programming, practice and people. He is co-author of two volumes in the ”Pattern-Oriented Software Architecture” series, and editor and contributor for multiple books in the ”97 Things” series. He lives in Bristol and online.
Vortrag Teilen