Author Topic: How to name files?  (Read 2922 times)

0 Members and 3 Guests are viewing this topic.

kryton9

  • Guest
How to name files?
« on: May 07, 2011, 12:09:02 AM »
Charles, I was wondering if you had a naming convention you would like us to use for the following.
In C++, I would write the class definitions in a header file .h
I would write the code for the class in a .cpp file  They use a capital C for Class in front of the class name.

So for example you would have the following:
CGLAPP.h  CGLAPP.cpp

Also you can do it all in one file and in that case you use .hpp, so it would just be: CGLAPP.hpp

I have a feeling the .hpp is sort of what would be used for oxygen that is the class would be defined and fleshed out in one file.

Should we still use .o2bas for these files, so it would be CGLAPP.o2bas  or would you prefer CGLAPP.hpp

Or is there something else you prefer?

Charles Pegge

  • Guest
Re: How to name files?
« Reply #1 on: May 07, 2011, 05:37:08 AM »
Hi Kent,

I favor using inc files for shared source code and o2bas for programs.

I would reserve h for c-style headers that contain only definitions declarations etc.

Major classes I would assign to individual files, for example: EditBoxClass.inc. Then the class name itself would be EditBoxObject.

Instantiating a dynamic object of this class:

new EditBoxObject ed1 (...)
...
del ed1



But nothing is mandatory and anything that gives a clear sense of architecture and ease of access is welcome.

Charles

jcfuller

  • Guest
Re: How to name files?
« Reply #2 on: May 07, 2011, 05:48:53 AM »
I'm not sure this would apply here but with the new Bcx 6.6 and Ubx I use separate files for Declaration (*.bi) and Definition (*.bas).
This way if I compile my classes into a library I can use the same Declaration files for both creation of the library and in the app's that use the library.

James

Charles Pegge

  • Guest
Re: How to name files?
« Reply #3 on: May 07, 2011, 06:39:17 AM »

Yes James, I think bi is a good choice for Basic declarations

Charles

kryton9

  • Guest
Re: How to name files?
« Reply #4 on: May 07, 2011, 11:51:27 AM »
Hmmm, I didn't think about header files for use with libraries as James pointed out.

So should I put my declaration in .inc and the definition in .o2bas or should I use .bi  and .o2bas?

I do like the ObjectNameClass.inc naming scheme over the  c++ way of CObjectName.