19 May, 2010, David Haley wrote in the 41st comment:
Votes: 0
Well, ok although I don't agree with your definition of professional, it's fair to say that C++ isn't changing as quickly as the popular dynamic languages (no pun intended on 'dynamic'…)
19 May, 2010, Runter wrote in the 42nd comment:
Votes: 0
I'll jump on the Haley Naysay bandwagon.

Quote
Final aside… why is hashing important? The slowest part of muds is cycling through massive arrays of data – no language, no matter how fast, does that quickly. Python implements a native hash-like object called a "dictionary" which operates like a "map" and associates a string to a value, no hassle.


As opposed to…A map in C++?
19 May, 2010, 3squire wrote in the 43rd comment:
Votes: 0
I'm learning so much c++ right now, this is radical.

You can see some of us didn't read the book.

conclusion: In fact, you should use c++
19 May, 2010, David Haley wrote in the 44th comment:
Votes: 0
It's not that you should use C++, it's that if you don't use it, you should do so for the right reasons… :wink:
19 May, 2010, quixadhal wrote in the 45th comment:
Votes: 0
I'll be disagreeable here.

C++ may well be a language you end up using out in the "real world", but it is NOT the best choice for learning object-oriented programming, nor is it the best choice to use for building a text-based game in your spare time. If you enjoy using C++, then by all means use it. Don't use it because you think coding a MUD with it is going to be more rewarding, or because you think it's going to help you land a job in the future.

If you want to learn object oriented methods, you'd be far better off (IMHO) to learn several object oriented language. C++ may be the "king", but it's a terrible choice for text games because you'll always have to fight with it when you deal with strings. While the STL does give you std::string, it's rare to never have to interact with the OS, or with other libraries that use char *'s instead. Mixing the two is, quite frankly, an exercise in frustration.

If you really intend to be a professional programmer (run away!!!!), you don't need to learn any particular language. It doesn't matter, because the world changes too fast for it to matter. When I was in school, Pascal, FORTRAN, and COBOL were the "real" languages with this upstart C language that sys-admins and engineers used to talk to the hardware bits. C++ wasn't even suggested as an option. By the time I graduated, C++ was used out there and Visual BASIC was the other big popular thing. Now, .NET and Java seem to be in high demand, with C++ being relegated to legacy and "big iron" systems.

What you want to learn is to be flexible. Learn the ideas of object oriented programming, and learn several languages so you see how it works from more than one narrow viewpoint. LPC will give you a very different view of events and objects than C++, or Python. For a MUD, use a language which is strong in dealing with text. Anything else is driving a screw with a hammer.
19 May, 2010, shasarak wrote in the 46th comment:
Votes: 0
I'll make it simple for the OP: C++ is evil. :devil:

In all seriousness: C++ barely qualifies as an object-oriented language. Alan Kay famously remarked "I invented the term 'object-oriented' and I can assure you I did not have C++ in mind". C++ is a procedural language with a set of OO extensions bolted onto it. It (and its parent language C) are designed to squeeze the maximum performance out of the hardware; they date back to the 1970's (or even the 60's) when hardware was feeble and getting every drop of available performance was crucial. C++ still has a place in writing things like graphically-heavy, CPU-intensive games - but the average MUD simply doesn't need that kind of performance - the processing it does is not that complex. The performance margin between languages like C and more advanced OO languages is also much narrower than it used to be. 15 years ago the gap was bigger, but many respectable OO languages are JIT-compiled these days, and the performance difference between compiled C++ and JIT-compiled anything else is small enough that, in MUD terms, it's negligible. Even interpreted languages are probably still fast enough for a MUD.

So, when choosing a language for a MUD, think in terms of flexibility and ease of coding - and C++ or (worse still) plain C lose out badly, there. For general programming, languages like Ruby, Python or Smalltalk are often an excellent choice. For a MUD you should also definitely consider using LPC - which is, essentially, a programming language specifically designed for writing MUDs. (The "Dead Souls" distribution is a good example).
19 May, 2010, Cratylus wrote in the 47th comment:
Votes: 0
quixadhal said:
driving a screw with a hammer.


twss
19 May, 2010, JohnnyStarr wrote in the 48th comment:
Votes: 0
A lot of posters have said that C++ isn't any good with strings, but I've found ways to make
it less painful in my project by using streams:

buf = ''
@characters.each {|ch| buf << ch.name + "\r\n"}


ostringstream buf;
for_each(_characters.begin(), _characters.end(), [&buf] (Character *ch) { buf << ch->name; });

// or something like this

buf << "You are " << ch->name << "\r\n";
<< "Your level is " << ch->level << "\r\n";


I'm sure if you wanted to you could overload the + operator to do: buf << "Hi my name is " + ch->name;
I think part of the "fun" is figuring out ways to make it work, but that's just me.
19 May, 2010, Kaz wrote in the 49th comment:
Votes: 0
If you're going to use C++1x, you may as well use it properly:

ostringstream buf;
for(auto ch : characters) buf << ch->name;
19 May, 2010, JohnnyStarr wrote in the 50th comment:
Votes: 0
Nice, I have hardly played with the new features. I was after all just giving a quick example of the stream.
Your example is just like a java loop, very cool.
19 May, 2010, Koron wrote in the 51st comment:
Votes: 0
quixadhal said:
What you want to learn is to be flexible. Learn the ideas of object oriented programming, and learn several languages so you see how it works from more than one narrow viewpoint. LPC will give you a very different view of events and objects than C++, or Python. For a MUD, use a language which is strong in dealing with text. Anything else is driving a screw with a hammer.

