Day 256 & 257 of #LearnInPublic
🏭 Factory Method: In this blogpost, I explored the Factory Method design pattern.
👉 Instead of creating objects directly, you use a factory method that decides which object to create.
This keeps code flexible and easy to extend.
💡 Example:
🔹 A Dialog asks for a Button.
🔹 The factory decides if it’s a WindowsButton or an HTMLButton.
🔹 The app doesn’t care — it just works with a Button.
✨ Reflection for Cloak UI
🔹That’s how Cloak UI works.
🔹You don’t create or install brand-new components — instead, @cloak_ui wraps existing ones (like Shadcn, Heroui, BaseUi, ReUi).
🔹Just like the factory method decides which object to create, @cloak_ui decides which library’s component to use.
🔹The app only interacts with the wrapper, staying fully library-agnostic.
Blogpost - refactoring.guru/design-patt…#buildinginpublic#shadcn#heroui#baseui#reui#radixui#reactaria
I *thought* even web components didn't support it anymore. I think Safari threw cold water on inheriting from specific element types like HTMLButton - something about the Liskov Substitution Principle - there's an old GitHub thread somewhere
Having a little bit of fun documenting how to create powerful, reactive EXTENSIONS in Panel.
I've created a general HTMLButton extension. You can use it with any html element like <button>, <mwc-button> and <img>
Code: github.com/MarcSkovMadsen/pa…@Panel_org@materialdesign
IMO entirely one's own opinion, but I prefer to treat abbreviations as full words. So InvoicePdf, UserDto, HtmlButton, etc. Otherwise you can get messy names like HTMLAPIService, RandomAPIDTO, PDFDTO.
Are there any conventions for casing acronyms in #PHP class names? InvoicePDF vs InvoicePdf / UserDTO vs UserDto / HTMLButton vs HtmlButton? What do you use? 🤔 #Laravel