You can output product attributes in Magento using the following code :
getResource()->getAttribute(‘my_attribute’)) : ?>
getFrontend()->getValue($_product);?>
I have seen a lot of tutorials using code similar to the below :
getResource()->getAttribute(‘my_attribute’)->getFrontend()->getValue($_product);?>
This is bad practice in my opinion because if the attribute was to ever get deleted from the Magento interface by mistake then it could cause a “Call to getFrontend on a non object” PHP error, potentially breaking the page and hindering the users experience of the website. It is always good to write defensive code that will handle unexpected errors.