Does this behavior have a better design pattern?

Grant Edwards grant.b.edwards at gmail.com
Thu Nov 8 10:47:33 EST 2018


On 2018-11-07, Peter Otten <__peter__ at web.de> wrote:
> lampahome wrote:
>
>> Above is I thought to make code clear, and this pattern is called simple
>> factory?

[...]

>> *Is there better design pattern for me?*

> Generally speaking you get better solutions when you ask yourself

>     "How can I solve this problem efficiently?"
> rather than
>     "What fancy design patterns can I use while solving this problem?"

I'd rather start with "how can I solve this problem simply and
clearly".  By "clearly" I mean that the source code is easy to
understand and reason about.

I don't worry about "efficiency" unless testing shows that the simple,
clear solution isn't efficient enough to meet requirements.

-- 
Grant Edwards               grant.b.edwards        Yow! And furthermore,
                                  at               my bowling average is
                              gmail.com            unimpeachable!!!




More information about the Python-list mailing list