Retlang
There are 18 entries for the tag Retlang

OK, this isn't going to be a line-by-line code quality review.  Anyone who is interested can take a look (and will find the quality is excellent).  This is about my experiences so far using Caliburn Micro for relatively simple UIs. First off, let me say that I'm unaware of any competitors to CM and, at the time of writing, I can't imagine ever not using it unless I decide to build my own.  If I built my own, it would probably look quite like CM. Convention Based Binding This is the raison d'etre of CM, and it...

...but I sure don't.  After promising that I had posted my very last article on the subject of load balancing, I spent another three months tweaking the code I'd put up in production.  The gist is now pretty close to the production code (there's a couple more Console.Writes so you can see what's going on).  So, here's what I learned: The reason QueueChannel and the nServiceBus distributor are dumb is for a very good reason: even small, rare failures in the distribution code can be horribly fatal.  This I knew intellectually, but not in my gut.  The code now...

Sometimes i think I spend my time on this blog just trying to explain the thinking of people much smarter than me.  This is definitely one of those cases.  I've probably learned more about programming from reading the Retlang source code than any other.  It's both remarkably free of compromises and easy to read.  Sometimes you learn not from any individual snapshot, but from the evolution of the code base.  For instance, here was the process context factory in Retlang 0.3: public interface IProcessContextFactory : IThreadController, IObjectPublisher { ...

When you subscribe to a channel in Retlang, you get an IUnsubscriber back.  The equivalent of this in Rx is just IDisposable.  This makes AnonymousDisposable is a fairly vital class in ReactiveExtensions. I even used it in the last post. It's a pity someone decided to mark it as internal (again).  So here's another implementation of it: public class AnonymousDisposable : IDisposable { private readonly Action _onDispose; public AnonymousDisposable(Action onDispose) { _onDispose = onDispose; } public void Dispose() ...

Since Reactive Extensions seems to have no documentation worth speaking of, I figure it's worth writing up stuff as I learn it.  One of the major differences between Retlang and Reactive Extensions is that Rx has a first order concept of a message source.  ISubscriber defines approximately the same interface as IObservable, but the only implementation is Channel, which is the equivalent of subject.  A fair number of methods within Rx are geared to producing sources to react to. So, let's consider the following extremely boring Rx source: public class NumberSource : IObservable<int> { Subject<int> underlying...

Most of the talk about Rx has been about the "Push LINQ" aspects of it, so I thought I'd have a bash at explaining it from a Retlang perspective instead.  Let's start with IObserver: public interface IObserver<in T> { void OnNext(T value); void OnError(Exception error); void OnCompleted(); } Now, in the same place Retlang just uses an Action<T> (or IPublisher<T>, depending on context).  If you want to catch exceptions,...

For those of you bored with this problem, I promise this is the last time I post about this.  That's because I've finally come up with a solution I actually like.  Here, the model is that the message order still matters, but the state is in a database, rather than in memory.  This allows us to change our minds about which thread runs which orders.  I got the idea from reading about sharding and resharding strategies.  One of the approaches to resharding is to assign everything a "virtual shard" where there are a lot of virtual shards and only a...

Okay, it's time for one of my Friday code dumps.  I'll warn you now: this post is ten pages long and I'm not really happy with it.  It's probably going to continue to develop over time.  However, one of the things I like about Clojure is something I like about Retlang: the code is short.  As developers, we know you can't measure productivity, but still, we tend to associate large amounts of code with large amount of functionality, which in turn we associate with "better". Retlang, on the other hand, is full of short pieces of code that do...

You really owe it to yourself watch Rob Eisenberg's amazing MVVM talk and download the source code.  There are so many neat things in this talk it's hard to know where to start.  Basically, he's written a short, understandable, piece of code that shows how to develop Silverlight applications in a manner with which an ASP.NET MVC developer like myself can be comfortable.  I really liked the "co-routine trick", so I thought I would write something explaining it in greater depth. The basic trick is to use yield return's "co-routine like" execution form an IEnumerable sequence of what code...

I once took advantage of the published source code of the Microsoft Enterprise Library Data Access Block to make some firm-specific modifications.  One of those changes that only really makes sense in the target environment, nothing particularly general.  The Data Access Block, for those of you who aren’t familiar with it, is basically an improved version of the ADO.NET API, with some pretty useful support for stored procedures.  It’s not NHibernate, but it’s better than coding the API in the raw. While I was there, I decided to rip out the stuff we didn’t use.  That turned out to...

Let's see if you can spot the difference.  Your manager comes up to you and says We need to get invoices from our order system into our treasury system.  What we were thinking was: we'll get the order system to export its orders onto the file system, and the treasury system can read in the files and delete them when it's finished.  How long should that take? We need you to write a robust queuing solution.  How long should that take? The answer is, of course, that there's no...

Previously, I talked about patterns where you were unlikely to implement them yourself, since they are now considered part of the infrastructure that goes with a modern language.  The publish/subscribe model isn't quite ready to be described as infrastructure, but it's getting close.  So, here are two patterns I don't honestly think it's worth knowing.  Here, it's not so much that the patterns are bad, just that you're better off understanding and using the publish/subscribe model.  Here's how the pub/sub model works: Participants are called services. They do not communicate directly...

Retlang 0.4 has been out for quite a while, but I've never written about it.  Worse, my example code doesn't work in it, which has garnered complaints (in my defence, the Retlang wiki is out of date as well).  The version is again a restructuring that you shouldn't apply to your own code without a bit of thought, but it's added a killer feature: the ability to interact with WinForms.  Or WPF if you're that way inclined. Anyway, I've drawn up a new version of the spider, but it differs quite a bit from the previous versions: It now...

I've been watching some very excited tweets go past about concurrency improvements in .NET 4.0.  I've got to say, I'm quite looking forward to hearing about this once the NDAs drop away (not an MVP, nor am I likely to be).  Retlang is pretty much the only game in town for concurrency right now, and it's quite hard explaining to people the problem it's trying to solve.  The standard question is "what's wrong with using Threads"?  The work the Maestro team is doing looks exciting as well, although I'm a bit dubious about the benefits of a language rather than...

I've converted over my Retlang spider example over to IronPython in order to get a feel for the differences.  Here's some notes: Python list comprehensions can do the same as LINQ for simple cases, but LINQ is much more powerful, and it supports deferred execution, while list comprehensions are evaluated greedily.  UPDATE: Thanks to Mark for pointing out that generators support deferred execution.  There's still no syntax for grouping or ordering, but these are relatively rare cases. Every description of the python syntax I ever see emphasizes the fact you don't...

I've lost count of the number of times I've seen a technology that looked great in the sample, but didn't hold up when I took it for a proper test drive.  Mike Rettig, on the other hand, has really thought through the use cases.  So when you try to take a sample program and hit the real world, you discover he's been there before you.  Here's some highlights: Everything implements interfaces.  You can mock or stub pretty much everything.  (You might want to create your own abstract factory, though.) Not only does...

The Retlang wiki is a bit short on the sort of messy examples that I find useful when learning a product, so I thought I'd write one of my own.  The following is a 200-line web spider.  I'll go through it and explain how it works and why you'd build it like this.  I recently used techniques similar to this to get a FIX processor to run 30 times faster.  Seriously.  Retlang's that good. Five minute introduction to Retlang Here's how Retlang works: A Context is a Thread/Queue pair.  That is to say, a thread with an associated queue. ...

Well, in the words of Scott Hanselman "We'll see how long this lasts.".  Anyway, I should start as I mean to go on by providing some code that's actually useful. I've been using Mike Rettig's Retlang library a fair bit recently, and have nothing but praise for it.  I'll go into more detail about why it's great at a later date, but here I'll just detail a problem that I encountered and how to solve it. Let's say that you've got a system that writes to the database and you need to bring the database down.  You need to stop...