[Gambas-user] Enhanced component project management for 2.1

ron ronstk at ...239...
Sun Jan 20 15:29:19 CET 2008


On Sunday 20 January 2008 14:03, Benoit Minisini wrote:
> Hi,
> 
....
Great addition for gambas.

> 
> I think there will be a convention for the naming of components not located in 
> the Gambas sources: something like vendor.x.y.z, gb.x.y.z being reserved. For 
> example, if you create a component with your own controls, and if you do it 
> for the company named 'Apple' (why not?), you should name it 'apple.form'. 
> And the package name will be 'gambas2-apple-form'.
> 
...
> 
> Waiting for your comments... :-)
> 

Big smile from me.

Here I would say 'welcome into the wonderfull world of namespace'

gb.x.y.z : namespace is 'gb'
vendor.x.y.z : namespace is 'vendor'
Now I can use a gb.form with a control rons.ListBox

The next step ??

+----------------- example --------------
|  Dim listbox1 AS NEW gb.Listbox
|  Dim listbox2 AS NEW rons.Listbox
|  Dim listbox3 AS NEW ListBox
|
|  For row = 0 to 9
|    listbox1[row].text = "row " & row '<-- gb style
|    listbox2.items(row).value =  "row " & row '<-- vb style
|    listbox3[row].text = "row " & row '<-- gb style
|  next
+----------------------------------------

What about listbox3? Well because no namespace is given it defaults to the
native one or the first namespace in component order that knows ListBox.

The last method is used in VB and if for some reason that order was changed your 
project did fail. That was IMHO the most wrong implementation of it in VB/MSaccess.
Easy in editing code but unsafe in final behaviour.
(components order is in the project properties where you choose the components)

If no component namespace is given the native is the only one, gb in this case.
Adding own components is easy and the usage need only the adding of namespace 
in the declaration parts of the code. 
i.e. xyz AS namespace.object or AS NEW namespace.object


I know my view of namespace may/is not 100% correct and there is more involved but 
effective you can see it also as a class. 

Timer in gb.qt is a class and the parent (qt) is also a class, here qt and the parents of it.
All components starting with gb as prefix are the native ones, other prefixes are user components.

In this story I do see the parent of the objects as namespace. gb as namespace for all 
gb.x.y.z and Apple for the Apple.x.y.z components/objects/classes etc.
gb.qt is the namespace for all gb.qt components/objects/classes etc.


Once someone asked me 'What is a class?'. 
I could not answer because parts of the class where also or could be a class.
A class can have Methods, Events and Properties (MEPs).
A property can be also a class and with MEPs. No end of it.
Here the prove a parent is or can be a class (with MEPs).
Some classes are here also called 'Virtual Class' in gambas.

The place where all those classes belong to is called by someone a namespace.
This does not sound bad to me because a listbox from the namespace of GB is different
of the namespace VB but shows the same on the screen and other similarites.
To know how to help someone you need to know from where the listbox is and that is the name.

I know Benoit don't like (or even hate it) the namespace but the 'gb.' and 'GB_' prefix 
he use is a effective way to tell the name of the (working) space/room he uses.
Where the code belong to.

> Waiting for your comments... :-)
Me too. :-)

Ron




More information about the User mailing list