I love writing code. What I love more is writing less. Less code means fewer unit tests because you have much less coverage to hit. Well organized, modularized, short, and concise. How do you achieve this? Good software engineering practices, code generators, and leveraging existing frameworks and APIs.
Leveraging Frameworks and APIs
As an AEM developer, you are working within a platform that comes with tons of OOTB frameworks and APIs. Visit the list of OSGi bundles at http://localhost:4502/system/console/bundles. For example, on a recent visit (AEM 220.127.116.11), I noticed Commons BeanUtils 1.8.2. I’ve yet to find a use case for it, but I made a mental note and filed it for a later day.
One of the better-known frameworks is the Sling Models framework. “Better-known” in that we all know the simple use cases. However, few know what is going on under the hood. Enough to merit its own blog post that’s for sure. In the context of this one, this is one of the frameworks to help achieve our goal.
Let’s take the simple use case of the AEM Granite Multifield. It seems every project I’ve worked on has tons of code to read and write multifield data.