mark drakos wrote:Additionally, are there any paradigms which are suitable for java programming, besides procedural and object oriented programming?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ivan Jozsef Balazs wrote:Sometimes differences lurk under the similar syntax.
C++ templates are different from Java Generics.
Generally speaking Java is more intrusive than C++.
In C++ you can throw anything, in Java only Throwables, but you have automatically access to the stack trace.
In C++ there is multiple inheritance of implementation and you can have "empty" classes with only pure virtual functions: in Java there are interfaces and only
Java and its core libraries cover a waste set of topics including threading/concurrency, serialization, networking, XML processing/DOM, GUI, zip/gzip compression, cryptography, CORBA, whatnot. And there is a tremendous quantity of open-source stuff around Java.
If I felt entitled to do so, I said "Welcome to Java land".
Satanas??Ivan Jozsef Balazs wrote: . . .
<apage satanas>
. . .
</apage>
Ivan Jozsef Balazs wrote:> the preprocessor.
The features of the preprocessor can be seen as arguments for or against it...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
I personally used and would recommend the Core Java series by Horstmann,Cornell.
Campbell Ritchie wrote: Java does not support pass‑by‑reference, as I believe C++ can.
Ivan Jozsef Balazs wrote:Yes, C++ does and Java does not support pass by reference. In C++ it is supported through the reference variables, a welcome and useful syntactical sugar coating around pointers.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Ivan Jozsef Balazs wrote:Yes, C++ does and Java does not support pass by reference. In C++ it is supported through the reference variables, a welcome and useful syntactical sugar coating around pointers.
Yeah, the problem for most people coming from C++ is that Java parameter behaviour when it comes to reference types looks like what you'd call "pass by reference" in C/C++
Jeff Verdegan wrote:I think one place where people coming from C++ get misled--and this has implications for how they view parameter passing--is that Foo x; in Java is more like Foo* x in C++.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Jeff Verdegan wrote:I think one place where people coming from C++ get misled--and this has implications for how they view parameter passing--is that Foo x; in Java is more like Foo* x in C++.
Hmmm. Not so sure there. I think it has more to do with the fact that, in C++, if I have a Customer object, I can can actually pass IT by value by simply putting 'Customer c' in my parameter list
(*). C++ classes are actually mapped to specified (and, I believe, contiguous) memory, which is why there's no problem with this; whereas in Java the way an object is mapped in memory (although probably similar) is NOT specified - at least, as far as I know.
Henry Wong wrote: it is great having the C library, which I knew very well, available whenever I wanted it
Jeff Verdegan wrote:I don't see what that would have to do with variables holding objects, or passing objects by value.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
surlac surlacovich wrote:
Henry Wong wrote: it is great having the C library, which I knew very well, available whenever I wanted it
Why not to use JNI in this case, big overhead while calling native library code?
Winston Gutkowski wrote:
Jeff Verdegan wrote:I don't see what that would have to do with variables holding objects, or passing objects by value.
Well, in the latter case, it means that a method call simply needs to copy a contiguous section of memory (which is, I'm pretty sure, what it actually does). If an object could be scattered, it would make the whole business of supplying an object by value darn complicated, since presumably there would then have to be some sort of mapping operation.
Jayesh A Lalwani wrote:
For most practical purposes, a STL smart pointer behaves just like a Java reference. Even the specifics of "pass by reference" vs "pas by value" also becomes the same. See, when you pass a smart pointer as variable or copy it, the object of the smart pointer is copied/passed by value.
Jayesh A Lalwani wrote:The copy constructor and the equal-to operator of the smart pointer are overloaded to copy the real pointer. The object that the real pointer points to doesn't get cloned
Jeff Verdegan wrote:If there needs to be such an operation, it's already there, and used by clone().
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Jayesh A Lalwani wrote:Speaking of which, C++ also has this wierd reference operator(&) that is used for parameters. When you declare a variable as a reference, it passes the object by reference but syntatically it's an object.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Jeff Verdegan wrote:If there needs to be such an operation, it's already there, and used by clone().
Maybe we're talking at cross-purposes here. What I was describing is how C/C++ passes objects by value (which doesn't exist in Java). And it most certainly is not by cloning, nor does it mimic Java clone() behaviour - at least not back in Jurassic times when I was using the language, it didn't- it is a simple memcpy() (or equivalent).
Winston
Jeff Verdegan wrote:I don't see why you're saying Java copying an objet by clone() is not equivalent to C++ copying an object by memcpy(). As far as the programmer is concerned, the semantics are the same.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:I often find it causes more confusion than anything else when people start saying, “Well, that’s how it works in C/C++.”
The three languages are different, and (unlike C++) Java is not a superset of any of the others.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Right, because a non-primitive variable can hold an object in C++,
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
|