While I find the full Hungarian notation excessive, a subset of it specifying only the location of the variable can be very valuable. When you are looking at a variable, one of the most common things you want to know about it is where it is declared. With hungarian m_, g_, and s_ prefixes it is immediately clear where to look for the declaration if you need it.
I don't know about you, but if I discovered immortality, I certainly wouldn't tell anyone. Just imagine all those stupid people you know, hanging around you forever! *shudder* If I keep it a secret, then I'll be sure to outlive them. Eventually.
Before you even touch any vector-to-map conversions you should make sure your disk IO is optimal. If you are reading/writing/opening any file more than once, you will see no measurable gain from adding binary search to some measly thousand element vector. If you are using the network without a pretty darn good reason, or not caching the results, you can forget about doing any other optimizations. If you need to start twenty daemons to run a word processor, you have some serious architecture design issues.
> Thus, the term tween somewhat predates Mary Kate and Ashley
This depends on where Tolkien's Universe is in time on our scale. If it discusses the distant future, then Mary Kate and Ashley could easily be the Hobbits' distant progenitors. They are both rather short...
It is improper to ask if game designers should be conveying moral values through their games, because they can not avoid doing so. Every game, be it Duke Nukem or Myst, orginates from the morality of its designers. They can not avoid it because they must make choices about the plot and player's possible decisions that can not be made in any other way.
You can ask if which moral values are appropriate to include in games, and the answer would be that it is not possible to make any restrictions in this area without total censorship of all games produced. It is already being done in part through the ratings system. Whether it would be possible to impose further restrictions is somewhat doubtful. (though becoming less so every year)
> But after years and years of continued maintenance with no > comments, your clean, elegant code has turned into a monster hairball of crap.
I didn't say you should write all your code without comments. I said that it is better to write your code clearly, so it doesn't require them. If you have a hairball of crap, you obviously need comments. You should put them in when you regurgitate it. At the same time put in a reminder to yourself to fix it, like a doxygen \todo comment. Then, when the crunch period is over, you go through the code and turn it back into a clean elegant form. At that point it should once again require no comments due to painful obviousness. Finally, you should make an appointment with your supervisor to discuss crunch time policy, illustrated with graphic before-and-after printouts and estimates on just how much time you lost due to hairballs of crap in them.
> This leads to me believe that you either don't > code for a living, don't code on large projects, > don't code on projects with other people, or > haven't ever coded anything that will stay in > production for longer than four years.
Ah, here come the "I'm a badass programmer on a big project" nonsense. Here's some advice for your company:
Don't hire idiots. If he can't write clean, good code, that your whole team approves of, he gets the boot. Period.
New team members should start small. Don't give them anything important until they are familiar with the code base.
Do code reviews. No checkin goes in unless an experienced team member has reviewed it. This catches all those bad modifications you believe inevitable.
When you must write bad code, write comments. Those comments should say something like "FIXME: This is an ugly hack to quickfix bug 568132. Blah, blah." Then you must periodically go through and clean these up! Don't keep bad code around; it creates all those maintenance nightmares you believe inevitable.
Move your hardware and compiler targets as needed. Once all your customers are running W2k, there is no need to have those Win3.1 ifdefs and Winsock code. This is especially useful for in-house software, where you know exactly who is using it.
Plan to refactor regularly and make it clear to your manager that it makes the code better.
And, finally, do write comments where needed. If your code needs comments, it probably needs work. You can defer it, but on a large project, where you work with lots of other people, and stay in production for a long time, you must not avoid it. Otherwise you'll be constantly behind schedule, hating your job, and thinking that there is absolutely no way to make the code look good. Kinda where you are now, I'm guessing.
> Every programmer worth his/her salt knows that > source code is self documenting...
And it's true too. Although comments are indeed a good thing, writing code that does not require them is a much better one. If your code needs comments, it's probably too complex for continued maintenance.
> If a company breaks the law and makes me lose money
Making you lose money is not against the law. You bought the ink cartrige on your own free will. It is not a crime to sell you less than you expected and should not be.
> I have no other recourse but to sue them to recover my losses.
The company is not responsible for your "losses". They sold you a cartridge; it had ink in it; you had the option to use it before the expiration date; if you didn't, it's not their fault and not their problem. As I said before, if you don't like timed cartridges, don't buy them; that's your recourse to not "lose" any more money.
> how to deal with them breaking laws and cheating me out of money.
It is an issue of trust. You should learn something about the product before buying it; the responsibility is yours. Even if their marketing department did nothing but lie to you and sell you worthless garbage, you still had to make the decision to purchase it. The company did not "make you lose money", you did it to yourself by buying something of unknown value. So chalk it up to experience and quit whining about your "lost" money.
If you don't like what the company is doing, don't buy their printers. Vote with your wallet; it's the democratic way to show 'em you are displeased. Lawsuits, on the other hand, are backed with guns, and are the way of tyrants. Take your pick.
> I don't understand why people care about how loud a computer is.
Because you listen to loud music. I never listen to any music at all and consider any noise a distraction. With my homemade liquid cooling system and an LCD monitor I can hear nothing at all from the computer, which reduces the ambient noise to nearly zero. Living in a quiet neighbourhood (no idiots with loud stereos next door!), having a good heat pump (though wishing for a radiant floor heater instead), and a silent computer, can create an incomparable heaven of silence. That's when I can really start thinking.
> But the act in which you willfully engaged was > intercourse - the HIV contraction was a > side-effect, an unintended consequence.
Let's try again: adopting the GPL is like infecting yourself with HIV. You might tell everyone about it, but people with either refuse to sleep with you or have to get HIV for the "privilege". It's a virus, whether everyone knows about it or not.
> The GPL is not viral. It does not infect software > of its own accord. You make a choice whether or > not to include other people's code in your software
If that's your argument, HIV is not a virus either, since you need to make a choice to have sex to get it.
There is no need for 50 licenses because most of them say the same thing. There are only a few different license types, so it is a good idea to remove the duplicates. As far as I know, there are only GPL, LGPL, BSD, and MIT license types, with most of the other being variations on their theme with an occasional extra restriction ignored by everyone except the license writers.
> Blindly writing a block of memory prevents using _any_ kind of pointer
It is amusing that it will actually work for the developer for quite some time, because often the program is loaded at the same address each time you run it. Then you install some service and suddenly your saved games don't work any more:) I've never had a program that relied on this, but I have occasionally taken advantage of it when dumping data in the debugger.
> how's a fixed memory block going to accomodate the inventory > in an RPG? Have a fixed buffer for every single object in the > game, for example, saying how much of each you've got?
Believe it or not, that's exactly what Omega (ancient roguelike game) does; there is a 26-slot pack in a global variable and a 13-slot inventory in a global variable. It also has an Objects and Monsters global static arrays in large header files, which are modified at runtime to indicate which objects are "known" and to make special creatures.
> Can I ask you how a memeory leak occurs with a system using > virtual memory? The application crashes with a fatal error > -- as a result the memory is reclaimed by the VM.
Well, yes, you are right. It wouldn't really be a memory leak; I just think of it as such. There would be a memory leak if you tried to use the same code in a non-terminating function and something threw an exception. You'd have to catch it and delete the pointer manually.
But the real problem still remains: if you let the VM reclaim memory, the destructors are not called. You could have a leak then if you used shared memory or some other global resource. A game would have a good reason to do so to take advantage of X shared memory extension.
No, the proper way to implement the singleton pattern is:
class Game { private:
Game (void) {} public:
static Game* Instance (void)
{
static Game theGame;
return (&theGame);
}
void setup (int, char**);
int run (void); };
int main (int argc, char** argv) {
Game* theGame = Game::Instance();
theGame->setup (argc, argv);
return (theGame->run()); }
This lets you avoid new/delete calls, which in your example can create a memory leak if an exception is thrown or some fatal error occurs that crashes your application. With the above implementation Game::~Game is always called allowing you to do necessary cleanup. Good error recovery is especially important in console games, where a crash can leave the terminal in graphics mode and render the machine effectively unusable.
> There are many people who seriously help in > opensource development yet are too low profile to > show up in the docs or help feed information to > the actual developers (like for example the > people in help channels)
If we are going to count all people who help open source developers, why stop with help channels? Shouldn't we also include the fine people at AMD and Intel who provide the computers that we use? Tyan for making my motherboard, Samsung for making my monitor, Logitech for making my mouse, and gasp even Microsoft who made my ergonomic keyboard. Then there are the book authors (you didn't think you could accomplish anything without them, did you?) like Knuth, Fowler, Abrash, Carmack, and many others.
Then you need to include the contractors who built your house (try coding on the sidewalk!), the electricians who ran the power wiring through the walls (computers don't run on air), the HVAC technicians that installed your heating furnace (hard to code when you're shivering). Also, don't forget to include your employer, since without him you'd have no money to buy the house in which you live, the computer on which you work, or the food to keep you alive. Speaking of food, don't forget to include farmers and supermarkets, without whom you'd not be able to write a single line of code due to being dead.
Gosh, that pretty much includes everybody in the world! I'm so glad that OpenSource development is so darn popular.
While I find the full Hungarian notation excessive, a subset of it specifying only the location of the variable can be very valuable. When you are looking at a variable, one of the most common things you want to know about it is where it is declared. With hungarian m_, g_, and s_ prefixes it is immediately clear where to look for the declaration if you need it.
I don't know about you, but if I discovered immortality, I certainly wouldn't tell anyone. Just imagine all those stupid people you know, hanging around you forever! *shudder* If I keep it a secret, then I'll be sure to outlive them. Eventually.
Before you even touch any vector-to-map conversions you should make sure your disk IO is optimal. If you are reading/writing/opening any file more than once, you will see no measurable gain from adding binary search to some measly thousand element vector. If you are using the network without a pretty darn good reason, or not caching the results, you can forget about doing any other optimizations. If you need to start twenty daemons to run a word processor, you have some serious architecture design issues.
In other words: fix the slow stuff first!
It looks like a cross between an evil chipmunk and a startrooper.
Was it found in the underdog constellation? Now, what is the latin name for that?...
> Thus, the term tween somewhat predates Mary Kate and Ashley
This depends on where Tolkien's Universe is in time on our scale. If it discusses the distant future, then Mary Kate and Ashley could easily be the Hobbits' distant progenitors. They are both rather short...
Don't work in IT!
It is improper to ask if game designers should be conveying moral values through their games, because they can not avoid doing so. Every game, be it Duke Nukem or Myst, orginates from the morality of its designers. They can not avoid it because they must make choices about the plot and player's possible decisions that can not be made in any other way.
You can ask if which moral values are appropriate to include in games, and the answer would be that it is not possible to make any restrictions in this area without total censorship of all games produced. It is already being done in part through the ratings system. Whether it would be possible to impose further restrictions is somewhat doubtful. (though becoming less so every year)
I am so glad that KHangman finally got some usability improvements. I use this thing ALL the time!
> But after years and years of continued maintenance with no
> comments, your clean, elegant code has turned into a monster hairball of crap.
I didn't say you should write all your code without comments. I said that it is better to write your code clearly, so it doesn't require them. If you have a hairball of crap, you obviously need comments. You should put them in when you regurgitate it. At the same time put in a reminder to yourself to fix it, like a doxygen \todo comment. Then, when the crunch period is over, you go through the code and turn it back into a clean elegant form. At that point it should once again require no comments due to painful obviousness. Finally, you should make an appointment with your supervisor to discuss crunch time policy, illustrated with graphic before-and-after printouts and estimates on just how much time you lost due to hairballs of crap in them.
> code for a living, don't code on large projects,
> don't code on projects with other people, or
> haven't ever coded anything that will stay in
> production for longer than four years.
Ah, here come the "I'm a badass programmer on a big project" nonsense. Here's some advice for your company:
> Every programmer worth his/her salt knows that
> source code is self documenting...
And it's true too. Although comments are indeed a good thing, writing code that does not require them is a much better one. If your code needs comments, it's probably too complex for continued maintenance.
> If a company breaks the law and makes me lose money
Making you lose money is not against the law. You bought the ink cartrige on your own free will. It is not a crime to sell you less than you expected and should not be.
> I have no other recourse but to sue them to recover my losses.
The company is not responsible for your "losses". They sold you a cartridge; it had ink in it; you had the option to use it before the expiration date; if you didn't, it's not their fault and not their problem. As I said before, if you don't like timed cartridges, don't buy them; that's your recourse to not "lose" any more money.
> how to deal with them breaking laws and cheating me out of money.
It is an issue of trust. You should learn something about the product before buying it; the responsibility is yours. Even if their marketing department did nothing but lie to you and sell you worthless garbage, you still had to make the decision to purchase it. The company did not "make you lose money", you did it to yourself by buying something of unknown value. So chalk it up to experience and quit whining about your "lost" money.
If you don't like what the company is doing, don't buy their printers. Vote with your wallet; it's the democratic way to show 'em you are displeased. Lawsuits, on the other hand, are backed with guns, and are the way of tyrants. Take your pick.
> I don't understand why people care about how loud a computer is.
Because you listen to loud music. I never listen to any music at all and consider any noise a distraction. With my homemade liquid cooling system and an LCD monitor I can hear nothing at all from the computer, which reduces the ambient noise to nearly zero. Living in a quiet neighbourhood (no idiots with loud stereos next door!), having a good heat pump (though wishing for a radiant floor heater instead), and a silent computer, can create an incomparable heaven of silence. That's when I can really start thinking.
> But the act in which you willfully engaged was
> intercourse - the HIV contraction was a
> side-effect, an unintended consequence.
Let's try again: adopting the GPL is like infecting yourself with HIV. You might tell everyone about it, but people with either refuse to sleep with you or have to get HIV for the "privilege". It's a virus, whether everyone knows about it or not.
> The GPL is not viral. It does not infect software
> of its own accord. You make a choice whether or
> not to include other people's code in your software
If that's your argument, HIV is not a virus either, since you need to make a choice to have sex to get it.
There is no need for 50 licenses because most of them say the same thing. There are only a few different license types, so it is a good idea to remove the duplicates. As far as I know, there are only GPL, LGPL, BSD, and MIT license types, with most of the other being variations on their theme with an occasional extra restriction ignored by everyone except the license writers.
> Blindly writing a block of memory prevents using _any_ kind of pointer
:) I've never had a program that relied on this, but I have occasionally taken advantage of it when dumping data in the debugger.
It is amusing that it will actually work for the developer for quite some time, because often the program is loaded at the same address each time you run it. Then you install some service and suddenly your saved games don't work any more
> how's a fixed memory block going to accomodate the inventory
> in an RPG? Have a fixed buffer for every single object in the
> game, for example, saying how much of each you've got?
Believe it or not, that's exactly what Omega (ancient roguelike game) does; there is a 26-slot pack in a global variable and a 13-slot inventory in a global variable. It also has an Objects and Monsters global static arrays in large header files, which are modified at runtime to indicate which objects are "known" and to make special creatures.
> Can I ask you how a memeory leak occurs with a system using
> virtual memory? The application crashes with a fatal error
> -- as a result the memory is reclaimed by the VM.
Well, yes, you are right. It wouldn't really be a memory leak; I just think of it as such. There would be a memory leak if you tried to use the same code in a non-terminating function and something threw an exception. You'd have to catch it and delete the pointer manually.
But the real problem still remains: if you let the VM reclaim memory, the destructors are not called. You could have a leak then if you used shared memory or some other global resource. A game would have a good reason to do so to take advantage of X shared memory extension.
> Actually, a 360 degree change in direction is no change in direction at all.
Are people so uneducated these days that they can't get a joke? Sigh...
Use these passcodes. Then we won't have to memorize another 120 meaningless numbers.
> There are many people who seriously help in
> opensource development yet are too low profile to
> show up in the docs or help feed information to
> the actual developers (like for example the
> people in help channels)
If we are going to count all people who help open source developers, why stop with help channels? Shouldn't we also include the fine people at AMD and Intel who provide the computers that we use? Tyan for making my motherboard, Samsung for making my monitor, Logitech for making my mouse, and gasp even Microsoft who made my ergonomic keyboard. Then there are the book authors (you didn't think you could accomplish anything without them, did you?) like Knuth, Fowler, Abrash, Carmack, and many others.
Then you need to include the contractors who built your house (try coding on the sidewalk!), the electricians who ran the power wiring through the walls (computers don't run on air), the HVAC technicians that installed your heating furnace (hard to code when you're shivering). Also, don't forget to include your employer, since without him you'd have no money to buy the house in which you live, the computer on which you work, or the food to keep you alive. Speaking of food, don't forget to include farmers and supermarkets, without whom you'd not be able to write a single line of code due to being dead.
Gosh, that pretty much includes everybody in the world! I'm so glad that OpenSource development is so darn popular.
> It's just driving even more traffic there now that wouldn't be generated otherwise.
Come on, this is Slashdot. We never read the articles.