07-06-2024

Case against 'case': how to write truly extensible code

09:00 - 10:30 Ferrum (280) Back to event schedule

Writing extensible code has always been a sort of a holy grail of Business Central, both for Microsoft and the ISV channel. Allowing third parties to extend your business logic without either interfering with your existing logic, or without relying on you to make changes on demand, has always been an issue. Recently, extensible enums seemed to allow free extensibility, but the practice has shown that marking enums as extensible is a big promise to make, and one that requires a lot more forethought than any other approach. This session puts our existing practices under a big question mark, especially when it comes to the 'case' statement. Often perceived as a cornerstone of extensibility and intricate business logic, the 'case' statement paradoxically stands in opposition to the principles of clean code. While in AL 'case' seems natural and necessary, 'case' statements in fact indicate lack of design and lead to rigid, inflexible code structures that hinder extensibility and maintainability. Furthermore, the session scrutinizes the 'handled pattern', a prevalent approach in extensibility that, upon closer inspection, reveals itself as an antipattern that emerges as a necessary evil in scenarios where extensibility is more important than clean, maintainable, reliable, or testable code. In the end, all these practices lead to high cost of building, testing, and maintaining solutions. Instead of only exposing the problems with existing approaches, this session provides alternatives at every step. You'll see how proper design and forethought coupled with some advanced coding practices and techniques can produce code that's easier to write and read, and also test, but that costs far less to maintain in the long run, and where extensibility comes as a natural, almost effortless outcome. This session will profoundly change the way how you look at writing AL code, and you'll leave with with one question only: "why haven't I known all this before?" That's a promise.

Speakers:

Vjekoslav Babic

Solutions Architect | MVP

Vjekoslav Babić, or just Vjeko as he prefers to go by in the community in a vain attempt to simplify his absurd Slavic name, is a Business Central architect, developer, trainer, author and blogger. With more than two decades of experience in the IT, he worked with vast range of technologies, but his passion has always been anything that had to do with the web and mobile worlds. Deep down, Vjeko is an incurable hacker who took quite a long time to realize that the one thing he really loves is writing code, plain and simple. He immensely enjoys breaking things apart to see how they work, not necessarily always putting them back together. As a frequent speaker at conferences, in his demos, and on his blog, he is always pushing the boundaries of what's possible, connecting the world of Business Central with just about anything that can be plugged into it through some obscure loophole or undocumented interface, especially if they are not meant to be used that way. In Vjeko's view, nothing is really meant to be used in any particular way and figuring out how to make things useful beyond their intended purpose is the meaning of life, in a way. Since spring 2010, Vjeko has been awarded the Most Valuable Professional (MVP) award for Microsoft Dynamics NAV. You can meet him at his blog "Vjeko.com - ideas in the cloud".