Files (stucturing my code for optimisation)

Hi,

Again, thanks for any and all help given!

I am new to C++ and come from a background of VB 6 and VB.Net.

I want to try to optimise my code and make it neat, manageable and hopefully easy for another programmer to easily work out what is going on.

So, what I would like to do is the following:-

Main Form (which would call these sub forms)
Order Details Form
Cancellation Form
Comments Form
Message Form

Now, I would like shared routines for the following:-

My_SQL_Procedures
Print_Orders
Print_Labels

So that I do not have to repeat my code and make it as efficient as possible. Also, to fully understand how to write C++ applications properly as VB does allow quite a scruffy approach to programming!

I understand most of what I think I need to know to but, am struggling to locate information regarding the structure of how to lay out your source code and how to do it!

For example, I would like to call a routine in the main form to get all the orders from an sql table and then display them in that form, but for the SQL open/find/retrieve/close database functions to be called from another form. What I don't know is what I would need in the main form to hold the retrieved data to display that on the form!

Is this "do-able" and if so, can anyone recommend any websites where I can pull this info from?

Cheers
Carl.
You have described your program in prodecural terms. And that's fine.

However, internally, you'll be using objects to implement things. For example, you'll have a connection to a database--that's an object.

If you want to support different kind of databases, then you'll probably end up with a factory that creates the right kind of database connection, relieving the main application from having to worry about it.

If your application uses the single database instance for pretty much everything, you'll probably resort to using a singleton to hold the connection.

So, I think you're missing knowlegde of OO rather than C++ per se.
Topic archived. No new replies allowed.