Help me pick an API design (OO vs functional)
michael.herrmann at getautoma.com
Tue Mar 26 15:33:18 CET 2013
On Tuesday, March 26, 2013 1:42:26 PM UTC+1, Dave Angel wrote:
> Also, it seems that in this thread, we are using "window" both to refer
> to a particular application instance (like Notepad1 and Notepad2), and
> to refer to windows within a single application.
> Anyway, if you're only automating a few specific apps, you're not likely
> to run into the problems that methods were intended to address. After
> all, Notepad's bugs haven't seemed to change for a couple of decades, so
> why should they fix anything now?
> Having a selected window be an implied object for those global functions
> yields at least the same problems as any writable global.
> Multithreading, unexpected side effects from certain functions,
> callbacks, etc.
> As long as you know the program is going to be simple, pile on the
> globals. But as soon as it advances, each of them is a trap to fall into.
You're right with everything you say. globals are bad and it may happen that this will bite me. I'm just not sure whether we should sacrifice the simpler syntax useful in say 80% of cases for something I'm not yet sure will ever become a real problem.
More information about the Python-list