A Proper Way To Work

BlitzMax Forums/BlitzMax Programming/A Proper Way To Work

Hardcoal(Posted 2013) [#1]
Any One has the best idea of how to create a correct work method.

I use this method


Type Main_Class

   'Subs
    Field Add:Add_Class=New Add_Class

End Type

Type Add_Class

    Method AddSomething()
       'Code...
    End Method

End Type

Local TT:Main_Class=new Main_Class

TT.Add()



Thats how I do hirarchy more or less.

any one has better way to work?


Brucey(Posted 2013) [#2]
I'd have more idea on an answer for you if I could understand what your little example was trying to accomplish?


Derron(Posted 2013) [#3]
Maybe something like the "behaviour"-approach?

Type TCharacter
 field behaviours:TList=CreateList()
 field x:float,y:float

 Method addBehaviour(behaviour:TBehaviour)
  self.behaviours.addLast(behaviour)
 End Method

 Method Update()
  for local behaviour:TBehaviour = eachin self.behaviours
   behaviour.update(self)
  next
  self.y :+1
 End Method
End Type

Type TBehaviour
  Method Update(parent:object)
    print "standard behaviour - do nothing"
  End Method
End Type

Type TMoveLikeDrunkenBehaviour extends TBehaviour
  Method Update(parent:object)
   local character:TCharacter = TCharacter(parent)
   if not character then return

   character.x = sin(character.y)
  End Method
End Type

local char:TCharacter = new TCharacter
char.addBehaviour( new TMoveLikeDrunkenBehaviour )

while not KeyHit(KEY_ESCAPE)
  char.update()
  print char.x+","+char.y
wend


Code is not tested, just written as a "maybe example".

bye
Ron


Hardcoal(Posted 2013) [#4]
The problem is that when im building a big project
Im spliting the Project From MainType down to SubTypes
Because I cant find my legs when its a single file.

So My Commands Become like that

Engine.Add.Data("xxx")

Or

Engine.Join.Info("ccc","mmm")


How do people face big Projects thats my read question.
How do you manage your code when you have 1000's of Functions..


GfK(Posted 2013) [#5]
Because I cant find my legs when its a single file.
Mine are normally still dangling loosely from my arse, no matter how complex the code gets.

Seriously though, I split my code into separate files and use a load of Includes at the top of my code. Each class has it's own file, except where a class is directly related to another, then I just leave them in the same file, so that all related code is kept together. A normal game, for me, generally has about 120-150 source files.

The other thing is, use BLIdePlus. It pulls down the pants of MaxIDE and paddles it's arse purple.


jsp(Posted 2013) [#6]
I split stuff in separate files which in turn are imported into the main file.
Every file contains an independent type or sometimes several types if the belong somehow together.
It's even best when a certain file / type can be compiled and tested completely on it's own, but that is not always the case.
If projects are getting really huge it is not easy to track, I faced the situation that I wrote a function and when I wanted to put it in the right place there was already one, I just forgot.


Hardcoal(Posted 2013) [#7]
Thanks for the replies. Well as i see there is no easy way.
Unless i could builed an IDE that is..