[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Re: Run time debugging for includes



PureBytes Links

Trading Reference Links

Hello TJ

Please see my comments embedded below.

----- Original Message ----- 
From: "Tomasz Janeczko" <groups@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, February 12, 2009 9:23 AM
Subject: Re: [amibroker] Re: Run time debugging for includes


> Hello,
> 
> Sorry but this suggestion does not make any sense plus
> it does not bring any benefit to already existing USER DEFINED FUNCTIONS feature.
>
Sorry but I disagree. In short the benefit is it makes modular programming, testing and maintenance easier and less eror prone. Sure there is a bit more work for the compller to do but that is what compilers are supposed to do. If user codes a statement in program referring to function "abc" they are implicitly stating that function "abc" needs to be incorporated into object program. Why should user have to be concerned with coding the relevant #include which contains it?  

The other issue is having scope confined to within the external file. Using #includes often leads to problems if code in the #include is sloppy (variables outside functions etc.)
 
> The #includes are STANDARD in C and C++ language.
> Similar constructs (like "import") exits in Java and other languages.
> And it is so for purpose
> 
The purpose is..?  - it makes the compiler easier?  ;-)
Seriously I know AFL is styled on C and scripting stuff but if there are better ways to do things why not incorporate them. Many compilers and ides use library type feature I outlined for good reason.

> Code MUST be included ANYWAY.
> Specifying WHAT to include allows MORE EFFICIENT execution.
>
It only allows the compller to be more "efficient" at the expense of programmer time. Instead of the compiler looking up the function code the programmer must hand code the appropriate #include. Is that efficient use of programmer time?
 
> There is simply **ZERO** difference between putting all your FUNCTIONS into one include
> file, placing single #include <all.afl> on top of your formula
> and calling functions as usual.
>
Well you might as well just use Editor to paste in huge chunk of code at top of each program. This is hardly modular programming - every program would be bloated with stuff it does not need, plus you would have the problems of editing huge files and not being able to easily track changes to indvidual functions. A program should only incorporate the modules it uses. In this way you can easily find module/program dependencies which is a key issue when peforming code maint/changes.
 
> User defined functions (ALREADY EXITSITNG FEATURE) allows ALL
> that was suggested below. READ THIS:
> http://www.amibroker.com/guide/a_userfunctions.html
> 
> 
I have a few hundred so I have an idea how they work ;-)

