Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Java vs. C#

Java vs. C#

Scheduled Pinned Locked Moved The Lounge
wpfcsharpvisual-studiodata-structuresquestion
20 Posts 12 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L loctrice

    I am primarily a c# .net programmer, and recently at my job I've being moved to Java/GWT . I used java back in the day for a bit, but never found a job at it. I just let go and dove into .net. I only used core Java, so I've been doing a lot of catching up. Brushing up on Java, learning maven, learning hibernate, learning servlet/tomcat/web basics. I'm getting ready to dive into the GWT stuff as soon as I finish this hibernate module on pluralsight.

    Elephant elephant elephant, sunshine sunshine sunshine

    I Offline
    I Offline
    Ian Shlasko
    wrote on last edited by
    #5

    Well, GWT is horrible and scary at first, but when you figure out how to do things their way, it's not TOO bad... If, like me, you're familiar with WPF/XAML, you'll want to do your GWT with the UiBinder stuff... It's a XAML-wannabe... But be warned that all the data binding is static. Would suggest avoiding GWT-RPC though... Do a RESTful service or something... Keep the client and server separated. GWT-RPC is easy to use, but it binds your tiers way too tightly.

    Proud to have finally moved to the A-Ark. Which one are you in?
    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

    E 1 Reply Last reply
    0
    • I Ian Shlasko

      I apologize in advance for not telling a joke about telling jokes about things, but I need to vent, and I just happen to have the Lounge open in my browser (As always)... Ok, so I'm mainly a .NET programmer, but I've spent the last couple months writing a three-tier Java/GWT/GXT application... Hadn't used Java in over a decade, so had to teach myself a few frameworks, but that's no big deal... Part of the job... So now I think I have enough experience to complain about both... Things C# Has and Java Needs: * Property syntax... Seriously, I'm so sick of writing getThingy and setThingy methods. They're ugly and they don't add anything. I miss being able to just type "public double Thingy { get; set; }" * Namespace/package aliases. "using STUFF = com.blah.meh.ugh.stuff" would be great. Wildcards are ok, but there's so much junk in the JRE with similar names that it gets confusing * IEnumerable. Seriously, why does it matter if a function returns an array or a list, if all I'm going to do is iterate it? Arrays and Lists need to implement some common interface(s) so I'm not always converting back and forth depending on which third-party library uses which. * Function pointers that actually work... I hate having to build an inner/anonymous class that implements an interface, just so I can pass a callback. This might be a GWT weakness instead of a Java weakness... * Optional method arguments. * Partial classes. Splitting code between files makes it much easier to organize * Multiple classes per file. Honestly, if I have a handful of classes that are about five lines each, why do they each have to be a separate file? Why can't I just put them in a "Things.java" file (Or something more specific than 'Things')? * Events... Sure, there are event frameworks, but the ones I've messed with feel clumsy and hacked-in... Need native language support for it. * Project/module-based root packages. In C#, I can say my project's root namespace is "Company.This.That.TheOther" in ONE place, and never have to mess with it... In Java, my whole source tree is supposed to be under "com/company/this/that/theOther/" and every single file has to have "package com.company.this.that.theOther" at the top. If my IDE didn't automate refactoring, that would have driven me right out the window. * WPF/XAML. GWT/UiBinder is about 20% of the way there. Maybe there's another framework that gets 30% of the way... But man, I really miss DataTemplates, Styles, and dynamic binding... Things Java has and C# Needs:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #6

      That's all? How about - unsigned integers as a type (`Integer.fooUnsigned` is kind of ugly), particular bytes. - value types. - operator overloading. - generics that are actually generics. Type erasure sucks. Things that GWT *really needs*: - correct arithmetic. Seriously. How the hell can they get away with this nonsense[^]?

      I 1 Reply Last reply
      0
      • L Lost User

        That's all? How about - unsigned integers as a type (`Integer.fooUnsigned` is kind of ugly), particular bytes. - value types. - operator overloading. - generics that are actually generics. Type erasure sucks. Things that GWT *really needs*: - correct arithmetic. Seriously. How the hell can they get away with this nonsense[^]?

        I Offline
        I Offline
        Ian Shlasko
        wrote on last edited by
        #7

        harold aptroot wrote:

        unsigned integers as a type (Integer.fooUnsigned is kind of ugly), particular bytes.

        Haven't had to mess with that yet...

        harold aptroot wrote:

        • value types.
        • operator overloading.

        I was advised to completely avoid 'int' in favor of 'Integer' (And the equivalents for other types) when it comes to GWT... Would be nice if it handled them, as I wince every time I look at a bunch of 'Integer' and 'Boolean' variables...

        harold aptroot wrote:

        generics that are actually generics. Type erasure sucks.

        Hasn't bugged me yet... The opposite, actually... I had to delve into writing my own GWT code generator, because a certain third-party framework (*cough*GXT*cough*) is so hung up on generics that they can't handle polymorphism...

        harold aptroot wrote:

        correct arithmetic. Seriously. How the hell can they get away with this nonsense[^]?

        Wow... Ok... That's just... horrid...

        Proud to have finally moved to the A-Ark. Which one are you in?
        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

        I 1 Reply Last reply
        0
        • I Ian Shlasko

          I apologize in advance for not telling a joke about telling jokes about things, but I need to vent, and I just happen to have the Lounge open in my browser (As always)... Ok, so I'm mainly a .NET programmer, but I've spent the last couple months writing a three-tier Java/GWT/GXT application... Hadn't used Java in over a decade, so had to teach myself a few frameworks, but that's no big deal... Part of the job... So now I think I have enough experience to complain about both... Things C# Has and Java Needs: * Property syntax... Seriously, I'm so sick of writing getThingy and setThingy methods. They're ugly and they don't add anything. I miss being able to just type "public double Thingy { get; set; }" * Namespace/package aliases. "using STUFF = com.blah.meh.ugh.stuff" would be great. Wildcards are ok, but there's so much junk in the JRE with similar names that it gets confusing * IEnumerable. Seriously, why does it matter if a function returns an array or a list, if all I'm going to do is iterate it? Arrays and Lists need to implement some common interface(s) so I'm not always converting back and forth depending on which third-party library uses which. * Function pointers that actually work... I hate having to build an inner/anonymous class that implements an interface, just so I can pass a callback. This might be a GWT weakness instead of a Java weakness... * Optional method arguments. * Partial classes. Splitting code between files makes it much easier to organize * Multiple classes per file. Honestly, if I have a handful of classes that are about five lines each, why do they each have to be a separate file? Why can't I just put them in a "Things.java" file (Or something more specific than 'Things')? * Events... Sure, there are event frameworks, but the ones I've messed with feel clumsy and hacked-in... Need native language support for it. * Project/module-based root packages. In C#, I can say my project's root namespace is "Company.This.That.TheOther" in ONE place, and never have to mess with it... In Java, my whole source tree is supposed to be under "com/company/this/that/theOther/" and every single file has to have "package com.company.this.that.theOther" at the top. If my IDE didn't automate refactoring, that would have driven me right out the window. * WPF/XAML. GWT/UiBinder is about 20% of the way there. Maybe there's another framework that gets 30% of the way... But man, I really miss DataTemplates, Styles, and dynamic binding... Things Java has and C# Needs:

          R Offline
          R Offline
          Ravi Bhavnani
          wrote on last edited by
          #8

          Ian Shlasko wrote:

          IEnumerable. Seriously, why does it matter if a function returns an array or a list, if all I'm going to do is iterate it? Arrays and Lists need to implement some common interface(s) so I'm not always converting back and forth depending on which third-party library uses which.

          Does Iterable<T>[^] work for you? /ravi

          My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

          I 1 Reply Last reply
          0
          • R Ravi Bhavnani

            Ian Shlasko wrote:

            IEnumerable. Seriously, why does it matter if a function returns an array or a list, if all I'm going to do is iterate it? Arrays and Lists need to implement some common interface(s) so I'm not always converting back and forth depending on which third-party library uses which.

            Does Iterable<T>[^] work for you? /ravi

            My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com

            I Offline
            I Offline
            Ian Shlasko
            wrote on last edited by
            #9

            Not as long as this code fails to compile:

            Integer[] arrayOfStuff = functionThatReturnsAnArray();
            Iterable iter = arrayOfStuff;

            Proud to have finally moved to the A-Ark. Which one are you in?
            Author of the Guardians Saga (Sci-Fi/Fantasy novels)

            N 1 Reply Last reply
            0
            • I Ian Shlasko

              I apologize in advance for not telling a joke about telling jokes about things, but I need to vent, and I just happen to have the Lounge open in my browser (As always)... Ok, so I'm mainly a .NET programmer, but I've spent the last couple months writing a three-tier Java/GWT/GXT application... Hadn't used Java in over a decade, so had to teach myself a few frameworks, but that's no big deal... Part of the job... So now I think I have enough experience to complain about both... Things C# Has and Java Needs: * Property syntax... Seriously, I'm so sick of writing getThingy and setThingy methods. They're ugly and they don't add anything. I miss being able to just type "public double Thingy { get; set; }" * Namespace/package aliases. "using STUFF = com.blah.meh.ugh.stuff" would be great. Wildcards are ok, but there's so much junk in the JRE with similar names that it gets confusing * IEnumerable. Seriously, why does it matter if a function returns an array or a list, if all I'm going to do is iterate it? Arrays and Lists need to implement some common interface(s) so I'm not always converting back and forth depending on which third-party library uses which. * Function pointers that actually work... I hate having to build an inner/anonymous class that implements an interface, just so I can pass a callback. This might be a GWT weakness instead of a Java weakness... * Optional method arguments. * Partial classes. Splitting code between files makes it much easier to organize * Multiple classes per file. Honestly, if I have a handful of classes that are about five lines each, why do they each have to be a separate file? Why can't I just put them in a "Things.java" file (Or something more specific than 'Things')? * Events... Sure, there are event frameworks, but the ones I've messed with feel clumsy and hacked-in... Need native language support for it. * Project/module-based root packages. In C#, I can say my project's root namespace is "Company.This.That.TheOther" in ONE place, and never have to mess with it... In Java, my whole source tree is supposed to be under "com/company/this/that/theOther/" and every single file has to have "package com.company.this.that.theOther" at the top. If my IDE didn't automate refactoring, that would have driven me right out the window. * WPF/XAML. GWT/UiBinder is about 20% of the way there. Maybe there's another framework that gets 30% of the way... But man, I really miss DataTemplates, Styles, and dynamic binding... Things Java has and C# Needs:

              K Offline
              K Offline
              Kevin McFarlane
              wrote on last edited by
              #10

              No idea whether it addresses all your points but some use Scala as a "better Java," as opposed to using the functional bits. A colleague who has done extensive .NET and Java has also used Scala and prefers it. But, of course, it will have its own issues. :)

              Kevin

              I 1 Reply Last reply
              0
              • K Kevin McFarlane

                No idea whether it addresses all your points but some use Scala as a "better Java," as opposed to using the functional bits. A colleague who has done extensive .NET and Java has also used Scala and prefers it. But, of course, it will have its own issues. :)

                Kevin

                I Offline
                I Offline
                Ian Shlasko
                wrote on last edited by
                #11

                Heh, if I was the one picking the language for this project, I would have just stuck with C#/WPF :)

                Proud to have finally moved to the A-Ark. Which one are you in?
                Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                1 Reply Last reply
                0
                • I Ian Shlasko

                  I apologize in advance for not telling a joke about telling jokes about things, but I need to vent, and I just happen to have the Lounge open in my browser (As always)... Ok, so I'm mainly a .NET programmer, but I've spent the last couple months writing a three-tier Java/GWT/GXT application... Hadn't used Java in over a decade, so had to teach myself a few frameworks, but that's no big deal... Part of the job... So now I think I have enough experience to complain about both... Things C# Has and Java Needs: * Property syntax... Seriously, I'm so sick of writing getThingy and setThingy methods. They're ugly and they don't add anything. I miss being able to just type "public double Thingy { get; set; }" * Namespace/package aliases. "using STUFF = com.blah.meh.ugh.stuff" would be great. Wildcards are ok, but there's so much junk in the JRE with similar names that it gets confusing * IEnumerable. Seriously, why does it matter if a function returns an array or a list, if all I'm going to do is iterate it? Arrays and Lists need to implement some common interface(s) so I'm not always converting back and forth depending on which third-party library uses which. * Function pointers that actually work... I hate having to build an inner/anonymous class that implements an interface, just so I can pass a callback. This might be a GWT weakness instead of a Java weakness... * Optional method arguments. * Partial classes. Splitting code between files makes it much easier to organize * Multiple classes per file. Honestly, if I have a handful of classes that are about five lines each, why do they each have to be a separate file? Why can't I just put them in a "Things.java" file (Or something more specific than 'Things')? * Events... Sure, there are event frameworks, but the ones I've messed with feel clumsy and hacked-in... Need native language support for it. * Project/module-based root packages. In C#, I can say my project's root namespace is "Company.This.That.TheOther" in ONE place, and never have to mess with it... In Java, my whole source tree is supposed to be under "com/company/this/that/theOther/" and every single file has to have "package com.company.this.that.theOther" at the top. If my IDE didn't automate refactoring, that would have driven me right out the window. * WPF/XAML. GWT/UiBinder is about 20% of the way there. Maybe there's another framework that gets 30% of the way... But man, I really miss DataTemplates, Styles, and dynamic binding... Things Java has and C# Needs:

                  N Offline
                  N Offline
                  NickPace
                  wrote on last edited by
                  #12

                  Ian Shlasko wrote:

                  Property syntax...

                  I've found the lombok jar to be extremely useful for cleaning up pojos. Lightweight and simple to use: https://projectlombok.org/[^]

                  -NP Never underestimate the creativity of the end-user.

                  I 1 Reply Last reply
                  0
                  • N NickPace

                    Ian Shlasko wrote:

                    Property syntax...

                    I've found the lombok jar to be extremely useful for cleaning up pojos. Lightweight and simple to use: https://projectlombok.org/[^]

                    -NP Never underestimate the creativity of the end-user.

                    I Offline
                    I Offline
                    Ian Shlasko
                    wrote on last edited by
                    #13

                    Oooooooh... Thanks :)

                    Proud to have finally moved to the A-Ark. Which one are you in?
                    Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                    1 Reply Last reply
                    0
                    • I Ian Shlasko

                      Not as long as this code fails to compile:

                      Integer[] arrayOfStuff = functionThatReturnsAnArray();
                      Iterable iter = arrayOfStuff;

                      Proud to have finally moved to the A-Ark. Which one are you in?
                      Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                      N Offline
                      N Offline
                      Nagy Vilmos
                      wrote on last edited by
                      #14

                      Integer[] arrayOfStuff = {1, 2, 3, 4};
                      Iterable iter = Arrays.asList(arrayOfStuff);

                      #cough cough#

                      veni bibi saltavi

                      I J 2 Replies Last reply
                      0
                      • N Nagy Vilmos

                        Integer[] arrayOfStuff = {1, 2, 3, 4};
                        Iterable iter = Arrays.asList(arrayOfStuff);

                        #cough cough#

                        veni bibi saltavi

                        I Offline
                        I Offline
                        Ian Shlasko
                        wrote on last edited by
                        #15

                        Yeah, see... Gotta turn it into a list in order to iterate the stupid thing :sigh: EDIT: Or rather, to return it as an iterable... Can still iterate an array, but it's not an iterable... EDIT 2: And just thinking about it more makes me irritable... Heh

                        Proud to have finally moved to the A-Ark. Which one are you in?
                        Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                        1 Reply Last reply
                        0
                        • I Ian Shlasko

                          Well, GWT is horrible and scary at first, but when you figure out how to do things their way, it's not TOO bad... If, like me, you're familiar with WPF/XAML, you'll want to do your GWT with the UiBinder stuff... It's a XAML-wannabe... But be warned that all the data binding is static. Would suggest avoiding GWT-RPC though... Do a RESTful service or something... Keep the client and server separated. GWT-RPC is easy to use, but it binds your tiers way too tightly.

                          Proud to have finally moved to the A-Ark. Which one are you in?
                          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                          E Offline
                          E Offline
                          Eric Whitmore
                          wrote on last edited by
                          #16

                          Oh GWT... We thought you were the future and then Google released AngularJs. On a serious note, we have a GWT app that we are retiring after 6 years and migrating to Angularjs. GWT just has to much baggage. We found that we could get a lot more done using a restful json API and Angularjs.

                          Eric

                          I 1 Reply Last reply
                          0
                          • E Eric Whitmore

                            Oh GWT... We thought you were the future and then Google released AngularJs. On a serious note, we have a GWT app that we are retiring after 6 years and migrating to Angularjs. GWT just has to much baggage. We found that we could get a lot more done using a restful json API and Angularjs.

                            Eric

                            I Offline
                            I Offline
                            Ian Shlasko
                            wrote on last edited by
                            #17

                            Oh, I've got the restful JSON API covered... Loving the Jersey framework, despite the similarity to New Jersey (Hey, I'm a New Yorker - Making fun of NJ is just expected). Almost made me start liking Java... Until, just for fun, I tried doing the same thing in .NET and realized it was just as easy.

                            Proud to have finally moved to the A-Ark. Which one are you in?
                            Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                            1 Reply Last reply
                            0
                            • N Nagy Vilmos

                              Integer[] arrayOfStuff = {1, 2, 3, 4};
                              Iterable iter = Arrays.asList(arrayOfStuff);

                              #cough cough#

                              veni bibi saltavi

                              J Offline
                              J Offline
                              jibalt
                              wrote on last edited by
                              #18

                              Whoosh!

                              1 Reply Last reply
                              0
                              • I Ian Shlasko

                                harold aptroot wrote:

                                unsigned integers as a type (Integer.fooUnsigned is kind of ugly), particular bytes.

                                Haven't had to mess with that yet...

                                harold aptroot wrote:

                                • value types.
                                • operator overloading.

                                I was advised to completely avoid 'int' in favor of 'Integer' (And the equivalents for other types) when it comes to GWT... Would be nice if it handled them, as I wince every time I look at a bunch of 'Integer' and 'Boolean' variables...

                                harold aptroot wrote:

                                generics that are actually generics. Type erasure sucks.

                                Hasn't bugged me yet... The opposite, actually... I had to delve into writing my own GWT code generator, because a certain third-party framework (*cough*GXT*cough*) is so hung up on generics that they can't handle polymorphism...

                                harold aptroot wrote:

                                correct arithmetic. Seriously. How the hell can they get away with this nonsense[^]?

                                Wow... Ok... That's just... horrid...

                                Proud to have finally moved to the A-Ark. Which one are you in?
                                Author of the Guardians Saga (Sci-Fi/Fantasy novels)

                                I Offline
                                I Offline
                                irneb
                                wrote on last edited by
                                #19

                                Regarding the value types: Well, seeing as you're basically compiling to JS it "shouldn't" really matter. But if direct compilation to bytecodes/IL those value types do help a LOT on CPU caching optimizations. I've seen speedups of orders of magnitude on number crunching, simply by changing a class to a struct. I mean, for the love of Pete why can't I have something like a struct in Java? Do I always have to make use of several disjoint arrays of ints (necessitating multiple corroboration methods just to keep all of their indexes aligned) if my actual data is correlated in groups, why can't I just use an encapsulation to group them and still derive the benefits of sequential memory locations? True struct/class in C# isn't "wonderful" (i.e. not like C++ where you could have both in both manners), but at least it's "something". With Java there simply isn't any equivalent!

                                1 Reply Last reply
                                0
                                • I Ian Shlasko

                                  I apologize in advance for not telling a joke about telling jokes about things, but I need to vent, and I just happen to have the Lounge open in my browser (As always)... Ok, so I'm mainly a .NET programmer, but I've spent the last couple months writing a three-tier Java/GWT/GXT application... Hadn't used Java in over a decade, so had to teach myself a few frameworks, but that's no big deal... Part of the job... So now I think I have enough experience to complain about both... Things C# Has and Java Needs: * Property syntax... Seriously, I'm so sick of writing getThingy and setThingy methods. They're ugly and they don't add anything. I miss being able to just type "public double Thingy { get; set; }" * Namespace/package aliases. "using STUFF = com.blah.meh.ugh.stuff" would be great. Wildcards are ok, but there's so much junk in the JRE with similar names that it gets confusing * IEnumerable. Seriously, why does it matter if a function returns an array or a list, if all I'm going to do is iterate it? Arrays and Lists need to implement some common interface(s) so I'm not always converting back and forth depending on which third-party library uses which. * Function pointers that actually work... I hate having to build an inner/anonymous class that implements an interface, just so I can pass a callback. This might be a GWT weakness instead of a Java weakness... * Optional method arguments. * Partial classes. Splitting code between files makes it much easier to organize * Multiple classes per file. Honestly, if I have a handful of classes that are about five lines each, why do they each have to be a separate file? Why can't I just put them in a "Things.java" file (Or something more specific than 'Things')? * Events... Sure, there are event frameworks, but the ones I've messed with feel clumsy and hacked-in... Need native language support for it. * Project/module-based root packages. In C#, I can say my project's root namespace is "Company.This.That.TheOther" in ONE place, and never have to mess with it... In Java, my whole source tree is supposed to be under "com/company/this/that/theOther/" and every single file has to have "package com.company.this.that.theOther" at the top. If my IDE didn't automate refactoring, that would have driven me right out the window. * WPF/XAML. GWT/UiBinder is about 20% of the way there. Maybe there's another framework that gets 30% of the way... But man, I really miss DataTemplates, Styles, and dynamic binding... Things Java has and C# Needs:

                                  L Offline
                                  L Offline
                                  Luiz Monad
                                  wrote on last edited by
                                  #20

                                  "Wildcard arguments for generics. If I have Foobar and Foobar, it's nice to be able to put them in a collection/array typed as Foobar. The '? extends X' and '? super X' syntax might be a bit much, though."

                                  C# has covariance and contravariance, no need for that. That Java sintax is horrible, I can't even understand it without reading the docs every time, even C++ sintax for templates I can get. It must be because of type erasure, Java doesn't really have Generics per se, it fucks on runtime with method binding, this is how we get the polymorphism, and without it, there's no true OO with Generics, Shame! (luckily I don't use Java everytime).

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups