Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 18th, 2007, 3:34 PM   #1
LOI Kratong
Professional Programmer
 
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4 LOI Kratong is on a distinguished road
Designing classes

Hey, I looking to write my first big program (in terms of functionality), a dictionary program. While thinking how to make this I came upon the idea of learning to use classes effectively. Although I know how to implement classes, I need some help/advice on how to design them.

Is there a good technical reference that I need to be pointed to? I really need an explanation from the top down, i.e. do I need to have a dictionary class? Or should I just have a ... actually I don't know where to go after that!

Any help would be much appreciated!
__________________
www.heldtogether.co.uk
LOI Kratong is offline   Reply With Quote
Old Mar 18th, 2007, 3:40 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Imagine that you're building a lawnmower. There's a lot of diverse functionality there. How would you divide it all up into coherent objects (classes)? How would you restrict or constrain normal access to, say, the carburetor (its interface)? Don't let it buffalo you, it's a rational process.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 18th, 2007, 7:10 PM   #3
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
get a pen and paper and work with it. think about data structures that would be appropriate. maybe an STL map? most of your work here is not coding, but design.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Mar 19th, 2007, 1:26 AM   #4
Booooze
Expert Programmer
 
Booooze's Avatar
 
Join Date: Mar 2006
Location: Igloo
Posts: 710
Rep Power: 3 Booooze is on a distinguished road
Send a message via MSN to Booooze
I have had the same problems lately as well. Design is a big part of the project, and if done properly can save you tons of time. If you don't do a scope document or plan of some kind, you will most likely find yourself adding things in, and changing your main goal as you go along.

The one project I wrote a scope document for, turned out great. If your stuck at the design, write a scope document, and write down how everything works. While your planning what functionality you want in the program, you will realize and visualize the code in your head. With that said, you should be able to get a list or view of classes down. When you get lost on what to do next in the programming aspect, you can always refer back to the document. That's what I do. Face it, planning isn't nearly as much fun as coding it. Some planning is better than none. Try and at least have a reference. if your not sure how to write a scope document, google it. Don't know if this jibber jabber will help, but that's my little spiel.
Booooze is offline   Reply With Quote
Old Mar 19th, 2007, 5:14 AM   #5
LOI Kratong
Professional Programmer
 
Join Date: May 2005
Location: Woo - Boot Sector!
Posts: 294
Rep Power: 4 LOI Kratong is on a distinguished road
Okay, so for my dictionary I may have:

a dictionary class which has the functions inside it, such as lookUp();
the main private variable may be string currentSearch;
the meaning of words may be held in an STL map which is private.

And from there I just need to plan!

Easy. Thanks, I'll dig out my pen and paper and see what I can come up with.

Thanks guys
__________________
www.heldtogether.co.uk
LOI Kratong is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Could some please explain classes to me... TCStyle C++ 10 Feb 20th, 2006 3:51 PM
What is Lightweight C++? difference in inner classes between C++ and Java? jonyzz C++ 4 Sep 2nd, 2005 9:56 AM
List of classes Dark_Shinobi C++ 8 May 23rd, 2005 3:50 PM
Classes Sane Python 8 Apr 29th, 2005 12:50 PM
C++ Classes - Quick question(s) Delete C++ 8 Apr 7th, 2005 7:38 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC