How to dynamically create Extended Attributes/SubTypes

Over the last six months, I've been working on numerous projects that require me to work with extended attributes in Mura CMS. While it's easy to create them manually, creating them programatically provides even more functionality and flexibility.