Mike Margerum wrote:
Quote
Ahhh the classic C+ programmer disease. I was stuck in that mode for
a few years. Hard to break old habits :)
LOL!! I litrally hated to have to come behind someone that was pointer
happy. I felt like they were playing "Dirty Harry" and I was "making their
day" <G>. They were certainly making mine, and I was like the singer in the
song, "Ain't no sunshine when your gone" :)
Quote
True but it sucks having to code a class when what you really want to
do can be encapsulated in a simple function.
Yes I can agree with that. You have to get used to the class stucture part
and how I kinda "fake" regular function calls, is to create a class that
acts like a class template. Not difficult to do, just a little different.
I, of course try and group common functionality and not all things fall into
specific groups (as we all know, and those who are {*word*60}ed to UML will
soon discover :)). Of course I have seen some OOP Java programmers who are
as bad at normalizing classes as some DBAs do databases :). In these cases,
you have to ask the question, "How do I get there from here?" Answer? Step
into my maze :):)
Quote
>The only exception is when dealing with primitive types. Then Object
>allocation can be a waste of precious memory (bet I get attacked on that
>one <G>).
>
No you are dead on. The fact the java doesnt have true primitive
types hurts its performance as I understand it. Then again, the
object allocation/deallocations in C# and java are heavily optimized
and are just moving pointers around most of the time i'm sure. Thats
the one place they mop up C++ with the standard allocator :)
Well Java does have primitives, for the more common types. int, long, float,
double, char,and boolean are all primitives iu Java. They also have their
class countertypes, Integer, Float, Long, Double, Boolean.
The only thing that I wish Java handled better is Strings. There are some
pretty powerful functionality with String classes, but if you are not
careful, typecasting and concatenation can cost you some real heap space.
Of course NET, in its Java clone fashion, suffers from this same malady.
Quote
C++ still makes a fine all around langage for just about anything.
Between Boost, STL, and wx/qt you can pretty much build an app that
will run on just about any platform. It's not as consistent as java
but it doesnt come with all the warts either. My three biggest gripes
with java are lack of deterministic destructors, JNI, and the fact the
each process has to have its own VM.
I understand the deterministic destructor part, but theoretically, whenever
an object goes out of scope, it should be gced in the nearest order or pass
of the next gc cycle. I know it is hard to determine exactly when that GC
operation occurs, but there is way of forcing gc operations. Of course, you
are probably using or missing, I should say, dd as when declaring Object
scope and the object (upon losing scope), not only calls its destructor,
but also performs other clean up operations. For example, closing a file
when a file object has gone out of scope.
The latter type example is about the only time I can see this as being
advantageous however. The very nature of a gced language inherently frees
the object once it is out of scope, or at least makes it available for gc.
You can, of course force gc, or do as I generally do, set the object to
null in the finally or finalization section of a class.