Questions on style
#18
When it comes to style, as you guys have probably noticed over the years, I tend to be the sort that relies heavily on writing and using code for library usage.  The very idea of writing a 100,000 line program begins to boggle my mind, even before I ever sit down and write the first line of code.  Trying to navigate through such a mess would just cause me to completely lose focus and not be able to work on anything.   "Now, where was this variable at?   Oh yeah, it was 14 pages up somewhere in the code..."  *Scroll...  Scroll... scroll...*   "Now, WTH was I looking for, to change again??"

The only way I can organize my stuff is to break it down into working modules.  I tend to have the main module, along with a keyboard handling module, and an image handling module, and a mouse module, and a printout/display module, and maybe a few more... -- and each of these are separate, independent libraries which I just $INCLUDE into the main source.  The vey idea of merging all those modules into just one long BAS code somehow makes me shiver down deep in my soul.  I know me -- I honestly wouldn't be able to function or work half as well with such a style.  

I *NEED* things to be organized into those modules, but almost NEVER into submodules.  Just as the idea behind "one superlong file" disturbs my personal flow, the concept of "let's put a module inside a module inside a module inside a module inside a module..." just makes me want to puke.  Normally when I code, I'll have 2 or 3 IDE windows/tabs open to code in.  One might have the main module in it that I'm working on, while another holds the module that I need to adjust or expand upon at the time, with the third being to just test immediate things to either refresh my memory or look for bugs/issues which something might cause.  To try and have the main module, submodule, and then other sub-submodules all open at the same time...   Once again, I'd just get lost and wouldn't be productive at all.

So my personal style tends to always be:

1) Write modular code for library use.
2) Have a main module and include my submodule/library files.
3) Try to never go beyond a single depth in my library usage.  (Note that in some **extreme** cases, I might break this rule -- such as if I merge things into an 'Input Library' which then has a submodule for keyboard input, then a submodule virtual keyboard, then a mouse input submodule, then a joystick submodule...  In the main module, things may consolidate down to just a single line for 'Input Library', but all that library does is include all those independent libraries which I can still open/edit one at a time as needed.)
Reply


Messages In This Thread
Questions on style - by justsomeguy - 06-25-2023, 06:18 AM
RE: Questions on style - by bplus - 06-25-2023, 01:12 PM
RE: Questions on style - by Kernelpanic - 06-25-2023, 01:25 PM
RE: Questions on style - by bplus - 06-25-2023, 02:05 PM
RE: Questions on style - by justsomeguy - 06-25-2023, 07:09 PM
RE: Questions on style - by OldMoses - 06-25-2023, 08:30 PM
RE: Questions on style - by justsomeguy - 06-25-2023, 09:25 PM
RE: Questions on style - by TerryRitchie - 06-25-2023, 11:39 PM
RE: Questions on style - by OldMoses - 06-25-2023, 11:22 PM
RE: Questions on style - by Ultraman - 06-26-2023, 11:32 AM
RE: Questions on style - by justsomeguy - 06-26-2023, 12:05 PM
RE: Questions on style - by Ultraman - 06-26-2023, 12:17 PM
RE: Questions on style - by madscijr - 06-27-2023, 02:56 PM
RE: Questions on style - by Ultraman - 06-26-2023, 12:29 PM
RE: Questions on style - by CharlieJV - 06-28-2023, 08:31 PM
RE: Questions on style - by bplus - 06-26-2023, 03:47 PM
RE: Questions on style - by madscijr - 06-27-2023, 02:49 PM
RE: Questions on style - by TerryRitchie - 06-27-2023, 04:18 PM
RE: Questions on style - by madscijr - 06-27-2023, 08:15 PM
RE: Questions on style - by SMcNeill - 06-27-2023, 04:48 PM
RE: Questions on style - by SMcNeill - 06-27-2023, 04:52 PM
RE: Questions on style - by bplus - 06-27-2023, 08:29 PM
RE: Questions on style - by Gets - 06-27-2023, 08:52 PM
RE: Questions on style - by justsomeguy - 06-27-2023, 09:32 PM



Users browsing this thread: 8 Guest(s)