What features of Cobra is this code not taking advantage of
Posted:
Wed Feb 03, 2010 8:54 am
by torial
I was thinking about submitting the attached code for a Sample, but was thinking that it might warrant some changes to make it more "cobranic" (if that's the word.. just doesn't roll off the tongue like pythonic does).
Re: What features of Cobra is this code not taking advantage of
Posted:
Sat Feb 06, 2010 12:30 am
by Charles
Cobratastic?
I didn't have time to scrutinize it line by line, but skimming over it, it seemed to be just fine.
One thought that crossed my mind is that the functionality and the UI seemed to all be mixed together. Another way to structure a program is to write library-style code that performs the functions (matching, file I/O, etc.) and then UI code that uses that. The first kind of code is often called "domain code" or referred to as "domain objects".
In such a structure, it's often easier to bring contracts and unit tests to bear on the domain objects as well as use them in other contexts (utilities, web service, web site, system service, etc.).
But maybe this was outside the scope of what you wanted to do.
Re: What features of Cobra is this code not taking advantage of
Posted:
Sat Feb 06, 2010 1:13 am
by torial
Agreed -- I had been thinking about that as well. I'm getting my wings of making UIs w/o a GUI, and find that I'm picking up my old wxPython bad habits
I will definitely wish to refactor that. Thanks for taking a look.