I've got to get behind this. Once you understand the logic of how computers think, the syntax becomes far less difficult to comprehend. If the OP is actually proficient with VB, he's got a huge advantage over most of the other noobs around. :smile:
19 May, 2010, David Haley wrote in the 52nd comment:
Votes: 0
They say that a truly good programmer can be proficient in any programming language; this is because the concepts are all quite similar, and you just need to understand how a language expresses a given concept. Of course, not all concepts exist in all languages, and some languages make certain things far easier to express than others. But as long as you understand at a high-level what is going on, you'll be fine. For example, C++ doesn't provide as natural of a map function (not data structure) as, say, Python does. But Python isn't doing something that C++ can't; it's just doing something much more conveniently. For example:

doubled_list = [x*2 for x in original_list]


This creates a list that is a copy of another list but with each element doubled. C++ can do this, of course, but not nearly as compactly (or compactly but with other stuff like functors elsewhere).
19 May, 2010, Runter wrote in the 53rd comment:
Votes: 0
I prefer.

doubled_list = original_list.map { |x| x*2 }
19 May, 2010, Zadious wrote in the 54th comment:
Votes: 0
These replies have given me a much needed perspective on things.

I had no idea that C++ was not ideal for working with text, or that it was essentially patched for OO programming. I have known that there are different languages better suited for different tasks much as there are different hammers for certain tasks. I just assumed that C++ was a middle ground that could be used to do about anything without first understanding the limitations.

I have an older post on here where I was asking about Colleges and Courses that would be ideal for becoming a programmer. Old Topic Herel

My VB and C++ classes have been very hands on and straight forward in making you write programs consistent and similar to the text books. I would attribute the gaps in my understanding to this as there is no big picture taught in any of these courses. I believe that this further illustrates my need to attend a proper university in the future.
Thanks again for the help everyone. I feel enlightened :wink:
19 May, 2010, David Haley wrote in the 55th comment:
Votes: 0
Zadious said:
I had no idea that C++ <…> was essentially patched for OO programming.

This is somewhat of a misleading statement. C++ was built to add object orientation (and some other features) to C with the very important design constraint that if you do not use the new features, performance must not be affected by a single machine instruction. So it wasn't exactly done in a carefree manner; it was in fact extremely carefully designed to meet very specific design constraints. (There have been experiments in which people try to design a "better C++" by following the same design constraints, and eventually they end up with something that is basically C++.)

The most important takeaway, though, is that those design constraints are most likely not relevant to the kind of programming you will be doing. For some people, those design constraints are very important.

Zadious said:
I would attribute the gaps in my understanding to this as there is no big picture taught in any of these courses.

This is one of the harder things to learn (and to teach, for that matter). When I went to school (at what I suppose would be called a "proper university") there weren't really "big picture" classes, although it was discussed sometimes. It's hard to pick this up except with experience, practice, experience, practice, and more experience and practice.
19 May, 2010, Runter wrote in the 56th comment:
Votes: 0
Also, just to make a point, object oriented design predates what some see as mandatory languages for object oriented design. I'm not sure why someone would disqualify C++ as an object oriented language. (Other than the fact that perhaps it exposes a lot of primitives.) But that really has little to do with the design direction you go in. Of course, it seems like a lot of people are making the distinction between object oriented languages and object oriented programming. It's not always been like that and the definition is a little shady at best if you split the two up.

edit: Well, if not shady at least a little undefined.
19 May, 2010, flumpy wrote in the 57th comment:
Votes: 0
Well, as David said, understanding any language is a step in the right direction as they can all express the same things but with differing amounts of verbosity. I learned BASIC and simple C/C++ before I went to uni and C++ with systems C programming at uni: not a single Java class in sight. However now I wouldn't program anything other than a JVM language.

Don't get hung up on the language too much, everything is a trade off in the end. If you were really up for some uber string manipulation ability then I would suggest perl, but I don't think anyone would actually suggest writing MUDs in it. Even COBOL far outpaces most languages for disk based file manipulation (some muds do this, others use a DB), but srsly no.

What you need to do is find a zone, something you enjoy using, and just go ahead and write code. Something like c or c++ might not be great at strings, but someone's gonna have had the pain before and written a lib to do it.

No PHP tho or I will have to hunt you down..
19 May, 2010, Runter wrote in the 58th comment:
Votes: 0
Not really disputing your stuff Flumpy, but I thought this was funny..

Quote
However now I wouldn't program anything other than a JVM language.

Don't get hung up on the language too much, everything is a trade off in the end.
19 May, 2010, flumpy wrote in the 59th comment:
Votes: 0
The JVM is not a language… It's a, er, virtual machine. There are many languages on the JVM, JRuby, Java, clojure, Groovy, scala…

NB Just for clarity I was (in my previous post) responding to OP
20 May, 2010, Kaz wrote in the 60th comment:
Votes: 0
David Haley said:
For example, C++ doesn't provide as natural of a map function (not data structure) as, say, Python does. But Python isn't doing something that C++ can't; it's just doing something much more conveniently. For example:

doubled_list = [x*2 for x in original_list]


This creates a list that is a copy of another list but with each element doubled. C++ can do this, of course, but not nearly as compactly (or compactly but with other stuff like functors elsewhere).


C++ doesn't put anything in the language that can be done in a library. There was a reasonable effort at Lambda in the guise of Boost.Lambda. It's a very useful library, and I use it frequently. The above code would look like this:

transform(original_list.begin(), original_list.end(), back_inserter(doubled_list), _1 * 2);


With C++1x, there are built-in lambdas, but that's less useful here where it can be expressed as a for loop. It will look like this:

for (auto item : original_list) { doubled_list.push_back(item * 2); }


I'm not trying to make this into a language war, but I feel I must correct these assertions.
40.0/124