• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

What else apart from these should a Java developer learning C# keep in mind?

 
Saloon Keeper
Posts: 28420
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:That sounds like Hungarian notation; see Joel Spolsky.



No, the use of underscores for non-public functions in Unix/C predates the very existence of Microsoft.

Hungarian notation is a now-discredited technique where the data type of a variable was encoded as a prefix into the variable's name. The underscore convention was a semantic signal that ordinary application programmers should use the indicated variable or function with care, if at all and was really just a way to avoid namespace collisions back before namespaces existed in the C-verse. Because of the prefix-underscore convention, application developers weren't going to accidentally/unknowingly name one of their own resources the same thing as an internal support resource with possibly tragic results.

Hungarian notation was a disaster in C++. I tried using it for a time, but I was refactoring my data types so often that the names and actual data types ended up at odds more often than not.
 
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A feature that I saw in C# and not in Java is the support for Default parameters in methods.
 
Tim Holloway
Saloon Keeper
Posts: 28420
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Monica Shiralkar wrote:A feature that I saw in C# and not in Java is the support for Default parameters in methods.


It's in C++, though.
 
Marshal
Posts: 80128
417
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:. . . It's in C++, though.

As are operator overloading and multiple inheritance. Obviously one of the features Gosling rejected twenty‑five years ago for the design of Java®.
 
Monica Shiralkar
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Was it rejected because of performance reasons ?
 
Tim Holloway
Saloon Keeper
Posts: 28420
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, there shouldn't have been any problem with performance.

But as I just said elsewhere - apparently some conversations are leaking sideways today - it's a compiler designer's nightmare to handle default values with overloaded methods.
 
Monica Shiralkar
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It also frustrates me when C# does not have concept of checkered exception and for the same reason does not have throws keyword.
 
Tim Holloway
Saloon Keeper
Posts: 28420
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

zacharia nicholson wrote:It also frustrates me when C# does not have concept of checkered exception and for the same reason does not have throws keyword.


The original "throw/catch" was developed long ago in C, with the setjmp/longjmp functions. Which were fairly crude, and thus C++ added true throw/catch to its language. Except that unlike in Java, you could pretty much throw anything, not just exceptions (which were not originally part of C++).

I haven't looked at C# lately, but I doubt that they actually stepped backwards in that regard.
 
Campbell Ritchie
Marshal
Posts: 80128
417
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's a long time since I wrote any C#, but I think it is the concept of checked exceptions they abandoned. We all know what a controversial feature of Java® it was, and I am not aware of other languages using checked exceptions.
 
Monica Shiralkar
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While working on C#, I noticed that the below line will not even compile  :


This is different from the case in java as the below line will compile( and later give exception at runtime ).

 
Bartender
Posts: 15737
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, C# disallows division by 0, if it can determine that the divisor is 0 at compile time.
 
Monica Shiralkar
Ranch Hand
Posts: 2954
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, C# disallows that at compile time whereas Java gives error at run time.

Is it related to the difference in the way C# and Java handle exceptions ?
 
Campbell Ritchie
Marshal
Posts: 80128
417
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Monica Shiralkar wrote:. . . difference in the way C# and Java handle exceptions ?

Please explain how those two things could be related.
 
reply
    Bookmark Topic Watch Topic
  • New Topic