Well just look at how many PureBasic projects actually grew bigger than a few thousand lines
(while keeping in mind that 'lines' actually don't mean anything at all).
Unfortunately not many PB programs of that size are around. (At least I don't hear about such projects very often).
Of course it highly depends on the programmer and how well he manages structure his code.
Languages are just way easier and more comfortable to use if there are clear structures
and well separted code parts. Currently, we don't have that in PureBasic.
We have to prefix all of our functions to keep them somehow separated which just leads
to unncessary long and ugly function names (e.g. MyLib_DoSomething, MyLib_DoSomethingOther).
Not having and not getting OOP is one thing. But OOP actually isn't a requirement to efficiently manage
larger projects. It's the ability to structurize your code and separate parts from other parts.
Having modules makes it way easier to exchange and re-use code or even complete (library) projects.
You say PB needs 7 seconds to compile your 18k lines?
Well, that's one hell of a lot. It might seem to be fast, but you have to wait 7 seconds every time you
want to test your application. Now imagine your application gets really huge and say you're now
at 80k lines. Do you want to wait 40 seconds every time you changed one single line?
Imagine how painful it would be to debug an application that needs 40 seconds every time you change something.
That isn't a problem if there is a properly implemented module management.
If you change code inside a module, you'll have to recompile that. But other modules
won't be affected by that change, so there is no need for the compiler to go over it again.
Having simple modules or probably even complex namespaces would make development (even more in a community like this) way more effective.
And probably way more fun.
I've just written a small snipped how I think it would be perfect for PureBasic.
Not saying that it should be implemented that way, it's just my humble opionion on this topic:
Code: Select all
Namespace GameEngine\VideoDevice
Private depth.i ; Variable is only known inside GameEngine\VideoDevice.
Private Procedure.i CreateDirectXDevice(width.i, height.i, depth.i)
; Use native DirectX functions here.
; [...]
Module\depth = depth
ProcedureReturn #True
EndProcedure
Public Procedure.i CreateDevice(width.i, height.i, depth.i)
; Create Video Device here.
; [...]
CreateDirectXDevice(width, height, depth)
ProcedureReturn #True
EndProcedure
Public Procedure.i GetDepth()
ProcedureReturn Module\depth
EndProcedure
EndNamespace
And in the main code, it could be used like this:
Code: Select all
Using GameEngine
VideoDevice\CreateDevice(1920, 1080, 32)
Debug VideoDevice\GetDepth() ; Would return 32.
Or even like this if you're sure that you won't get any name conflicts:
Code: Select all
Using GameEngine
Using GameEngine\VideoDevice
CreateDevice(1920, 1080, 32)
Debug GetDepth() ; Would return 32.
Cheers.
