4 ms·
> note: in java, everything(except basic types) is a pointer. so you rather should ask the opposite: why do I need simple objects? I think this is by far the m
by stormbrew 13y ago
> note: in java, everything(except basic types) is a pointer. so you rather should ask the opposite: why do I need simple objects?
I think this is by far the most important piece of advice in that thread. It gets right to the heart of one of the most basic areas of confusion that programmers coming from garbage collected environments to ones with manual memory management have.
They need to understand that they have NOT been working in an environment without pointers, as they are often told to believe, but one in which nearly everything is a pointer. Understanding this is fundamental to understanding these differences and a 10,000 word essay about C++ allocation policies will not make it any clearer without dealing with that first.
- malisper 13y agoBut the fact that they are programming in an environment where everything is a pointer is hidden to the them. In C++ one needs to explicitly use pointers whereas in Java all of the pointers are handled behind the scenes.
- abengoam 13y agoNot really. In Java it's a leaky abstraction - it's true that the JVM does a lot of micromanagement for you, but if you are careless you start getting exceptions (best case scenario) or start to get mysterious changes in your data (worst case scenario). I agree with grandparent that understanding what a pointer is and that almost everything in a Java program is a pointer it's critical for a Java programmer.
- banachtarski 13y agoI'm amazed at how many new programmers enter the workforce without a basic understanding of the stack and the heap.
- IsTom 13y agoI've met an 'architect' who didn't know either. Apparently Java world is governed by a different set of rules.
- greatdox 13y agoMost of them are recent high school and college dropouts. What did you expect them to know? They learned programming by reading blogs and pirated PDF files on BitTorrent. Of course they don't got a level of understanding most hackers here have. You want a good programmer you need 15+ years of experience plus a good understanding of computer science, recent high school and college dropouts don't have that. You hire a cheaper labor source, you won't get that level of quality a more expensive labor source will give you and you get what you pay for!
- banachtarski 13y agoWell, to be fair, I don't have 15 years of experience (professional experience anyways). But I do believe the fundamentals are important and they seem to be glossed over.
- stusmall 13y agoI think that might be a bit too broad of a take away. I hate to be a pedant but C# allows user defined value types and I'm sure there are other GC'd languages that aren't as reference type heavy as Java. I think it would be a more fair statement if you replaced "garbage collected environments" with Java. I say "more fair" because I don't think I know any serious Java devs who don't understand the difference between reference and value types. I could just be lucky with who have crossed my path though. EDIT: After thinking about it a little, most of the Java people I know have at least some embedded or native background. This could be a reason. I don't know what the market over all is like.
- stormbrew 13y agoConsider the other direction from Java, into the fully dynamic languages. Many of those give you even less ability to control heap vs. stack allocations than Java does and often present an everything-is-a-reference facade even on things that are often optimized to stack objects (Fixnum in Ruby for eg). But yes, a java programmer with embedded or native background would have a better understanding of this than people who learned Java first, which is what I'm really addressing here. And in the OP on SE you can clearly see that this is a big part of that person's confusion.