SpiderBasic code structure and style
Posted: Wed Sep 28, 2016 10:37 am
Out of curiosity, I built a small code analysis tool in PHP to scan my SpiderBasic files and analyse my code for my current project. The results were not entirely surprising to me - I comment a lot and use whitespace a lot too in pretty much all languages I've ever used (except RPG/400 on mainframes that enforces a rigid code layout structure - but that was years ago
):
I have almost no global code except for a few helper procs, system constants (eg version) and a global Registry map for eg auth token handling: all windows and business logic resides in modules with the bear minimum exposed to the public scope (eg Windows have Open(), Close() , Disable() and SetActive() public methods (with some exceptions), and a few have a SetxxxxData() style one too when a child window passes values back.
Actually my windows are too tightly coupled to my business logic a the moment - if I have time I would like to make all my business logic in non Windows modules, but for now they are intertwined. A legacy of blundering my way through learning SpiderBasic!
It would be interesting to know how others tend to code SB - how do you tend to structure your own code?

Code: Select all
$ php sb_count_code_lines.php /data/fse_repos/fse-ui-spiderbasic/
SpiderBasic Code Line Analyzser v1.0.0
Scanning files in: /data/fse_repos/fse-ui-spiderbasic/
Files processed: .... 22
Smallest file: ...... 0.6KB
Largest file: ...... 32.6KB
Total lines: ........ 7466
Code lines: ......... 4792 (64.18 %)
Whitespace lines: ... 2071 (27.74 %)
Comment lines: ...... 603 (8.08 %)
Modules: ............ 19
Procedures: ......... 167
Structures: ......... 26
Enumerations: ....... 33
Maps: ............... 26
Remote API Calls: ... 31
Finished
Actually my windows are too tightly coupled to my business logic a the moment - if I have time I would like to make all my business logic in non Windows modules, but for now they are intertwined. A legacy of blundering my way through learning SpiderBasic!
It would be interesting to know how others tend to code SB - how do you tend to structure your own code?