> Implementing your suggestion would do just ONE thing save you only from typing 18 letters (#include <all.afl>)
> and would make program A LOT SLOWER because AmiBroker would
> need to look and parse hundreds of files searching for "where the user decided
> to put his functions" .
> 
I do not see the performace issue. Take this code example:-

#include <userfunc1>
#include <userfunc2>
a=userfunc1(p1)
b=userfunc2(p2)
c=userfunc1(p3)
d=userfunc2(p4)

Compiler opens/reads/closes the include files userfunc1 and userfunc2 , functions are defined and assignments use the functions.
Using the suggested model (no #includes required) the code becomes just:-

a=userfunc1(p1)
b=userfunc2(p2)
c=userfunc1(p3)
d=userfunc2(p4)

Now when complier encounters 1st ref to userfunc1() it recocognises it as unsresolved external function and pulls the definition into program i.e. opens/reads/closes the file "userfunc1" in the specified library path. Same for userfunc2. At assignments for c and d external refs are already resolved and no further external file operations are required.
By my count the file operations for both models is same - 2 file opens,2 file closes,n file reads.

Regards
John

> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "Listsub" <listsub1@xxxxxxxxxxxxxxxxxxxxxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Thursday, February 12, 2009 2:38 AM
> Subject: Re: [amibroker] Re: Run time debugging for includes
> 
> 
>> As noted debugging AB with includes is not easy . The nature of AFL makes it quick and easy to write/test simple stuff but as 
>> complexity grows debugging any sizeable AFL project can be quite tricky, particularly if running RT as there is a lot going on.
>>
>> "Modular" programming is only catered for in AB by Includes (which is just a soure code copy preprocessor). The AB program 
>> structure model is therefore basically just one big chunck of code - which is why (unless you are very careful what you code 
>> inside Inlcudes) you can get some very hard to find problems (the problems can even change or disappear depending on the roder of 
>> Includes).
>>
>> IMO improving AFL to support procedure/function calls to external files would be a big plus to enabling better modular program 
>> design. Specifically:-
>>
>> a =xyx(p1,p2)  would call the external proc/func "xyz" (unless xyz is defined in current source file).
>>
>> The benefits as I see them:-
>>
>> 1. #Inlcudes are no longer required for procs/fucntions.Compiler would pull them from library specified via preferences. No more 
>> searching for which Include file is that function in, which version of that was I using .. etc.
>>
>> 2. External functions matched by filename. i.e one function name = one filename, no ambiguity, easily portable.
>>
>> 3. External files are closed boxes - can only receive/pass data via parameters, return value or global variables. Everything else 
>> inside file is local. No interference bewteen files.
>>
>> 4. Faster code development/maint. For example if we have the facility in Preferences to define multiple paths to external 
>> proc/func library it becomes easy to test out changes without having to resort to all the usual suffixing fillenames, changing 
>> calls etc. i.e.
>>
>>            path1=AB_Function_Library_Test
>>            path2=AB_Function_LIbrary_Live
>>
>> So to test out a mod just copy the function file to the Test library, make the changes and test. Compiler searches paths in order 
>> specified so anything with matching name in Test takes precedence over same name in Live.
>>
>> 5. Easier debugging? ;-)
>>
>> John
>>
>>
>> ----- Original Message ----- 
>> From: "jtoth100" <jtoth100@xxxxxxxxxxx>
>> To: <amibroker@xxxxxxxxxxxxxxx>
>> Sent: Wednesday, February 11, 2009 2:26 PM
>> Subject: [amibroker] Re: Run time debugging for includes
>>
>>
>>> Hi all,
>>>
>>> debugging includes is not easy and handy in any script language. So
>>> instead of making the GUI to reduce clicks my suggestion would be to
>>> reduce possible error cases.
>>>
>>> Most errors come from undefined/uninitialized variables. If AFL
>>> language would have an "OPTION" to require definition of all
>>> variables then most common errors could be vanished.
>>> Visual Basic 6.0 never was my favorite language and environment. It
>>> was for average Joe to do basic level programming. It did not require
>>> declaring variable just like AFL or any script language. But I had to
>>> use it years ago. At that time all serious developer started each
>>> module in VB with "Option Explicit On". This caused an error at
>>> parse/compile time if a variable was not defined explicitly but was
>>> referenced anywhere in the code.
>>>
>>> How would it help?
>>> Most probles come from just creating variables by assigning a value
>>> to an "identifier". However if you misstype an "identifier" or code
>>> execute in a code path where variable does not get
>>> defined/initialized you get an error. The worst thing is that these
>>> errors are hidden until the rearly executed code path is executed
>>> (typical runtime error). If definition of variables are required even
>>> these code paths are checked for proper variable usage.
>>>
>>> This should be an option for advanced users which is turned on on
>>> purpose. So all code out there could run with no change.
>>>
>>> Variable assignment and definition could be merged to one statement
>>> like in any modern language (e.g.: var x = 0.5;) This way declaration
>>> is required and initialization can be done as well.
>>>
>>> I know it does not guaranty that all runtime error are gone. But with
>>> disciplined coding most can be avoided and the need for debugging is
>>> vastly reduced.
>>>
>>> So I would not go for GUI change request but to improve AFL as a
>>> script language.
>>>
>>> Regards,
>>>
>>> Y
>>>
>>>
>>>
>>> ------------------------------------
>>>
>>> **** IMPORTANT ****
>>> This group is for the discussion between users only.
>>> This is *NOT* technical support channel.
>>>
>>> *********************
>>> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
>>> SUPPORT {at} amibroker.com
>>> *********************
>>>
>>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>>> http://www.amibroker.com/devlog/
>>>
>>> For other support material please check also:
>>> http://www.amibroker.com/support.html
>>>
>>> *********************************
>>> Yahoo! Groups Links
>>>
>>>
>>>
>>>
>>>
>>
>>
>> ------------------------------------
>>
>> **** IMPORTANT ****
>> This group is for the discussion between users only.
>> This is *NOT* technical support channel.
>>
>> *********************
>> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
>> SUPPORT {at} amibroker.com
>> *********************
>>
>> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
>> http://www.amibroker.com/devlog/
>>
>> For other support material please check also:
>> http://www.amibroker.com/support.html
>>
>> *********************************
>> Yahoo! Groups Links
>>
>>
>>
> 
> 
> 
> ------------------------------------
> 
> **** IMPORTANT ****
> This group is for the discussion between users only.
> This is *NOT* technical support channel.
> 
> *********************
> TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> *********************
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> 
> *********************************
> Yahoo! Groups Links
> 
> 
> 
> 
>


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/