{@thread.name}

wout2938
2023-05-15

wout2938:

Demo of what an Ash tutorial with Livebook could look like

billboz:

Thanks for putting this together!!! I am going to go through this right away

wout2938:

Nice! Let me know if you have any feedback + it’s still missing some chapters

wout2938:

<@305006367196971012> was wondering if you managed to go through it. Was it useful? What’s missing for you? Still expanding it but wonder what a good first version would be

billboz:

<@319176904751972362> Yes, this is a fantastic resource for learning the basics of Ash! It would be fantastic to have a badge for this livebook in the Ash guide as a secondary resource for learning about Ash, <@&711272163755163698>.

You did a great job keeping your instructional style consistent and the instructions seem to be complete, well done!

This is close to what I would consider good enough to be included in the documentation. I would like to see some links to the appropriate Ash documentation, similar to what are in the current docs. For example, when ‘create_timestamp’ was introduced add the link to the documentation https://ash-hq.org/docs/dsl/ash-resource#attributes-create_timestamp . I am sure you have intentions of doing this already.

If you would like some help with the simple stuff like that then lets chat :). I offer to help with the simple stuff because I am at the relative beginning of my programming journey.

zachdaniel:

<@305006367196971012> thanks for the recommendation 🙂 I’ll chat about this with the rest of the team. If we include it in the documentation, then realistically we’d need to “own” it (i.e it would need to live under ash-project/ash_livebook_tutorial , if you’re open to that idea <@319176904751972362> (you’d still have full access to the repo) then lets chat 🙂

wout2938:

<@305006367196971012> thanks for that, yes some links to the docs are a good idea. I’ll make work of that.

<@197905764424089601> I’d be perfectly fine with that, as long as I can edit them it’s good 🙂 I’ll be working on it a bit more, there are still a bunch of Ash concepts I can tackle

wout2938:

I’ve added some more tutorials:

wout2938:

It’s a good base, doesn’t cover everything in Ash but that’s not necessary for it to be useful. Would love to have it expanded with more advanced topics, but for now I’ll stop working on it. Also happy to take contributions and feedback

Like mentioned I’d be fine with making it an official tutorial resource and move the repo into the Ash project

zachdaniel:

I think this is coming alnog really well

zachdaniel:

I keep meaning to talk w/ other core team members about this and go through it with them

zachdaniel:

see how we feel as a group about bringing it into the fold and point users there from the site

wout2938:

Thanks <@197905764424089601> Let me know if you have any feedback for it, happy to adjust wherever necessary for it to become an official documenation resource

g6:

As per discussion I’m adding few ideas to consider for more advanced tutorials. These are something I am planning to experiment with and I believe they do touch on more advanced topics but are also quite relatable in the real world so it could be a good resource of inspiration for the community. (Note, as I’m new to the ecosystem I’m not sure how feasible they are from the point of view of what the framework would do, but having gone through initial guides and few additional resources for me these would be the next logical step to try out)

g6:

  1. Mapping resource to external api.

Let’s assume there is a REST api handling CRUD operations for a collection. Create resource with CRUD support wrapping the external api so internally it can be treated as just another resource, while it’s using REST to manage the state. (This in fact could reuse previous tutorials where rest api is being created in Ash - for example, let’s say a follow up of Ticket resource from the guide)

Things to consider in the scenario:

  • Authorization headers need to be present
  • Capturing different rest statuses and mapping to :ok, :error
  • Transaction support for typical resource with rest based resource
  • Handling situations where REST api is down

g6:

  1. Two separate authentication flows for a single app.

Let’s consider an appolication composed of 3 pieces of functionality:

  • standard website
  • customer area (ash authentication)
  • backoffice (ash authentication, different strategy) Customer and Operator are treated as separate resources with different auth strategies, both use ash authentication but also both have different styling considerations for built-in sign-in/sign-out pages.

g6:

  1. Many to Many with metadata

Let’s consider two standard resources: Article and Image, where there is many-to-many relationship between them, but also the join table has extra fields:

  • label (string)
  • order (integer)

In such scenario let’s consider an article, where every image can optionally have one of the two fields filled. Use cases for this can be as follow:

  • mark label as ‘cover’ so the article can display predefined image on a listing page
  • display article images in predefined order Things to consider for the tutorial part:
  • the way to load metadata when loading articles (as a list)
  • the way to load metadata when fetching individual article
  • for ‘cover’ use-case add calculation that would populate the cover attribute with Image record if one is present in such collection

g6:

  1. User with Role

Two linked resources User and Role, and a set of policies to apply to say Article resource based on the Role queried from datastore. Simple but also expanding on the policies topic with more advanced example.

g6:

<@319176904751972362> As discussed, have a look, see if any of it makes sense 😉

wout2938:

Thank you these are great 🙂

g6:

There are more where this came from 😉

g6:

but these topics were at the top of my list to see how similar things can be done in Ash, with Ash mindset

g6:

also, I know it’s probably contentious topic, but good practices for solving some of these puzzles would probably be a good thing to. For me, as a beginner, it helps to see the opinions and learn good habits early. Later on I might disagree and take on a different route once I know the toolset but to start with, good habits are long term benefit imho

g6:

oh, and I volunteer to test drive the livebooks 😛

wout2938:

I think that’s not contentious at all. For me I learn best when I can do things, and it helps to early on follow a certain style/best practice so I can focus on understanding core concepts. Then later on, like you said, you can divert in style and practices where you see fit 🙂

g6:

btw, ignore bulletpoint indentations, can’t seem to get them to the same level

nefcairon:

<@319176904751972362> Just started with it. Thanks for creating this.

Is there a reason why the order is “show solution” and then “enter your solution” and not the other way?

Further I get the warning warning: the Inspect protocol has already been consolidated, an implementation for Tutorial.Profile has no effect. If you want to implement protocols after compilation or during tests, check the "Consolidation" section in the Protocol module documentation

wout2938:

Thanks for the feedback, that warning is something I also get, not sure why but you can ignore it. Maybe there’s a way to disable it, not sure

The order of the show and enter solution can be changed if it makes more sense that way, I would be open to that 🙂 got the main structure from the dockyard tutorials

zachdaniel:

Hey <@319176904751972362> I’ve got more than a few pieces of great feedback on this, sorry for the delay. I’m going to put this up on the website. Would you mind giving me contributor access to the repository?

zachdaniel:

Actually, perhaps you could transfer it to the ash organization, and I can grant you access to make edits/merge things?

zachdaniel:

Once we get that settled, I’ll put up the badge on the site and in the docs 🙂

.terris:

If this gets moved can someone please post a note to <#830119171978559518> or <#1066222835758014606> or … ?

wout2938:

So sorry <@197905764424089601> I had this channel muted! Let me know what should be done, I can give you access or I can transfer it. I just tried transferring it but it is blocked since another repo already exists. https://github.com/ash-project/ash_tutorial

I can rename it or you can remove the archive, let me know what you’d like to do

wout2938:

zachdaniel:

Giving me access would be the best way to:)

zachdaniel:

And I’ll figure out the name conflict there

zachdaniel:

I’d need like super user access to be able to move it I assume

wout2938:

I’ve sent an invite

wout2938:

Checking how I can give super user access

wout2938:

Or maybe you have already?

wout2938:

I think that worked?

zachdaniel:

Alright, moved over to ash org 🙂 https://github.com/ash-project/ash_tutorial

zachdaniel:

Next step is to put up a badge notification on ash-hq 😄

zachdaniel:

I will try to get to that in the next few days, but <@319176904751972362> if you are interested you could PR to ash-hq 🙂

wout2938:

Any specific place you think would be good to put it?

zachdaniel:

🤔 not really sure! I think maybe next to the Get Started button on the front page, and then maybe just a markdown badge at the top of the guide in ash core

zachdaniel:

I’m pretty sure the markdown parser should handle badges

zachdaniel:

I hope 😆

wout2938:

wout2938:

yes no?

wout2938:

maybe hide on mobile as I don’t think anyone is running livebook on mobile

zachdaniel:

🔥

zachdaniel:

its released 🙂

zachdaniel:

<@319176904751972362> do you have a twitter handle?