Large project organization ideas?
Posted: Tue Jan 12, 2010 4:56 pm
Hey everyone, I'm trying to figure out an efficient way to manage a large project. The project is by no means complicated, but there are many windows & gadgets and it's starting to get mind boggling sorting through everything.
Currently, my organization looks like this:
As you can see, each window is split into it's own procedure, but the events for all of the windows and gadgets are blobbed into a large block. I have thought about each window procedure having it's own event loop, but after testing it appears that multiple loops run at the same time. Maybe I'm missing something with this idea.
Personally, I prefer this coding style, but it too becomes confusing, especially in the method to get/pass data between windows. Most of the time this causes a lot more work for me, but it looks much cleaner to me. Note: no enumeration, each procedure/window is entirely self contained:
The problem with this 2nd example is it's not as easy to pass data as when you're using Enumeration:EndEnumeration. Yes, I could use make import variables global, but this too looks sloppy and confusing to me.
How do you do it? Is there a better way? Thanks for any tips on this one!
Currently, my organization looks like this:
Code: Select all
Enumeration
#Window1
#Window2
#Gadget1
#Gadget2
EndEnumeration
OpenWindow1()
Repeat
Event.l = WaitWindowEvent()
Select Event.l
Case #PB_Event_Gadget
Select EventGadget()
Case #Gadget1
; code here
Case #Gadget2
; code here
EndSelect
EndSelect
Until ;...
End
Procedure OpenWindow1()
; open #Window1 code here
EndProcedure
Procedure OpenWindow2()
; open #Window2 code here
EndProcedure
Personally, I prefer this coding style, but it too becomes confusing, especially in the method to get/pass data between windows. Most of the time this causes a lot more work for me, but it looks much cleaner to me. Note: no enumeration, each procedure/window is entirely self contained:
Code: Select all
OpenWindow1()
Procedure OpenWindow1()
Protected Window.l
Window.l = OpenWindow(#PB_Any ;.......)
If Window.l
; code here
Repeat
Event.l = WaitWindowEvent()
Select Event.l
Case #PB_Event_Gadget
Select EventGadget()
Case #Gadget1
; code here
Case #Gadget2 ;<<<< This gadget is in OpenWindow2()
; code here
EndSelect
EndSelect
Until ;...
End
EndIf
EndProcedure
Procedure OpenWindow2()
Protected Window.l
Window.l = OpenWindow(#PB_Any ;.......)
If Window.l
; code here
EndIf
EndProcedure
How do you do it? Is there a better way? Thanks for any tips on this one!