How many .oc files to use?

Discuss OrbForms Designer and PocketC Architect

Postby sangahm on Fri Apr 21, 2006 7:46 pm

This is a basic question, that I hope isn't as trivial as it sounds.

Coming from PocketC, there ususally was the main file with all declarations, resources, and functions. You may have had some include files for libraries and such.

With Designer, the files are divided into project files and one or several .oc files. It looks like the project file contains the declaration and resource definitions. And there are .oc files: maybe one main that uses objects defined on various other .oc include files.

With PCA, it picks up the Designer model and has project files and .oc file too. The samples look like Designer samples.

My question: Should I be designing my code files like this? And how do I structure what is in the .oc files? Is it one .oc file per form? Are there other clean divisions, or is it whatever makes logical sense (which it doesn't to me).

I have been following the Palm Programming for Beginners book, and most everything seems to be one file.

Sorry, if the question is basic, but not being an experienced programmer, I'm trying to wrap my mind around all of this.
Posts: 118
Joined: Mon Jul 04, 2005 3:43 pm
Location: USA

Postby nmc on Fri Apr 21, 2006 8:49 pm

Yes, using the designer, you get one .oc per form; this does make sense because the forms are logical units, and this concept is used also in other IDEs (e.g. visual studio for windows).

Anyway, feel free to use one or more files for your projects, arranging the code as you like.
Posts: 197
Joined: Tue May 27, 2003 8:42 pm
Location: Germany

Postby sangahm on Fri Apr 21, 2006 8:52 pm

I guess what I'd like to know is other than one .oc per form, are there other recommended ways to split the code up?

I don't think that I can be as structured as Designer, so what should be my guiding principles?
Posts: 118
Joined: Mon Jul 04, 2005 3:43 pm
Location: USA

Postby mlambrigger on Fri Apr 21, 2006 9:10 pm

I develop so:

When I create an object that will be store in a database, I use one .oc file per object. So I can reuse those logical unit in other object. I use one .oc file per group of special functions as math extension or registration system for sharewares or commercial product.

It seems more logical to develop so. All you make can be reused in other project.

In facts, there are as many files as forms, one project file and as many files as you want to split your project in. You can have includes too. When developing specials function, you can add them by including the file where you need or including it in the project file.

I "recommand" to split your project in several files and in for you logical unit. In your book you have study only simple program. As you will have more experiences you will create bigger app. As those app goes bigger, you will increase the number of code lines. In a few time it will be realy dificult for you to reopen a project writen three month ago, this writen in only one file.

I hope this will respond to your questions.

Marc Lambrigger
Marc Lambrigger
Posts: 113
Joined: Fri Feb 13, 2004 11:07 am
Location: Switzerland

Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 1 guest