|
1. A C, C++ question
|
|
Thu Mar 4, 2004 [5:29 PM]
|
Dko
Email not supplied
member since: Mar 2, 2004
|
Reply
|
|
I have been messing around with the smaug code base which is C programed. Ive learned C++ and want to maybe program OO stuff in Smaug. Sence im not an experianced programer would I be able to do this (Maybe with some changes like .c files to cpp?)? I don't wana rewrite the code c++ just want to be able to use OOP when I require it.
|
|
|
|
|
2. RE: A C, C++ question
|
|
Thu Mar 4, 2004 [6:22 PM]
|
Xeon
Email not supplied
member since: Jul 12, 2002
|
In Reply To
Reply
|
Don't be stupid like I was. Do the books you read not advocate consistency? Trying to add OO to a 100% C monster such as Smaug would introduce inconsistencies, confusion, and eventually unwieldy code. Adding a few objects with nifty constructors would be completely unnessessary, especially since one cannot experience the full benefit (or ANY benefit, IMHO) of OO without redesigning (read: creating a new, custom codebase) the entire code. Also, C++ is not the be-all, end-all solution to programming. A well coded C mud is 1000x better than a half C, half C++ one. Take the word of someone who was stupid enough to actually try this: It's not worth it and you will end up wasting time, not to mention: YOU WILL LEARN BAD PROGRAMMING HABITS! If you learned nothing else from this post, please keep in mind what I just stressed. -Xeon Coder of the custom codebase, TAMS (currently in a complete hierarchal redesign). Webpage: http://tams.slayn.netEmail: xeon@austin.rr.comMud: slayn.net:3333
|
|
|
"Imagination is more important than knowledge." -- Albert Einstein
|
|
3. RE: A C, C++ question
|
|
Thu Mar 4, 2004 [6:56 PM]
|
Dko
Email not supplied
member since: Mar 2, 2004
|
In Reply To
Reply
|
|
Well its a good thing I asked. Thanks a lot ^_^
|
|
|
|
|
4. RE: A C, C++ question
|
|
Thu Mar 4, 2004 [8:24 PM]
|
Drahlek
Email not supplied
member since: Nov 2, 2000
|
In Reply To
Reply
|
|
Speaking from experience, several large scale commercial projects converted from C to C++ over many years, much of what Xeon says is true. The issue is NOT mixing C and C++. The issue is the paradigm used in the overall design of the system, functional or Object Oriented. Mix two fundamentally different strategys and you will have a mess.
HOWEVER, if you are adding some completly new functionality which can be totally isolated from the existing code base in its own module, than that subsystem can be designed with an Object Oriented perspective within itself and implemented in C++ with well defined interfaces to the old C code. In that case, I would implement a proxy class to handle the communication with the original C code and not even pollute the new C++ code with calls to the old.
Turning C structs into classes, making data private and adding public accessors goes a long way into cleaning up your code. That does NOT make it OO though. But if the code is really hard core functional C than I would not waist my time with the above and the jist of what Xeon said I am in agreement with: dont bother. Just keep it C. It is virtually imopssible to turn that into a true Object Oriented system, you would have to start completely from scratch to do it correctly. If you want to learn C++/OO pick another codebase.
The percentage of professional software engineers that I have worked with that do not get that is far to high in my opinion. And are usually the type that are accomplished C programmers who picked up a C++ book and/or a basic OO book and thought they would convert their code - only to fail. And an even smaller percentage actually realize it after the fact.
-Drahlek
|
|
|
|
|
5. RE: A C, C++ question
|
|
Thu Mar 4, 2004 [9:17 PM]
|
Dko
Email not supplied
member since: Mar 2, 2004
|
In Reply To
Reply
|
|
Ahh more good info. Thanks a bunch. Well at least there is one less person who will make that mistake right? :) Ill will be working on the smaug code still (helping someone who's making there mud with it) But maybe for my own purposes Ill fine a mud codebase thats more oop. But will I find one that can compile in windows like SMAUG I wonder?
|
|
|
|
|
6. RE: A C, C++ question
|
|
Thu Mar 4, 2004 [9:20 PM]
|
Tyche
Email not supplied
member since: Apr 4, 2000
|
In Reply To
Reply
|
|
Yes, assuming of course you make the changes required for the existing code to be compatible with C++. What matters is how the compiler is invoked in your makefile, extension can be irrelevant.
|
|
|
|
|
7. RE: A C, C++ question
|
|
Thu Mar 4, 2004 [9:41 PM]
|
Dko
Email not supplied
member since: Mar 2, 2004
|
In Reply To
Reply
|
|
Your saying I can turn a UNIX mud into a windows one? I know that and would if I could. In not very experianced with codeing, and have only done so on my windows machine (As I know nothing about Linux.) Though Im thinking of installing it on one of my two HD's. Thats still a while away as I need to reinstall windows as well and im a lazy *^er. ;) In short i would have no clue as the where to begin converting something to windows. Though someday ill learn.
|
|
|
|
|
8. RE: A C, C++ question
|
|
Thu Mar 4, 2004 [11:08 PM]
|
Tyche
Email not supplied
member since: Apr 4, 2000
|
In Reply To
Reply
|
|
DKO wrote - I have been messing around with the smaug code base which is C programed. Ive learned C++ and want to maybe program OO stuff in Smaug. Sence im not an experianced programer would I be able to do this (Maybe with some changes like .c files to cpp?)? I don't wana rewrite the code c++ just want to be able to use OOP when I require it.
Tyche wrote - Yes, assuming of course you make the changes required for the existing code to be compatible with C++. What matters is how the compiler is invoked in your makefile, extension can be irrelevant.
DKO wrote - Your saying I can turn a UNIX mud into a windows one? ...
huh!?
|
|
|
|
|
9. RE: A C, C++ question (SmaugWiz)
|
|
Fri Mar 5, 2004 [3:15 PM]
|
konrad236
konrad236@yahoo.com
member since: Jul 30, 1999
|
In Reply To
Reply
|
|
SmaugWizard is a smaug conversion... it's done in CPP... I havn't messed with it much, because i don't know cpp... but, it is fully windows based... programed and ready to compile with Microsoft Visual C++.
|
|
|
|
|