A huge change in Java and C#

Finally, after a long discussion between C# language team and Java language team, they decided to remove the famous keyword: 'new'.

// Not a valid code anymore.  
Person p = new Person();
// New dependency injection syntax.  
Person p = new.Resolve<Person>();

Anders Hejlsberg and James Gosling have told they are very happy about this, as it is the first time Java and C# language teams collaborate on a huge decision like this.

It is interesting to know that Jon Skeet has already started answering the related question on StackOverflow and gained another 200K even before the spec is finalized. After all, he is the only one who is a little familiar with both languages!

Rumors say that Eric Lippert is unhappy with this feature and is preparing a post on FAIC to describe why this was not a good decision to take.

BTW, as it is a huge breaking change and it's so difficult to notify all developers about it, Scott Hanselman is going to notify all developers on all planets by a tweet with his account.

As this decision is made on April, 1st, the plan to deliver this feature is going to be as fast as possible for each language:

  • C#: As Visual Studio 2020 is going to ship on April, 2nd, Mads Torgersen himself has added this feature to the compiler and it would be shipped with Visual Studio 2020. So you can start using it tomorrow.
  • Java: As the compiler source code is in C++ it would take so much longer to implement. According to the plans, this feature will be released as a part of Java 25 which is planned to release somewhere in 2025.

For more detail on how this huge change would be applied on April 1st, Check this wiki page:
New spec for 'new' keyword on C# and Java

About the author

Mehran Davoudi

A former technology geek! Currently a mentor and software architect, working as a consultant for companies with large scale software development.
Why dvd? Read about me (uɒɹɥəɯ)!

View all posts


Leave a Reply

Your email address will not be published. Required fields are marked *