creating logical modules / functions with TD

forum.td.development (2005-2010)
Marco Westermann

creating logical modules / functions with TD

Post by Marco Westermann » 20 Jul 2009, 10:19

 Posted by:  Marco Westermann 

Hi,

does anybody of you have an idea how to unitize functions in an TD app?
Following case. When you write different interfaces for one purpose,
lets say exporting an order to a textfile and the customers have
different formats for this file, I'd like to change a dynamic file on
the client side to give them the kind of functionality they need.

Now you would say: why not take a dynalib? Because in my opinion they
are not useable for large interfaces, because I can't export classes and
use them in my app, and writing a lot of global functions is not
practicable.

To solve this problem I think of a kind of latebound calls with a
dynamic binding or something like that.

Any ideas?

Marco Westermann

Marco Westermann

creating logical modules / functions with TD

Post by Marco Westermann » 20 Jul 2009, 13:26

 Posted by:  Marco Westermann 

I just discovered Inproc COM-Servers. Are they applicable?

thx, Marco

Jim McNamara

creating logical modules / functions with TD

Post by Jim McNamara » 21 Jul 2009, 15:02

 Posted by:  Jim McNamara 

You can put your functions in a functional class in a separate .apl and
attach the .apl to apps where it is needed.

You don't say what version of TD. Building .dll's has not been supported
for some time - then it was only supported in a VS6 environment.

If you are insisting on an external library you probably should think about
.NET.

Thomas Lauzi

creating logical modules / functions with TD

Post by Thomas Lauzi » 23 Jul 2009, 10:53

 Posted by:  Thomas Lauzi 

Hi,
we also do not use dynallibs (because of their bugs and that we could not
exxport classes)
I don?t like to have different versions of code for different customers,
because the handling is too much for us.
We compile everthing in our application (but not all parts are used for
every customers, but most)

1. Why not compile the classes in the application and one central export
classes works as a gate and calls the appropriate explort class.

Class: ExportFilter_Format1
Function: Export
.....

Class: ExportFilter_Format2
Function: Export
.....

Class: cExportHandler
Variables:
ExportFilter_Format1: m_oExportFilter_Format1
ExportFilter_Format2: m_oExportFilter_Format2

Function Export
Parameter
String:sType
Actions
If sType = 'Format_1'
Call m_oExportFilter_Format1.Export()
If sType = 'Format_2'
Call m_oExportFilter_Format2.Export()

2. Store the definitions and format in a file/database and make the exporter
flexible.
For every customer you have one or more export definitions and only one
exportcode.

[Options]
FIELD_SEPERATOR = ';'

[Fields]
ID "AUTOCOUNT"
,ADRID "TO_NUMBER(:ADRID)"
,ADRVON "TO_STRING(:ADRVON, 'DD.MM.YYYY')"
,FIRMA1 "TRIM(:FIRMA1)"
,ORT "TRIM(:ORT)"
,STRASSE "TRIM(:STRASSE)"
)

Regards,
Thomas L.

Marco Westermann

creating logical modules / functions with TD

Post by Marco Westermann » 27 Jul 2009, 09:39

 Posted by:  Marco Westermann 

Hi,
thank you for your answer. The way you describe is exactly the way we
manage this problem in the past. But think of complex purposes like
delivering data from your program to different forms of online shops.
Then your code consists of if then else expressions, which get bad to
manage. Then I would prefer the solution about late bound calls, cause
the decision, which interface to use, is done only once (one if then else)

Exp:
Class: ExportFilter_Format1
Derived From: ExportFilter
Function: Export

Class: ExportFilter_Format2
Derived From: ExportFilter
Function: Export

Class: cExportHandler
Function: contruct
Variables:
ExportFilter: cfExport
if sType = FORMAT_1
cfExport = new ExportFilter_Format1
if sType = FORMAT_2
cfExport = new ExportFilter_Format2
Call cfExport.export()
... more calls to function implemented by derived classes

Thomas Lauzi

creating logical modules / functions with TD

Post by Thomas Lauzi » 27 Jul 2009, 13:29

 Posted by:  Thomas Lauzi 

Hi Marco,

I don?t understand the difference. The desicion, which class to use, is only
one big if the else (or many, when elseif is not used).
So what do you win with late bound calls? Where do you decide then?
It doesn?t matter how complex the formats are, because all is handled inside
your export function of the special format class (e.g.
ExportFilter_Format1).

Regards,
Thomas L.

Marco Westermann

creating logical modules / functions with TD

Post by Marco Westermann » 28 Jul 2009, 15:28

 Posted by:  Marco Westermann 

Hi Thomas,

not the complexity of the output-format is the difference. This case of
exporting data to a file in different formats was just a little example
for understanding. But think about an interface to different financial
accounting software. The interface to such a program is widely used in
different modules of our software. For example, in the customer base,
you can look up the unpaid items for a customer. In a different module
you can transfer accountings to the third-party program and so on. So
the interface itself is complex and the usage is spread around the whole
program. So using late bound calls would help, cause I decide at
instantiation time which interface to load by creating the concret class.

The other possibility is that I missunderstood your suggestion and it is
in fact that easy like using late bound calls.

best regards,

Marco

thomas.uttendorfer
Site Admin
Site Admin
Germany
Posts: 151
Joined: 05 Mar 2017, 17:19
Location: Munich Germany

creating logical modules / functions with TD

Post by thomas.uttendorfer » 19 Aug 2009, 15:40

 Posted by:  Thomas Uttendorfer 

Hi Marco,

have you thought about creating COM-Objects (with TD).
You can use them for latebound calls.

Kind regards
Thomas

Hi,

does anybody of you have an idea how to unitize functions in an TD app?
Following case. When you write different interfaces for one purpose,
lets say exporting an order to a textfile and the customers have
different formats for this file, I'd like to change a dynamic file on
the client side to give them the kind of functionality they need.

Now you would say: why not take a dynalib? Because in my opinion they
are not useable for large interfaces, because I can't export classes and
use them in my app, and writing a lot of global functions is not
practicable.

To solve this problem I think of a kind of latebound calls with a
dynamic binding or something like that.

Any ideas?

Marco Westermann

Marco Westermann

creating logical modules / functions with TD

Post by Marco Westermann » 20 Jan 2010, 01:30

 Posted by:  Marco Westermann 

Hi,

yes I thought about using COM-Classes as one purpose. But I didn't get a
complete solution in mind. I think of a framework like OSGI where you
can add functions to the programm over extension points.
Like adding a button to a form dynamically over the exsisting of a
specific file / folder on the client side. You may know eclipse, what is
my inspiration. Put a new file/folder in the modules folder and some
new functionality exists in different places of the program. Is there a
way of dynamically load COM-Server Classes in the application. For
example I could make a installation-Skript for each plugin which adds
some functionallity. When the program starts, it checks wich Plugins
(COM-Servers) are installed and loads the functionallity dynamically?

Best regards,
Marco

Return to “td.development”

Who is online

Users browsing this forum: [Ccbot] and 0 guests