Forums

What features of Cobra is this code not taking advantage of

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

What features of Cobra is this code not taking advantage of

Postby torial » Wed Feb 03, 2010 8:54 am

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).
Attachments
wordMatcher.cobra
This is a program that will try to make a somewhat naive guess as to translated words, given a TMX.
(16.27 KiB) Downloaded 218 times
torial
 
Posts: 229
Location: IA

Re: What features of Cobra is this code not taking advantage of

Postby Charles » Sat Feb 06, 2010 12:30 am

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.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: What features of Cobra is this code not taking advantage of

Postby torial » Sat Feb 06, 2010 1:13 am

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 :roll:

I will definitely wish to refactor that. Thanks for taking a look.
torial
 
Posts: 229
Location: IA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 86 guests