I can add my three cents...
Monday 21 of April 2008 19:18:16 Joe Claborn napisaĆ(a):
> If this is not the right place to ask this question - please forgive me and
> point me in the right direction.
>
> For various reasons - we are starting on a project to convert a 60,000 line
> QTPerl program to wxPerl. My question is how to organize the UI so that we
> can keep a clean separation between the UI and the code that manages the
> database transactions.
>
> I've been looking at wxGlade to aid in the screen layouts. I see that it has
> way to produce perl code with markers indicating the wxGlade generated code.
> In a real project - how does this work out ? Is there a better tool to use?
>
> Does anyone have some experience that they would like to share?
I can see here two problems:
PROBLEM 1:
> to convert a 60,000 line QTPerl program to wxPerl.
PROBLEM 2:
> to organize the UI so that we can keep a clean separation between the UI and
> the code that manages the
> database transactions.
-----------------------------------------------------------------------------------------------------------------------------
RE PROBLEM 1:
I had similar problem. I have an database application (engine rather) which
primary was written for win32::gui in windows (and works in it). The
application has about 6500 lines. I do not think the length means that
application is 10 times smaller, because this is some kind of engine to run
special kind of script file (each file contains about 30-150 lines, and
end-user application has about 50-100 the script files). The script files
contains end-user logic of the application.
I wrote it you have better view.
I knew that some day I wanted to rewrite it to work in linux and therefore all
gui object were defined on two levels:
first level where all objects and its parameters (screens, controls,
backgrounds, bitmaps etc.) are defined without using any true GUI library.
second level is the level of true GUI where first level objects are
translated into second ones. It is some kind of object dictionary.
All works in this way, that in program I call first object whereas this one
call "true" library implementation.
But in fact primary I my application WAS NOT written this way and I had to
object by object and event by event split into these two levels.
I've check in this way Win32::GUI, Tk, Wx. It works.
-----------------------------------------------------------------------------------------------------------------------------
RE PROBLEM 2:
I did it by introducing for each screen special information (an example later
on) how to map current screen data collection into some (proper) SQL command.
In fact I do it through a stored function.
As a result I perform something like "SELECT the_function_sql_operation(...
list of arguments ... )".
The function does everything (incuding transaction, comparison records before
and after write special log, chose operation: insert, update or delete and so
on).
The MOST useful thing is that my application generates the function
authomatically, so anytime I am changing the screen data collection it changes
the function properly. It is very, very usefull. For instance in the definition
of my screen I write something like:
DATA = 0;DB;uslugi;10;0;usluga,nazwa,szpital,cena,stawka_vat,uwagi # names of
columns You can tread this as a list of screen data
WRITE = 0;DB;uslugi;0,1,2,4,5
# list of screen controls that have to be written into database.
And if user fire some events it runs the SQL function.
-----------------------------------------------------------------------------------------------------------------------------
I hope it can help you some how.
Waldemar