
Lesson Description
The "Implementing Garden Domain Models" Lesson is part of the full, Domain Modeling for Humans and AI course featured in this preview video. Here's what you'd learn in this lesson:
Mike walks through the implementation of the garden domain models by creating types and entities in the source folder. He focuses on building a workspace schema with zones, item placements, and garden metadata.
Transcript from the "Implementing Garden Domain Models" Lesson
[00:00:00]
>> Mike North: Let's transition back to implementing this. We're gonna need some new types and we're going to need some new entities. And let's get cooking. So we're going to go back to our types folder. We have entities to create. Not our dist folder, our source entities folder. And I'm going to close out some of the stuff from the last exercise.
[00:00:20]
Let's see, we have a little bit of a starting point here. We have a garden and I think it looks like there's something complicated here. A function that generates a type. So we're gonna create a WorkspaceSchema. Oops, this is actually not right. But it's a good opportunity for us to go and fix this.
[00:00:47]
What we want is to build on this concept of zone. So zone, if we think about our other bounded context. I'm going to go back to this, right, We've got workspace, that's the garden zone. That's the bed within the garden. Item placement, we'll call that the plant item is kind of the seed packet, right?
[00:01:17]
It's the source of information for what is this thing all about? Let's look at workspace, not zone, workspace type. It says create workspace schema for item type. We can see great takes in some arguments. That's like the item type, the metadata for the workspace, the metadata for the zone, it's got an array of zones and then it's got some metadata.
[00:01:45]
So we have opportunity for metadata on the garden and then a zone below that we've got placements. So those are like ItemPlacements. To put like a placement would have to have an XYCoordinate of some sort. And let's see if that looks right. Hey, look, we've got a position with an XYCoordinate and an item.
[00:02:07]
And this might. This might be a seed packet or something like that. And then what does it belong to? Yes.
>> Speaker 2: Have you tried using, sorry, have you tried using Cursor to scaffold some of these types before?
>> Mike North: Absolutely. Cursor is quite good at scaffolding these types. And especially, my big pro tip here would be if you have an entity that's related to this, leave that information in the code comments.
[00:02:38]
Leave yourself a little path relative to your project route to follow so that if Cursor finds itself updating this, one of the first things it does is it reads the entire file. And if you've left notes, whenever you update this, make sure to go and check that it threads through this other thing, Cursor will be pretty good at figuring that out.
[00:03:02]
I'm not doing that right now because I would just start typing a couple characters and it would just be spitting out a lot of things, and it gets a little bit more difficult to kind of follow what's going on. So we've got item placement, we've got zone, and we've got workspace.
[00:03:18]
So let's back up here and go to garden. Great. So we've got create workspace schema for item type, we pass in the plant schema, we pass in some object that represents metadata on the zone. I believe that's what this is. Zone metadata schema is the first one, and then workspace metadata schema is the second one.
[00:03:46]
Just double checking that. Yep, zone and workspace, great.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops