Recently released on pub:

Show more releases

Latest Blog Posts

Memento Not As State

Chris Strom, on 28 Nov 2015
I really need to cut out the extreme late night coding. I left off last night with a fully formed planned to increase the "Dartiness" in my memento pattern example, but in the light of day I haven't the velvet foggiest notion what that plan might have been. No pity here though, there is still something to say about the existing code.I am curious about the relationship between the internal state of the originator and the memento object. In particular, should the memento object be the state in the originator class? After last night, that is exactly what the VelvetFogMachine... read more

A Better Memento Example: Now with More Encapsulation!

Chris Strom, on 27 Nov 2015
Up tonight, I take a closer look at encapsulation in the memento pattern. I have a decent start on the pattern from last night, but I glossed over one of the important reasons behind the memento pattern. Per the Gang of Four book, the pattern is applicable when obtaining state would break encapsulation.Currently, the caretaker of the pattern plays a song, remembers the state on occasion, and replays particularly good Mel Tormé songs: List<String> replayer = []; var scatMan = new VelvetFogMachine(); // ... 'New York, New York Medley', 'A Vintage Year' ); replayer.add(scatMan.nowPlaying); // ... // The New... read more

The Velvet Fog Memento

Chris Strom, on 26 Nov 2015
I'm picking patterns to explore for Design Patterns in Dart by throwing proverbial darts at whatever design pattern book happens to be closest at hand. Up tonight is the memento.I don't much care for the abstract nature of the examples in the Wikipedia article on memento. The constraint solver example in the GoF book always seemed too academic to me (though I recognize the importance of constraint solvers). I would prefer an example to which everyone can relate. Maybe something like a machine dedicated to building the ultimate Mel Tormé playlist. Everybody can relate to Melvie.The "originator" in this scenario... read more

Testing Patterns

Chris Strom, on 25 Nov 2015
Tonight, I start testing the code in Design Patterns in Dart. I expect my testing approach will evolve as the book is written. For now, I plan to test code used directly in the book (for obvious reasons) and some of the experimental code that I use to explore patterns before writing.To start, I will write some tests for the Flyweight pattern coffee shop example with which I have been playing. I start by adding the test packages to the list of development dependencies in my pubspec.yaml:name: flyweight_codedependencies: reflectable: anydev_dependencies: test: anytransformers:- reflectable: entry_points: - bin/coffee_orders.dart formatted: trueAfter a pub... read more

Moar Better Rainbows! - mcpi_dart 0.0.4 Minecraft and Dart

Davy Mitchell, on 25 Nov 2015
I recently purchased a Raspberry Pi 2 with the snazzy 'official' case, so it was time to dust off my old Dart Minecraft library for an update. TLDR : Moar Better Rainbows! Screenshot from the PC version of Minecraft. The setBlock method now takes an extra parameter for data which allows the use of color on blocks such as wool. This means the rainbow can now be drawn in better colours. Yay! The getPos method now returns a list of int's so the rainbow is built close to the player's position in the game. You may need to spin around... read more