Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ General Methodology 3

Status
Not open for further replies.

Rougy

Programmer
Oct 15, 2001
249
US
Hi,

I'm going to start teaching myself C++ in a few days.

As a VB6 programmer, I have a basic way of going about making my programs.

I know that it's going to be totally different in C++.

I was wondering if there are some basic steps to putting together a program in C++ that should always be followed.

I know it's a very vague question, but I was just curious.

-----
The death of dogma is the birth of reason.
 
Put each major piece of your code in a separate source file.

Make each class or function so that it does one thing and does that thing well.

Instead of solving a specific problem, solve a more general version of that problem so you can apply it to other similar problems.

Don't go crazy with inheritance; a deep heirarchy means you did something wrong in design.

Learn commonly used idioms and use them yourself.

Read a book on design patterns.

Think before you code.

Comment.
 
VB6 has a list of reference libraries for connecting with SQL, Access, Word, and Excel.

Does C++ have something similar?

-----
The death of dogma is the birth of reason.
 
>VB6 has a list of reference libraries for connecting with SQL, Access, Word, and Excel.

One thing about C++ compared to VB is you have know a little bit more about how the things actually work behind the scenes.

A reference in VB is actually a COM interface.

This would roughly be the equivalent of selecting a reference:

Menu=>ClassWizard=>New class=>From typelib, and select the type library (ie the file thats holds the COM interface info).

A class will be created and you can invoke your calls to it (check up on how classes work in C++ if you don't know already). Pretty much the same as when dealing with it in VB.

So, you have to manually go filehunting. That is often not so tricky though. For example, to work with the MS Office apps do a search for *.odl files in your office directory.
You'll see by their names which .odl is for excel or word etc.


/Per
[sub]
if (typos) cout << &quot;My fingers are faster than my brain. Sorry for the typos.&quot;;
[/sub]
 
Oh, and since VB is your native environment its perhaps convenient to use it for locting the files with the COM interface. The filename is shown when you select the reference.

/Per
[sub]
if (typos) cout << &quot;My fingers are faster than my brain. Sorry for the typos.&quot;;
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top