Re: A re-announce on GC's defects
- From: "Bruce Wood" <brucewood@xxxxxxxxxx>
- Date: 18 Jan 2007 10:24:39 -0800
Born wrote:
Suppose we're doing a 3D game. A radar is monitoring a target. Obviously,
the radar should hold a weak reference to the target. When the target is
killed, logical confusion is immediately brought to the radar watcher (the
gamer). Is the target destroyed or not? You can not tell him, hey, it's
killed but still shown on the radar because you've got to wait for the GC to
make it.
Oh. My. God. You can't seriously tell me that you would use the memory
allocation state of an object to determine whether it is "alive" or not
in a game? Are you really that bad a designer that you would mix the
concepts of a target's relationship to the game and its memory
allocation status? Even when I programmed in C++ I didn't mix ideas
like that: an object is dead when I flag it dead. It may be destructed
immediately, or some time later. What if I decide to keep a list of the
player's kills? Does it then become impossible to kill anything,
because it's in the kill list?
If you're going to trumpet the benefits of deterministic destruction,
please, please don't offer terrible designs as evidence.
I believe the restriction by GC is one of the main reasons why in some field
(the gaming industry, for example), java or C# is rarely used in serious
products who face real computing challenges.
This made me laugh. I love the little caveat, "in some field" You had
to add that because in _many_ fields garbage collected languages do
just fine.
So what is your complaint, really? That a GC language can't handle
every problem in every domain? No ***, Sherlock. There _are_ people
using C# and Java for gaming (the latter mostly for portability to
micro platforms, but that aside...) but I wouldn't use it for that. I
would use C++ to write games for precisely the reasons that you are so
ham-handedly outlining here, which can be summed up in one sentence:
more control. GC is a two-edged sword: it removes a lot of picky
housekeeping that has caused more bugs than anything I know of. (Larry
Lard pointed this out rather sardonically in his post: C++ is infamous
for memory allocation bugs.) The other edge of the sword is that GC
removes control from the programmer, which is what you're complaining
about. For _most_ applications, the loss of control doesn't matter. For
some, such as gaming, it does. So, in those domains, use C++.
I no longer consider C++ a serious language for business development.
You know, the meat-and-potatoes, number-crunching applications that
make up most of the world's software. Why? Because C++ adds a lot of
picky housekeeping (memory management) that gains me nothing. I don't
need the additional control it offers, and the cost of that control is
bugs. For some domains (such as gaming), the tradeoff is warranted. For
most, it's not, which is why Java and C# are doing so well.
If you're so close to the metal that the tiny delays introduced by
..NET's GC will screw up your app, then the answer is simple: DON'T USE
IT. USE C++.
In the end, what are you trying to prove here? That C# can't tackle
every problem under the sun? We all know that. Move on. Nothing to see
here. Or are you trying to demonstrate that C# isn't suited to any
problem domain at all? If so then I refer you to my previous post:
you're missing something.
1) The ideal solution is to convince the language providers to give us back
the ability of managing memory by our own. GC can still be there, and it
becomes a real addictive in that situation.
And this buys us... what? The ability to use C# / Java in a few domains
where it isn't working well right now? Why not just use a better-suited
language? What is it about programmers, all of us, that makes us want
to invent the super-duper maxed-out Swiss Army Knife of programming
languages that can do anything? They already tried that. It was called
Ada. How many people still use Ada? So what if game development is
mostly done using C++ and not C#? Would you do brain surgery with a
Swiss Army Knife? Of course not: you would use specialized tools. What,
then, is so wrong about using the best language suited to a particular
domain, rather than trying to create the language that can do anything?
.
- Follow-Ups:
- Re: A re-announce on GC's defects
- From: Born
- Re: A re-announce on GC's defects
- References:
- A re-announce on GC's defects
- From: Born
- A re-announce on GC's defects
- Prev by Date: Windows Server 2003 installation and requirements
- Next by Date: Re: System.Timer!
- Previous by thread: Re: A re-announce on GC's defects
- Next by thread: Re: A re-announce on GC's defects
- Index(es):
Loading