Re: Global = root of all evil
- Posted by Al Getz <Xaxo at aol.com> Nov 02, 2006
- 590 views
Hi there, I realized these kinds of problems long ago, that's why i came up with WinClass. You have to call global functions somehow, and using a class sort of methodology seems to be a good idea, as many things have common names yet have to be catagorized separately. If anyone has a better idea i would sure like to hear it Example: You have two button objects, ButtonTypeA and ButtonTypeB. There are some similarities between the two but many differences too, which makes using a flag based system a little difficult, both for you AND the person that is going to create these objects. A good solution seems to be: constant Button1=BTypeA:Create(params) constant Button2=BTypeB:Create(params) The values for params are kept in the file with the code for that button type and are documented carefully: Create( integer style, --style=1 for raised, 0 for recessed sequence name, --button text, name="MyButton" for example atom color --face color, color=#808000 for example ) Create( integer style, --style=1 for raised, 0 for recessed sequence name, --button text, name="MyButton" for example atom facecolor, --face color, color=#808000 for example atom textcolor --textcolor=#FFFFFF for example ) As soon as the user looks at the file they have a very good idea how to create that object. Also, because of the coding format it makes it fast to add features to an existing 'class'. The underlying format is pretty much the language itself, so there are less ideals to have to push on the programmer... Create( integer style, --style=1 for raised, 0 for recessed sequence name, --button text, name="MyButton" for example atom facecolor, --face color, color=#808000 for example atom textcolor, --textcolor=#FFFFFF for example integer advancedstyle --advancedstyle=PUSHON_PUSHOFF or PUSHBUTTON ) Once the ability to actually include an include file a second (or more) time(s) gets into the language it will be even easier to create a class and then create objects of that class...as you can now do with C++. Take care, Al E boa sorte com sua programacao Euphoria! My bumper sticker: "I brake for LED's" From "Black Knight": "I can live with losing the good fight, but i can not live without fighting it". "Well on second thought, maybe not."