Chapter 4: Async is explained much to complicated

The Async chapter, the fundament of Vapor, is missing a good explanation of the underlying architecture and the working of asynchronous calls in Vapor. It needs an explanation of workers and the functions being used, like flatmap, map, flatten and how they work and when to use them.
I’am a rookie and I really want to understand what is going on, but this chapter is to complex for me.
Hope some rework can be done on this chapter in the next edition.

Any idea where to look for additional information on this topic?

1 Like

I totally agree. The chapter starts out well by showing a small diagram explaining the asynchronous process. What would have really been nice would to have shown a similar visual presentation of exactly what is happening with flat map, map, transform, etc. in the example. I don’t believe we are the only people having problems with this topic. Since Async is such a huge part of Vapor I really think it is glossed over in the book and in the chat room. I really don’t like the chat room too much since it seems that they really want to make you feel stupid when you ask questions.

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

I found some interesting resources that could be helpful:

API Docs: https://api.vapor.codes/core/latest/Async/Extensions/Future.html

Tutorial Docs: https://docs.vapor.codes/3.0/async/overview/

NIO EventLoopFuture (aka Future in Vapor) Docs: https://apple.github.io/swift-nio/docs/current/NIO/Classes/EventLoopFuture.html

NIO EventLoopPromise (aka Promise in Vapor) Docs: https://apple.github.io/swift-nio/docs/current/NIO/Structs/EventLoopPromise.html

1 Like

Hi guys, was there anything in particular you were looking to see? I’m currently updating that chapter for the next edition.

The main issue is that there’s a big learning curve but not much to learn! Once it clicks, it’s relatively simple, but getting to that point can be quite difficult.

Hi @0xtim,

An explanation of Futures and Promises and the underlying architecture, specifically the working of the eventloop, that’s being used would help for me. Also the functions flatMap and map can use more explanation. Maybe some concept used in Swift NIO can help to explain.

I think it’s very important that people understand these concepts of Vapor. I can use Vapor, by looking at examples, but I do not really understand what’s going on.

Kind Regards,

Jan Boersma

2 Likes

I will second this! I read and reread this chapter and it’s so hard to understand, not because the topic is complicated (I’m sure it is), but because it’s very NOT well explained.

Maybe instead of trying to explain everything in text, insert some small exercises here and there so we understand bits by bits and build up? As of now, the chapter is not understandable, and I feel stuck here and not able to continue the book…

Thanks boersma for the extra resources!