Programming & IT Discussion

Status
Not open for further replies.
i don’t understand… it should be just added to the new version… even though it’s from old version…
To use a real-world example, let’s consider Java generics. Pre-generics, an implementation for ArrayList might have looked like:
Code:
public class ArrayList implements List {
  private Object[] a_;

  // Some implementation details

  boolean Add(Object o) {
    // implementation
  }
Now let’s say that you want to add generics. For starters, the class’s declaration might now look like:
Code:
public class ArrayList<T> implements List<T> {
  // implementation
}
But now you run into your first problem. Existing code would look like:
Code:
List l = new ArrayList();
If you force someone to provide T, then this code breaks. You can fix this by continuing to allow the old code at the loss of compile-time type checking, which is what Java did. But there’s another consideration, if you change the underlying array to this:
Code:
private T[] a_;
and the Add implementation to this:
Code:
boolean Add(T o) {
  // implementation
}
Then you are now enforcing that some type be known, and you’re back at breaking existing code. Maybe you can make the typeless variable declaration a shorthand for ArrayList<Object>(), but that’s a type of obscure shorthand Java tends to avoid.*

In the end, Java now just erases the type, effectively treating all T as an Object. That comes with its own problems, but it doesn’t break backwards compatibility.

On the flip side, I believe Microsoft ran into the same dilemma with C# and went with the T-backed array approach. It broke all existing code, but C# now is better at generics than Java, though Java is still suitable for almost every practical use case. There’s still a lot of complaints about the limitations of type erasure, but a lot of the complaints I see about Java’s limitations come from bad software engineers who wanted to do something you shouldn’t do anyways and don’t want to put in the effort to do things right (ironically).

* Someone might argue that Java, no matter what, is still obscure with its current allowance of not providing the generic type. However, since Java’s established behavior is type erasure, I would say this isn’t the case. No matter what, you’re working with an Object-backed array and are bound by those limitations. It’s just that now those limitations are more pronounced.
you mean, you were once worked at Google?
I still do.
 
Last edited:
Maybe you can make the typeless variable declaration a shorthand for ArrayList<Object>()
actually, i’m still beginner at Java, so i didn’t really get this part, especially the generics part…

anyway, yes i heard about the backward compatibility but don’t really know the details yet… i just assuming that the old syntax in the latest lang’s update is no longer compatible due to some additions for the lang and modifications for the previous syntax that made it no longer valid…
I use it on a daily basis.
if i wanna learn it, should i install the sql server or is it already installed by Visual Studio?
 
if i wanna learn it, should i install the sql server or is it already installed by Visual Studio?
Go ahead and install SSMS. You don’t really write SQL in Visual Studio. Plus it will look good that you’ve dealt with an application that deals with managing servers.
 
anyway, i have this installed in my comp… is it the same?

(Please Note: This uploaded content is no longer available.)
 
btw, guys, does anyone using win 10 here? anyone ever had a problem when restarting and pc got crashed? is it hardware-related issue?
 
ok, sorry for late reply

it always crash when restarting:
(Please Note: This uploaded content is no longer available.)

after that:
(Please Note: This uploaded content is no longer available.)

i chose advanced options:
(Please Note: This uploaded content is no longer available.)
(Please Note: This uploaded content is no longer available.)
(Please Note: This uploaded content is no longer available.)

it always error like that

anybody know how to fix it?
 
Status
Not open for further replies.
Back
Top