News for hackers. Stuff that matters.

dandlift

Re:Problems with Swagger on Tuesday April 04, 2017 @06:03PM (#14037661)
In my team we established a process where our first step is to write down the spec of the API, in swagger format.

The spec is the source of thruth, and is written manually in yaml (that's not that painful). The implementation comes later. Unit tests check that it conforms with the spec. [1] We also have a fake API almost completely autogenerated from the spec that's quite useful for preliminary testing of the clients.

Client code generation wasn't up to my expectations, but I've experimented with applying an handwritten template to a parsed spec and that seems viable.

Swagger as a format might have its quirks, but the tooling is there and having it as the authoritive source of thruth paid off for Us.

[1] https://bitbucket.org/atlassian/swagger-request-validator

Re:Your DI framework is killing your code on Tuesday September 29, 2015 @11:18AM (#10296903)
Agree, I also find useful to split between domain concerns and application concerns.

A report is something that belongs to business, but the fact that it could be sent via email is totally accidental and depending on the technology we use (as it is the persistence layer, or the protocol which exposes the app).

Domain concerns live on domain object (which knows only other domain objects), while application concerns live in services. And here is where you have interfaces, concrete implementations and, where necessary, factories to switch or add the implementation at the flip of a switch. Eg: a ReportMailSender which implements a ReportSender, that someday get replaced with a SlackSender implementing the same interface. You want both? Wrap them on a AggregatedSender.

Now your DI framework is getting really useful.

Re:Functors, Applicatives, and Monads in Pictures (2013) on Thursday September 24, 2015 @08:36AM (#10271228)
My take, with no pretension of being accurate:

Say we have a function with signature

    f :: Int -> Int -> Int -> Int
Let's say this just add those Ints together.

Now let's create another function by partially applying the initial function: f1 = f 42

f1 signature will be

    f1 :: Int -> Int -> Int
Kind of "consuming" the signature. Repeat this until using up all the parameters. You end up with a function with no parameters, which map to a single Int.

You could say that f3 -> Int (note, not a valid notation for the sake of example). No need for a different symbol.

Re:BlaBlaCar raises $200M at $1.4B valuation on Tuesday September 22, 2015 @11:42AM (#10259290)
Seren and Fradow you are right, checked again now. Seems like the Italian site is still in the process of introducing the booking fee, while for the majority of the trips you can still contact the driver directly. This all makes sense now.
Re:BlaBlaCar raises $200M at $1.4B valuation on Tuesday September 22, 2015 @09:04AM (#10258259)
Source? I had a few trip with blablacar and I always paid in person. There was this legend that this was the case only for the Italian market, but you had to pay through the app in other countries. But as far as I can tell the platform works the same in Italy, UK and France. I once had a trip from London and again, I paid the driver directly.