Transforming Output from the Database to the View/REST layer
Having watched the screen cast here by Jeffery Way and reading Phil Sturgeon’s Build APIs You Won’t Hate I used this approach on a recent project. Basically, and they both cover it really well, instead of returning the data right to the ui/rest endpoint from the database I pass it through a class to transform the data formats, field name etc. This has been extremely helpful as we also work out some wording of fields that I can not do easily in this one class.
Keep it (functions/methods) small and simple
I have been doing some work using Oop and have a lot of re-factoring to do since I did not keep my methods small and simple. Often they use other methods or presume a certain amount of constructed parameters. When I was working strictly in procedural programming I would make my functions small and tie them together like the Unix command line tools. But then I had issues with having to pass too many variables all around.