News for hackers. Stuff that matters.
Re:The microservices cargo cult by gregmac on Tuesday October 06, 2015 @09:53AM (#10338852)
Aside, for both the circuit breaker and numeric overloads, is that a particular library you're using or just example code?

By themselves, the overloads for integers like that is pretty neat, never seen that before. I can actually think of several dozen places I do things like TimeSpan.FromSeconds(x) where that could enhance readability.

Re:The microservices cargo cult by radicalbyte on Tuesday October 06, 2015 @02:31PM (#10341202)
I was thinking the same thing - Extention Methods on the types of common literals can make for some very pretty interfaces.

In combination with operator overloads and implicit casts and you have some really powerful tools for building readable APIs :)

Re:The microservices cargo cult by togusa on Tuesday October 06, 2015 @10:17AM (#10339025)
It's a real library I wrote. I just noticed I missed the brackets. Quick example you can infer the rest from:

Code:

    public static class IntegerExtensions
    {
        public static TimeSpan Minutes(this int val)
        {
            return TimeSpan.FromMinutes(val);
        }
    }

Usage examples I can think of:

   var eightMinutes = 8.Minutes();
   var tenMinutes = 8.Minutes() + 2.Minutes();
   DoSomethingEvery(8.Minutes());
Re:The microservices cargo cult by gregmac on Tuesday October 06, 2015 @10:34AM (#10339130)
Yeah I figured. Is it published/OSS?
Re:The microservices cargo cult by togusa on Tuesday October 06, 2015 @10:42AM (#10339180)
Not at the moment. I've got a ton of stuff I probably could publish however.
Re:The microservices cargo cult by jmcqk6 on Wednesday October 07, 2015 @10:53AM (#10346362)
Just a note, because I started in the same way you have, simply writing my own extension methods in a common dll. The Humanizer library has a bunch of these features, including the 6.minutes() functionality:

https://github.com/MehdiK/Humanizer