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. Non-programming question about Java...

Non-programming question about Java...

Scheduled Pinned Locked Moved The Lounge
questioncsharpjavalearning
74 Posts 33 Posters 0 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 Lost User

    It depends on the point of view. When Java was introduced, it brought to production a lot of great ideas (including garbage collection). But, after 6 years of almost no evolution and the horrible handling of the Sun acquisition by Oracle, it's been left behind. The fact that there are a lot of legacy libraries not ready to use later language developments and the object-oriented dogmatism of the java community just add insult to injury. At a language (not platform) level, there is almost nothing java can do that c# cannot do, while there are plenty of things C# can do with much less code than java (think of dynamic types, lambdas and other functional programming consrtucts, implicit strong typing and all things that make for example ASP.NET MVC so wonderfull concise). In the end, most Java programs I've seen are very verbose. Some of the best professionals know when to use other languages based on the JVM (like groovy) to make coding more concise, but it's not a widespread practice. Java's slowly becoming the new COBOL.

    Sander RosselS Offline
    Sander RosselS Offline
    Sander Rossel
    wrote on last edited by
    #45

    Yikes, that sounds bad... :~

    It's an OO world.

    public class Naerling : Lazy<Person>{
    public void DoWork(){ throw new NotImplementedException(); }
    }

    1 Reply Last reply
    0
    • W wout de zeeuw

      Here's a test I just did:

          static void Main(string\[\] args) {
              int n = 10000000;
              for (int i = 0; i < 5; ++i) {
                  TestStructPerformance(n);
                  TestPrimitivePerformance(n);
              }
          }
      
          private static void TestStructPerformance(int n) {
              TestStruct s = new TestStruct();
              s.X = 1d;
              s.Y = 2d;
              s.Z = 3d;
              double x = 0d;
              DateTime start = DateTime.Now;
              for (int i = 0; i < n; ++i) {
                  x += GetX(s);
              }
              DateTime end = DateTime.Now;
              Console.WriteLine("Struct elapsed time: " + (end - start).TotalMilliseconds);
              Console.WriteLine("(" + x + ")");
          }
      
          private static void TestPrimitivePerformance(int n) {
              double x = 1d;
              double y = 2d;
              double z = 3d;
              double t = 0d;
              DateTime start = DateTime.Now;
              for (int i = 0; i < n; ++i) {
                  t += GetX(x, y, z);
              }
              DateTime end = DateTime.Now;
              Console.WriteLine("Primitive elapsed time: " + (end - start).TotalMilliseconds);
              Console.WriteLine("(" + t + ")");
          }
      
          public struct TestStruct {
              public double X, Y, Z;
          }
      
          public static double GetX(TestStruct s) {
              return s.X;
          }
      
          public static double GetX(double x, double y, double z) {
              return x;
          }
      

      Results on Intel CORE i5, x64, Win 7, .NET 4.0 (careful to run in release mode!): Struct elapsed time: 48,0061 (10000000) Primitive elapsed time: 32,5042 (10000000) Struct elapsed time: 52,5067 (10000000) Primitive elapsed time: 35,5045 (10000000) Struct elapsed time: 57,5073 (10000000) Primitive elapsed time: 32,004 (10000000) Struct elapsed time: 48,0061 (10000000) Primitive elapsed time: 32,0041 (10000000) Struct elapsed time: 44,5057 (10000000) Primitive elapsed time: 29,0037 (10000000) Our software often works with 2D, 3D and 4D vectors/points, and just passing the doubles as separate parameters would not be workable on the scale that we use it. In some performance critical bits we can do that, but the best thing if MS would fix these performance issues as it would be relatively minor effort for them to do so. EDIT: made minor screw up in the console output, just fixed that bit.

      Wout

      S Offline
      S Offline
      ScottM1
      wrote on last edited by
      #46

      I ran your code with the System.Timers.Stopwatch and I got the following on x64: Struct elapsed time: 84 (10000000) Primitive elapsed time: 66 (10000000) Struct elapsed time: 70 (10000000) Primitive elapsed time: 58 (10000000) Struct elapsed time: 69 (10000000) Primitive elapsed time: 59 (10000000) Struct elapsed time: 69 (10000000) Primitive elapsed time: 61 (10000000) Struct elapsed time: 70 (10000000) Primitive elapsed time: 58 (10000000) Interestingly, the differences are actually similar when run under x86 which is not supposed to have this problem.

      W 1 Reply Last reply
      0
      • Sander RosselS Sander Rossel

        So I've made my first aquintance with Java since I need it for my study at OU. I've heard some colleagues and friends say that Java is absolutely terrible, so I wasn't to happy about having to use Java. I started using JCreator (which looks nice, but is quite limited in features). After that I was introduced to Eclipse which looks a lot better. Of course the editor has nothing to do with the language, but it makes programming in it a lot more pleasant. So what did I think of Java? It's not bad. Missing the Properties of C# and the Namespace Imports (using), but they're stuff I can get used to. I could run it on my desktop or in my browser without much trouble. Am I missing something or is Java just not the horrible language I was told it is?

        It's an OO world.

        public class Naerling : Lazy<Person>{
        public void DoWork(){ throw new NotImplementedException(); }
        }

        B Offline
        B Offline
        Bruce Patin
        wrote on last edited by
        #47

        As a language, Java is not much different than any other OO language. My main problem with it is the way the classes have been designed to make it much harder to do things that would be more efficient to do in some other languages. The Java classes appear overtly designed for scalability and extensibility of complex structures. Most often, the work need not be so complex, but the Java classes give me no choice. The next problem is all of the pieces that must be put together in the system to get it to work. And lastly, some programs I had working in earlier releases of Java don't work anymore, and I have to go back and re-code them.

        1 Reply Last reply
        0
        • Sander RosselS Sander Rossel

          So I've made my first aquintance with Java since I need it for my study at OU. I've heard some colleagues and friends say that Java is absolutely terrible, so I wasn't to happy about having to use Java. I started using JCreator (which looks nice, but is quite limited in features). After that I was introduced to Eclipse which looks a lot better. Of course the editor has nothing to do with the language, but it makes programming in it a lot more pleasant. So what did I think of Java? It's not bad. Missing the Properties of C# and the Namespace Imports (using), but they're stuff I can get used to. I could run it on my desktop or in my browser without much trouble. Am I missing something or is Java just not the horrible language I was told it is?

          It's an OO world.

          public class Naerling : Lazy<Person>{
          public void DoWork(){ throw new NotImplementedException(); }
          }

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #48

          Naerling wrote:

          I've heard some colleagues and friends say that Java is absolutely terrible, so I wasn't to happy about having to use Java.

          Certainly if there was no context with those comments then I would dismiss them as at best ignorant and and worse it might indicate that the commenter isn't very smart.

          Naerling wrote:

          and the Namespace Imports (using),

          Huh? Java has import. And in terms of syntax I haven't seen any difference between those two.

          Naerling wrote:

          Am I missing something or is Java just not the horrible language I was told it is?

          Without a context it doesn't mean anything. Various preferences that I can note. - I like the power of C++ templates, memory management and pointers (emphasizing the power here.) - C# app domains are a poor substitute for Java's class loaders. I have yet to see any way in which they are better and quite a few ways in which they are worse. - I like C# properties. - I dislike the ease of C# Linq especially since it can lead to connection leaks (which I have seen.) - I dislike the C# exception handling versus Java. With C# one MUST capture exceptions in every thread or it will take down the application. And there is no equivalent global catch unlike Java. - I like C#/Java null reference exception, array boundary checks and various other exceptions that originate from programming bugs and which C++ merely fails. - In general I prefer the app to handle memory for me in C#/Java (even despite liking the control in C++.) - I like how fast I can put together a simple tool, especially parser/interpreters in Perl. The same thing would take longer and with more code in C#, Java and C++.

          Sander RosselS 1 Reply Last reply
          0
          • Sander RosselS Sander Rossel

            mark merrens wrote:

            Get a 5 for balance: no idea why this would be down-voted.

            Thanks. Must be my colleagues and friends who cannot approve of my point of view regarding Java ;p

            mark merrens wrote:

            It's just another tool, no more, no less. Use it if it fits the task.

            Yeah sure, although the definition of a bad language may be that it does not fit any task ;) Of course that's hardly the case with Java as it fits almost any task...

            It's an OO world.

            public class Naerling : Lazy<Person>{
            public void DoWork(){ throw new NotImplementedException(); }
            }

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #49

            Naerling wrote:

            Yeah sure, although the definition of a bad language may be that it does not fit any task

            Or no real task. http://en.wikipedia.org/wiki/Whitespace_%28programming_language%29[^]

            1 Reply Last reply
            0
            • L loctrice

              I like Java! I prefer programming in NetBeans for an IDE. Java is not horrible.

              If it moves, compile it

              C Offline
              C Offline
              chaluta04
              wrote on last edited by
              #50

              I agree and although it's taught with the first two computer science classes and data structure classes at Lamar University, VB was my first language. But I prefer Java.

              1 Reply Last reply
              0
              • S Shelby Robertson

                I don't think the language is terrible, but I think the run time is a steaming pile.

                CPallini wrote:

                You cannot argue with agile people so just take the extreme approach and shoot him. :Smile:

                J Offline
                J Offline
                jschell
                wrote on last edited by
                #51

                Shelby Robertson wrote:

                I don't think the language is terrible, but I think the run time is a steaming pile.

                Meaning what exactly? That it is buggy? That you have a problem with performance? I haven't seen the former. And the latter is meaningless in standard business programming because in the vast majority of cases language choice will have not impact on that.

                S 1 Reply Last reply
                0
                • R Roger Wright

                  There's nothing particularly horrible about Java at all. I don't like the syntax, but I never liked C/C++ either; that's just a personal preference. Part of the horror of Java, I suppose, is that for a long time people were trying to make it do everything, while its designers intended it to run smart coffee pots. Over time, things got better, expectations got more realistic, and the language (along with its libraries) got a lot better. Enjoy it... :-D

                  Will Rogers never met me.

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #52

                  Roger Wright wrote:

                  There's nothing particularly horrible about Java at all. I don't like the syntax, but I never liked C/C++ either; that's just a personal preference.

                  Versus what language? C#? The overall structure of C# is similar to C++ and Java. Versus Perl? Cobol? Fortran? Those are different from C#, C++ and Java.

                  1 Reply Last reply
                  0
                  • B BobJanova

                    It's not horrible. That's typical 'language war' overstatement. But it is just a bit worse than C# in pretty much every way (I really can't think of a single advantage now that Mono/Moonlight clears up most of the 'cross platform' thing that Java used to have over everyone else):

                    • No properties; code looks less tidy and you get 'paren fatigue' trying to read it
                    • LINQ is awesome
                    • Java's generics are a bad post-hoc hack that don't really work properly (for example you can't use T.class or have two method overloads which take different types of List)
                    • Package visibility is much less useful than internal in .Net
                    • csc directly produces a usable DLL/EXE; javac produces something you need a build tool to turn into something runnable
                    • lambdas and delegates
                    • proper events as a language feature
                    • Lots of minor things that make code nicer to read (typeof(T), is and as instead of instanceof, upper case convention etc)
                    • Much better UI libraries in the framework (AWT and Swing are notoriously awful; WinForms and WPF are both pretty good)
                    • Better thought out collections in the framework (see also Generics, above)

                    There's also the community, which isn't really the fault of the language, but Java is the source of most of the 'factory factory factory pattern' type of thinking.

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #53

                    BobJanova wrote:

                    But it is just a bit worse than C# in pretty much every way (I really can't think of a single advantage now that Mono/Moonlight clears up most of the 'cross platform' thing that Java used to have over everyone else):

                    AppDomains are absolutely miserable compared to class loaders.

                    B 1 Reply Last reply
                    0
                    • L Lost User

                      It depends on the point of view. When Java was introduced, it brought to production a lot of great ideas (including garbage collection). But, after 6 years of almost no evolution and the horrible handling of the Sun acquisition by Oracle, it's been left behind. The fact that there are a lot of legacy libraries not ready to use later language developments and the object-oriented dogmatism of the java community just add insult to injury. At a language (not platform) level, there is almost nothing java can do that c# cannot do, while there are plenty of things C# can do with much less code than java (think of dynamic types, lambdas and other functional programming consrtucts, implicit strong typing and all things that make for example ASP.NET MVC so wonderfull concise). In the end, most Java programs I've seen are very verbose. Some of the best professionals know when to use other languages based on the JVM (like groovy) to make coding more concise, but it's not a widespread practice. Java's slowly becoming the new COBOL.

                      J Offline
                      J Offline
                      jschell
                      wrote on last edited by
                      #54

                      tecgoblin wrote:

                      C# can do with much less code than java (think of dynamic types, lambdas and other functional programming consrtucts, implicit strong typing and all things that make for example ASP.NET MVC so wonderfull concise).

                      You must work in a different world than I do. Those sort of things have a very minimal place in code. Thus by themselves they certainly cannot have anything to do with "less code". Not to mention of course that "less code" has almost zero impact on the cost of developing software.

                      tecgoblin wrote:

                      Some of the best professionals know when to use other languages based on the JVM (like groovy) to make coding more concise, but it's not a widespread practice

                      Which of course completely ignores the cost of maintaining code. If you yourself maintain all the code you have every written then it isn't a problem. But if you write code for a company and decide that it is fun to wander down every single technology path that comes along then those that follow must also learn every one of those. And that costs money.

                      B 1 Reply Last reply
                      0
                      • S ScottM1

                        I ran your code with the System.Timers.Stopwatch and I got the following on x64: Struct elapsed time: 84 (10000000) Primitive elapsed time: 66 (10000000) Struct elapsed time: 70 (10000000) Primitive elapsed time: 58 (10000000) Struct elapsed time: 69 (10000000) Primitive elapsed time: 59 (10000000) Struct elapsed time: 69 (10000000) Primitive elapsed time: 61 (10000000) Struct elapsed time: 70 (10000000) Primitive elapsed time: 58 (10000000) Interestingly, the differences are actually similar when run under x86 which is not supposed to have this problem.

                        W Offline
                        W Offline
                        wout de zeeuw
                        wrote on last edited by
                        #55

                        Closer timings than on my machine, do you think it's due to the StopWatch? Can't image. The matter is definitely quite obscure, so I wouldn't dare to speculate about why it's still slower on x86.

                        Wout

                        S 1 Reply Last reply
                        0
                        • J jschell

                          BobJanova wrote:

                          But it is just a bit worse than C# in pretty much every way (I really can't think of a single advantage now that Mono/Moonlight clears up most of the 'cross platform' thing that Java used to have over everyone else):

                          AppDomains are absolutely miserable compared to class loaders.

                          B Offline
                          B Offline
                          BobJanova
                          wrote on last edited by
                          #56

                          Hm, that's probably fair point, although overstated (AppDomains aren't that bad, and I say that with some fairly significant experience of building plugin based applications in .Net).

                          1 Reply Last reply
                          0
                          • J jschell

                            tecgoblin wrote:

                            C# can do with much less code than java (think of dynamic types, lambdas and other functional programming consrtucts, implicit strong typing and all things that make for example ASP.NET MVC so wonderfull concise).

                            You must work in a different world than I do. Those sort of things have a very minimal place in code. Thus by themselves they certainly cannot have anything to do with "less code". Not to mention of course that "less code" has almost zero impact on the cost of developing software.

                            tecgoblin wrote:

                            Some of the best professionals know when to use other languages based on the JVM (like groovy) to make coding more concise, but it's not a widespread practice

                            Which of course completely ignores the cost of maintaining code. If you yourself maintain all the code you have every written then it isn't a problem. But if you write code for a company and decide that it is fun to wander down every single technology path that comes along then those that follow must also learn every one of those. And that costs money.

                            B Offline
                            B Offline
                            BobJanova
                            wrote on last edited by
                            #57

                            Lambdas and Linq queries certainly don't have 'a very minimal place in code' in any vaguely up to date .Net development. You are correct about not taking on every cool piece of technology but those language features have made it to the mainstream.

                            Not to mention of course that "less code" has almost zero impact on the cost of developing software.

                            I really disagree with that. More code means more time to maintain it, more familiarisation time when bringing new people onto the project, more difficulty in understanding the whole system and more difficulty tracking down the right place to change something when modifying a program. That's why we use high level languages and frameworks in the first place!

                            J 1 Reply Last reply
                            0
                            • J jschell

                              Shelby Robertson wrote:

                              I don't think the language is terrible, but I think the run time is a steaming pile.

                              Meaning what exactly? That it is buggy? That you have a problem with performance? I haven't seen the former. And the latter is meaningless in standard business programming because in the vast majority of cases language choice will have not impact on that.

                              S Offline
                              S Offline
                              Shelby Robertson
                              wrote on last edited by
                              #58

                              Given that my experience with it is limited to screwing around with it on my own time to see if it was worth learning, I found the runtime slow, buggy, and general pain to deal with (different runtime versions not playing well etc)

                              CPallini wrote:

                              You cannot argue with agile people so just take the extreme approach and shoot him. :Smile:

                              J 1 Reply Last reply
                              0
                              • S Shelby Robertson

                                Given that my experience with it is limited to screwing around with it on my own time to see if it was worth learning, I found the runtime slow, buggy, and general pain to deal with (different runtime versions not playing well etc)

                                CPallini wrote:

                                You cannot argue with agile people so just take the extreme approach and shoot him. :Smile:

                                J Offline
                                J Offline
                                jschell
                                wrote on last edited by
                                #59

                                Shelby Robertson wrote:

                                buggy

                                You were doing limited use with a recent Oracle VM and found a bug in the VM itself? Or a bug in the API?

                                Shelby Robertson wrote:

                                runtime slow

                                The context that you suggested does not lend itself to that conclusion. There can be some very limited problem domains where that could be relevant and perhaps you were experimenting in those domains.

                                Shelby Robertson wrote:

                                and general pain to deal with (different runtime versions not playing well etc)

                                I am not sure what that means. But different versions of the VM do not run together at all.

                                1 Reply Last reply
                                0
                                • J jschell

                                  Naerling wrote:

                                  I've heard some colleagues and friends say that Java is absolutely terrible, so I wasn't to happy about having to use Java.

                                  Certainly if there was no context with those comments then I would dismiss them as at best ignorant and and worse it might indicate that the commenter isn't very smart.

                                  Naerling wrote:

                                  and the Namespace Imports (using),

                                  Huh? Java has import. And in terms of syntax I haven't seen any difference between those two.

                                  Naerling wrote:

                                  Am I missing something or is Java just not the horrible language I was told it is?

                                  Without a context it doesn't mean anything. Various preferences that I can note. - I like the power of C++ templates, memory management and pointers (emphasizing the power here.) - C# app domains are a poor substitute for Java's class loaders. I have yet to see any way in which they are better and quite a few ways in which they are worse. - I like C# properties. - I dislike the ease of C# Linq especially since it can lead to connection leaks (which I have seen.) - I dislike the C# exception handling versus Java. With C# one MUST capture exceptions in every thread or it will take down the application. And there is no equivalent global catch unlike Java. - I like C#/Java null reference exception, array boundary checks and various other exceptions that originate from programming bugs and which C++ merely fails. - In general I prefer the app to handle memory for me in C#/Java (even despite liking the control in C++.) - I like how fast I can put together a simple tool, especially parser/interpreters in Perl. The same thing would take longer and with more code in C#, Java and C++.

                                  Sander RosselS Offline
                                  Sander RosselS Offline
                                  Sander Rossel
                                  wrote on last edited by
                                  #60

                                  jschell wrote:

                                  Huh?
                                   
                                  Java has import. And in terms of syntax I haven't seen any difference between those two.

                                  As far as I understood the difference would be the following: C#:

                                  // Only one using statement for the entire namespace.
                                  using System.Collections.Generic;

                                  public class SomeClass
                                  {
                                  List<String> someList;
                                  Dictionary<String, String> someDict;
                                  IEnumerable<Object> ienum;
                                  }

                                  And now C#, but using the 'Java mindset'.

                                  // Every class needs another using statement.
                                  using System.Collections.Generic.List<T>;
                                  using System.Collections.Generic.Dictionary<TKey, TValue>;
                                  using System.Collections.Generic.IEnumerable<T>;

                                  public class SomeClass
                                  {
                                  List<String> someList;
                                  Dictionary<String, String> someDict;
                                  IEnumerable<Object> ienum;
                                  }

                                  It tends to make the list of using statements quite long :)

                                  jschell wrote:

                                  Various preferences that I can note. etc...

                                  Nice! I'm not very familiar with C++ (but I do want to learn it someday). I don't know Perl at all (just by name). Is it worth the trouble to learn?

                                  It's an OO world.

                                  public class Naerling : Lazy<Person>{
                                  public void DoWork(){ throw new NotImplementedException(); }
                                  }

                                  J 2 Replies Last reply
                                  0
                                  • B BobJanova

                                    Lambdas and Linq queries certainly don't have 'a very minimal place in code' in any vaguely up to date .Net development. You are correct about not taking on every cool piece of technology but those language features have made it to the mainstream.

                                    Not to mention of course that "less code" has almost zero impact on the cost of developing software.

                                    I really disagree with that. More code means more time to maintain it, more familiarisation time when bringing new people onto the project, more difficulty in understanding the whole system and more difficulty tracking down the right place to change something when modifying a program. That's why we use high level languages and frameworks in the first place!

                                    J Offline
                                    J Offline
                                    jschell
                                    wrote on last edited by
                                    #61

                                    BobJanova wrote:

                                    Lambdas and Linq queries certainly don't have 'a very minimal place in code' in any vaguely up to date .Net development.

                                    So in your significant business applications what percentage of the entire code base do those idioms represent? And what percentage do they represent if boiler plate database API code is not included (since of course with code generation and/or frameworks all of that can be removed as a maintenance item)?

                                    BobJanova wrote:

                                    More code means more time to maintain it

                                    Nope. If your code base is 1000% bigger than mine and our products do the same thing then I would in fact expect that your maintenance cost is higher than mine. However there is no way that language syntax is going to produce that differential. However poor programming can and does. On the other hand a differential of 1% or less is not going to have any measurable impact on maintenance. And would be lost in the noise.

                                    BobJanova wrote:

                                    more familiarisation time when bringing new people onto the project, more difficulty in understanding the whole system and more difficulty tracking down the right place to change something when modifying a program.

                                    All of those same things happen when there is a muddled design, muddle requirements/business needs, code grown re-actively (rather than planned), mixed language usage (even when justified), no process control, etc, etc, etc. And since it is more likely that any or all of those things will occur in the average shop it is going to be flat out impossible to measure the impact that any single language feature would have on actual maintenance costs.

                                    1 Reply Last reply
                                    0
                                    • Sander RosselS Sander Rossel

                                      jschell wrote:

                                      Huh?
                                       
                                      Java has import. And in terms of syntax I haven't seen any difference between those two.

                                      As far as I understood the difference would be the following: C#:

                                      // Only one using statement for the entire namespace.
                                      using System.Collections.Generic;

                                      public class SomeClass
                                      {
                                      List<String> someList;
                                      Dictionary<String, String> someDict;
                                      IEnumerable<Object> ienum;
                                      }

                                      And now C#, but using the 'Java mindset'.

                                      // Every class needs another using statement.
                                      using System.Collections.Generic.List<T>;
                                      using System.Collections.Generic.Dictionary<TKey, TValue>;
                                      using System.Collections.Generic.IEnumerable<T>;

                                      public class SomeClass
                                      {
                                      List<String> someList;
                                      Dictionary<String, String> someDict;
                                      IEnumerable<Object> ienum;
                                      }

                                      It tends to make the list of using statements quite long :)

                                      jschell wrote:

                                      Various preferences that I can note. etc...

                                      Nice! I'm not very familiar with C++ (but I do want to learn it someday). I don't know Perl at all (just by name). Is it worth the trouble to learn?

                                      It's an OO world.

                                      public class Naerling : Lazy<Person>{
                                      public void DoWork(){ throw new NotImplementedException(); }
                                      }

                                      J Offline
                                      J Offline
                                      jschell
                                      wrote on last edited by
                                      #62

                                      Naerling wrote:

                                      And now C#, but using the 'Java mindset'.

                                      No. Actual pseudo syntax would be as follows. using System.Collections.Generic.*; // Asterisk. And C# is basically the same way since you can explicitly name classes via using with the following. using MyClass = MyPackage.MyClass;

                                      Sander RosselS 1 Reply Last reply
                                      0
                                      • Sander RosselS Sander Rossel

                                        jschell wrote:

                                        Huh?
                                         
                                        Java has import. And in terms of syntax I haven't seen any difference between those two.

                                        As far as I understood the difference would be the following: C#:

                                        // Only one using statement for the entire namespace.
                                        using System.Collections.Generic;

                                        public class SomeClass
                                        {
                                        List<String> someList;
                                        Dictionary<String, String> someDict;
                                        IEnumerable<Object> ienum;
                                        }

                                        And now C#, but using the 'Java mindset'.

                                        // Every class needs another using statement.
                                        using System.Collections.Generic.List<T>;
                                        using System.Collections.Generic.Dictionary<TKey, TValue>;
                                        using System.Collections.Generic.IEnumerable<T>;

                                        public class SomeClass
                                        {
                                        List<String> someList;
                                        Dictionary<String, String> someDict;
                                        IEnumerable<Object> ienum;
                                        }

                                        It tends to make the list of using statements quite long :)

                                        jschell wrote:

                                        Various preferences that I can note. etc...

                                        Nice! I'm not very familiar with C++ (but I do want to learn it someday). I don't know Perl at all (just by name). Is it worth the trouble to learn?

                                        It's an OO world.

                                        public class Naerling : Lazy<Person>{
                                        public void DoWork(){ throw new NotImplementedException(); }
                                        }

                                        J Offline
                                        J Offline
                                        jschell
                                        wrote on last edited by
                                        #63

                                        Naerling wrote:

                                        I don't know Perl at all (just by name). Is it worth the trouble to learn?

                                        I do a lot of code generation. Ideally I would prefer to use the language of the shop (C#, Java, C++) to do code generation but it requires writing so much more code that it just is not worth it.

                                        1 Reply Last reply
                                        0
                                        • J jschell

                                          Naerling wrote:

                                          And now C#, but using the 'Java mindset'.

                                          No. Actual pseudo syntax would be as follows. using System.Collections.Generic.*; // Asterisk. And C# is basically the same way since you can explicitly name classes via using with the following. using MyClass = MyPackage.MyClass;

                                          Sander RosselS Offline
                                          Sander RosselS Offline
                                          Sander Rossel
                                          wrote on last edited by
                                          #64

                                          Ahhh... Didn't know the * was also valid syntax. I guess those introductions don't tell you everything :)

                                          It's an OO world.

                                          public class Naerling : Lazy<Person>{
                                          public void DoWork(){ throw new NotImplementedException(); }
                                          }

                                          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