![]() ![]() The book is ideal for studying computer simulation and modeling with the free AnyLogic Personal Learning Edition. This simulation book is designed for use in self-education and in university. If you want to learn more about them, follow me and we can try to heal our Horcruxes together.This is a practical textbook on AnyLogic simulation software from its developers. At Yozobi, we're making a bet that state machines are going to change web development. Try working through a problem with a fellow dev. If you're having trouble deciphering the logic of a legacy app, try visualising it in XState. But by clicking through the machine, they can concretely see how the app works, and feel comfortable making changes. State machines don't create complexity, they reveal it. Their usual first reaction is one of terror. Weeks later, when it needed extending, I was able to insert a new piece of state without breaking anything else.Īny time someone needs to see how the viewing page works, they can fire up the visualiser. I can which actions are called on which events.Īt an early stage of the process, I was even able to ask the client about complex interactions in the logic, just by walking them through the statechart. ![]() I can see which conditions lead to which states. Here's what I ended up with:Įvery part of this crazy complex app can now be visualised. ![]() I even wrote a VSCode extension so I could have the visualiser inline as I went along. I knew that if I wasn't careful, I'd end up with 25-30 horcruxes under my belt, logic carried in dozens of event handlers. For instance, the modal reducer above could be expressed in this statechart. It produces clickable visualisations which you can share and walk through. I'd been using XState, and read that it could be used for visualising complex behaviours, such as Ryan Florence's checkout: I needed to handle multiple user types, chat, notifications, input changes. Most of the business logic would take place on a single page - the chat portal. I recently embarked on the most complex task I'd ever attempted as a developer - building a video chat app with multiple third-party integrations. You can try to colocate as much as your logic as possible, for instance using ducks patterns.īut now we know that visualisation can prevent bugs, why not go further? You can push to make your code more readable, writing clean event handlers which don't contain any logic. There are several ways of mitigating horcruxes. Let me make this plain: Any code that cannot be concretely visualised will, at some point, result in a bug. If it can't be visualised, it can't be modified, deleted or extended safely. Logic split into more than one place cannot be visualised. I have wept over classes with dozens of methods, sequences with dozens of asynchronous steps. The trouble comes when you reach six or seven, split out over several 800-line files. ![]() You can survive one or two splits in your business logic. The first Horcrux is never really the issue. The soul of your business logic has been split. If there's a bug with the way the modal opens, there are now two places you need to check, the reducer and the event handler. The onClick handler is now making the API check to see if it should open the modal. Enter fullscreen mode Exit fullscreen mode ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |