So, it was an endpoint, and then go to API gateway, and then we changed to GraphQL, and then we changed directly to the Play. So, we were all changing the way that the data was reaching the application. So, if you put this in the application directly, you're copying the stuff. So, just give application or to actually get your data or anything else, cookie or whatever.
Okay. So, and again, organize your code around the business ideas, not frameworks. This is funny. Yeah. So, you should write... We should write our business rules as your product owner tells you. So, the user goes to the website, it does this, it does that, and it should describe your application like in a product owner perspective, because if you write the code like, I have this database, React does that, and then I have a router, it will be hard to assert that you are doing the correct thing because you are plugging tools to do your job. It's probably easier to describe what the code is doing exactly like someone asked, because the product owner probably doesn't have an idea what is React or GraphQL or this kind of stuff.
And this is something we already talked about, so the dependence rule keeps the tails away from the core, so you know that you need to reach data, but you don't need to know how to get the data. Yes, I just wanted to ask if you have an example, scenario for the second last point you mentioned, organize your code around business rules, not frameworks. So if you just take for example, this quiz app that you made, how would that apply to this quiz app? Yeah, I'm not sure if we have in here a specific example for that, but recently we had, for example, I can give an example from our daily routines. And we have a problem that we are trying to solve an issue. Maybe Ruben can help me to remember. So we were trying to do something. Give me a second. And, yeah, because we're expecting that the UI has to do something. So we're changing everything from plain form to a stepper. And we're trying to organize our rules according to the stepper because first we will show this step and this step has this fields. So at some point our domain needed to know that we are in the stepper. But, no, it didn't. So the way you shape your events, then it will actually, so you'll shape application the way your events go. So the user, so you have an input and then the domain execute an action and so on. So you start following this actions, actions, actions, actions. Because if we try to start, if we start to mold our domain the way it looks, then it's time to try to change the way it looks, it will be hard to change it back. So, the rules will be the same, because we are making the form, we have a validation for a field that is the same, doesn't matter if this field is shown in a step or another step or it doesn't matter. I'm not sure if I can explain somehow this question or I went around it. So, mostly have something that even do in architecture... Yes. Yes. So, if you define the events, anyone else can actually react to them. If you define your UI and your tools, you are stuck. So, that's what we're trying to solve. If we define the way our core works regardless... Regardless? Regardless, one of those words. Choose the correct one. You can shape the UI or any other services around them. So, this is the idea. So, be agnostic of what are you using and build the business agnostic of whatever are you using. So, it can build... It can use this core in other places. We have this long complex validation form in the client, and it can just take this bit and share it in the GraphQL, and it can evaluate the same input. It doesn't know that it even has any UI. So, it just needs to know that there is something going in, in those stuff and it comes out. So, it can share like all these core in the client, and in the GraphQL for example, or many other usages. So, that's the idea. I would say that if you have a UI layer, it should be completely independent of the other layer. And the X state, is it the UI concern is? Probably because I'm not very familiar with X state, but I think it's some kind of Redux thing, the state machine. Your core, your domain, basically is your state, in this case. So, what we will do here, we will grab our domain, and the UI will adapt it to a state. So, everything that your UI will know is the domain. So, it got, okay, my domain has this state right now. And then, the Reduxer will take, according to the event that we're treating, like something was loaded, something failed, notification from hell, who knows. The reducer of your X state or whatever state management you use, will take this new blob of information and it will adapt the state. That's why I call, actually, an adapter inside of the UI. Because all your input is the domain state. So, basically, already as some how a state management, because this can work independently of the UI, it can just make here a jQuery, re-reacting back to jQuery as it's vanilla JavaScript, can do the same stuff. So, you have something that has to take your domain, and according to an event that occur, it has to shape the state in case of having some kind of reactive framework, or just update your DOM directly. It's up to your strategy on an UI. So, we're using React, but you can use whatever or even nothing. And make everything easy to test. We have zero tests in this framework, but the fact that, actually, we can inject everything, you don't need to be mocking everything. So, you can just pass mock or pass whatever, so you don't need to, for example, if you wanna test if something was fetched, you don't need to render something, you just test it directly, because it can access each of the layers and test it, you need to test it. Because something that's very common is that we do integration testing to the unit testing. So, we render a full application to test if something is actually working, or a render-use component to test if something was done. So, here we are kind of avoiding all this overhead of rendering stuff in the unit test. I think that is a really good question.
Comments