[Chicago] Factoring fun with functions in Python
shekay at pobox.com
Fri Nov 16 16:22:38 CET 2012
On Thu, Nov 15, 2012 at 9:35 PM, Tal Liron <tal.liron at threecrickets.com> wrote:
> It's not just playing with text, it's adding a point of control.
> To you use your excellent example, here are a few things you can control
> with get_cursor, which would affect the entire application:
> 1) Write to the log every time you get a cursor.
things like this. yes. cross cutting concerns like logging and
monitoring really get in the way. have some unnecessary cognitive
overhead when you are reading the code for the real point of it.
I do often hate how aspect oriented programming turns out in the real
world with the burning passion of a million million suns, though, so a
topic for another discussion is how to not to invoke the hate and
maybe things like python or other dynamic languages make it much
better than things like java/spring.
> 2) Return mock cursors instead of real ones, for testing.
> 3) Maintain a list of all cursors used by your application, and have a
> watch-dog thread notify you when they are held too long. Find bugs fast.
> 4) Wrap or monkey patch the cursor instance to support more functionality.
> I like my cargo cult. Pays the bills.
props to this entire discussion.
More information about the Chicago