In article ,   
   Hans Bezemer wrote:   
   >On 23-03-2024 10:30, mhx wrote:   
   >> My current project has 13,938 lines of code (and documentation).   
   >> That is too large to keep every detail of it in my head.   
   >>   
   >> The reason to not factor it in a number of smaller files is that   
   >> there are many (unavoidable) global variables and data blobs. These   
   >> global variables prevent me from dividing the application   
   >> up into smaller programs that can run standalone. They also prevent me   
   >> from documenting sub-tools, and giving such tools their own help words [   
   >> The main application now has lots of help   
   >> text that is not relevant for a user interested in working with   
   >> only one of the specific tools. ]   
   >>   
   >> With respect to the coding and debugging aspect, there are   
   >> currently many "folding" and "workspace" based editors available   
   >> (my editor of choice can't do "folding" yet). Is there experience   
   >> with using such features advantageously for Forth?   
   >I can't feel with you, since my largest programs are 2 KLOC. Still, I   
   >have no problem managing them.   
   >   
   >Although I don't particularly like OOP, in this case such an approach   
   >might be the way. Arrange your program along certain modules and only   
   >take up the interaction between these modules in your main program - or   
   >arrange them in a way you can separate those dependencies.   
   >   
   >I know this might be hard to establish afterward.. But it helped me in   
   >the past. When I added strings to uBasic/4tH I designed that entire   
   >module in separation (all variables included) so it was just a "drop in"   
   >module. I could still lift it out without any problems, I guess.   
   >   
   >But 13,938 lines - that's a hellovalot of code..   
      
   My largest project is tmanx the musical score program, that is driven   
   hardware for e.g. linux, raspberry pi, windows.   
   It is heavily dependant on OO. The classes are defined beforehand,   
   and the objects are defined were needed. I have succeeded in separating   
   the source for different concerns: instruments, circular buffer,   
   real time stuff, musical language. There are only two files larger   
   than say a 100 bytes. That is domanx that is repetitive and contains   
   definitions for each pitch, articulation, note duration etc.   
   The other is score.frt that defines the musical language. It also is   
   pretty self contained, and runs 194 lines with comment.   
      
   The total lines is 2700. I could certainly expand this with features   
   without fear that the architecture collapses.   
   Actually I have done that for adding an organ instrument, and a software   
   (ms) midi interface and a hardware (expander) midi interface.   
   There are occasionally deferred words, that cannot be avoided. During   
   runtime you can change the instrument where on a part is to be played.   
   A part is a sequence of execution tokens that plays a bar/measure.   
   DEFER itself is never used.   
      
   I don't think that using global variables ever can handle a large   
   project. Global variables in manx contains configuration mainly.   
   The rest must be compartmentalized using OO.   
      
   (how many parts are allowed, how many bars in a part).   
   How many divisions for a quaver?   
   How many MS before an event is due you start a busy wait?   
   Musical pause before a piece start. (That moment the pianist stares   
   straight ahead to give you a last chance to cough.)   
      
   It is absolutely possible to make a SPICE clone in Forth without   
   loosing track.   
      
   >   
   >Hans Bezemer   
   >   
      
   Groetjes Albert   
   --   
   Don't praise the day before the evening. One swallow doesn't make spring.   
   You must not say "hey" before you have crossed the bridge. Don't sell the   
   hide of the bear until you shot it. Better one bird in the hand than ten in   
   the air. First gain is a cat purring. - the Wise from Antrim -   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|