Welcome to Phrogram Sign in | Join | Help


Re: Will there be an Include command?

  •  11-24-2006, 11:53 PM

    Re: Will there be an Include command?

    Do as you see fit, but I would mention that having used a language that does have an Include command, I found it quite convenient to build a project in modules and only have a shell for the Main procedure:

    Program MySpaceAdventureGame
    
          Define Lives As Integer
          Define Level As Integer
          Define Score As Integer
          Define HiScores As Integer[5]
    
          Include "CoreDrawing.PLF"
          Include "LevelSettings.PLF"
          Include "HighScores.PLF"
          Include "TitleScreen.PLF"
          Include "GameLoop.PLF"
    
          Method Main()
          Define Replay As Boolean
    	
          TitleScreen()
          WaitForKeypress()
    
          Replay = True
          While Replay
    
              Lives = 5
              While Lives > 0
                 NextLevel()
                 PlayLevel()
              End While
    
              ShowScores()
    
              Replay = Confirm("Play again?", "Space Adventure")
    
          End While          
          End Method
    End Program

    Such modules would be specific to that project and not necessarily generic enough for inclusion into a library.  What it does do is break up the different routine into functional units which facilitates unit testing.  While building the project, the Main routine could be used to test the individual routines until the modules are complete. You would then be helping the phrogrammers use proper techniques (unit testing) without them even realizing it.  

    Similarly, I did not find the include command all that difficult to understand.  The only requirement was that it was a forward-only type of compiler such that code could only use variables and methods that had been previously defined.  Apparently such is not the case with Phrogram, which would make it even easier to incorporate into the construction of programs. 

    Both ideas address the amount of code that is currently in the editor, which I think is a big point. Could you imagine using such modules, and then having the different modules on different tabs in the IDE, or only the few you are currently working on?  It could be powerful....       

    Filed under: ,
View Complete Thread