Slashdot Mirror


The Reason For Java's Staying Power: It's Easy To Read

jfruh writes: Java made its public debut twenty years ago today, and despite a sometimes bumpy history that features its parent company being absorbed by Oracle, it's still widely used. Mark Reinhold, chief architect for the Oracle's Java platform group, offers one explanation for its continuing popularity: it's easy for humans to understand it at a glance. "It is pretty easy to read Java code and figure out what it means. There aren't a lot of obscure gotchas in the language ... Most of the cost of maintaining any body of code over time is in maintenance, not in initial creation."

414 comments

  1. Yes & the sheer amount of existing code/framew by Anonymous Coward · · Score: 5, Insightful

    Solving problems can be done quite quickly with Java as a lot of the frameworks/tooling for solving common problems have already been built. Including:

    - Distributed Configuration
    - MapReduce
    - Spark
    - Large portion of the NS math libraries have been ported (think of all the Fortran libraries)
    - Networking
    - Embedded devices
    - First-class support for many app hosts
    - Concurrency libraries (including standard)
    - World-class web application serving (Jersey, DropWizard, etc.)

    These are things that are proven and enterprise ready with large communities supporting them.

  2. "Easy to read" is non-sense by Anonymous Coward · · Score: 4, Insightful

    I am tired of hearing languages are "easy to read". If a piece of code is well written and identifiers are well named anyone who is accustomed to the syntax or syntax that is SIMILAR will be able to read it. The point is that C style syntax have been what the majority of programmers have been used to so it has become a staple. However, if it was down to pure logic and an understanding of the English language Ada, Pascal, and (Visual) Basic would be the most readable.. and who here thinks that -- we've all been brainwashed by CS101.

    1. Re:"Easy to read" is non-sense by jfdavis668 · · Score: 4, Insightful

      His point is that it doesn't contain strange syntax that isn't easy to follow at first glance. One of the original purposes of Java was to eliminate the complexity of C++ has from its C legacy. When you use a command in Java, it does what its supposed to do. They are not using it as some obscure purpose to take advantage of some quirk in the hardware. Java did this by defining its own hardware of sorts, the JVM. It moves the complexity of the actual system to a group of programmers who specialize in that arena, the JVM developers. It's not that all Java is readable, we maintain one system we inherited that was developed by a poorly trained group of developers. The names of classes provide no help in understanding the code. One of the main classes is "M". They also put things together in classes that have nothing to do with each other. We are re-developing that system from scratch to fix it. Even with this, there are no commands in the system that we don't understand when we read them.

    2. Re:"Easy to read" is non-sense by jareth-0205 · · Score: 4, Insightful

      I am tired of hearing languages are "easy to read". If a piece of code is well written and identifiers are well named anyone who is accustomed to the syntax or syntax that is SIMILAR will be able to read it. The point is that C style syntax have been what the majority of programmers have been used to so it has become a staple. However, if it was down to pure logic and an understanding of the English language Ada, Pascal, and (Visual) Basic would be the most readable.. and who here thinks that -- we've all been brainwashed by CS101.

      Clearly a language can be easy or hard to read - Or do you think well-written Brainfuck is easy to read? Since programs are written by actual flawed humans who make stupid mistakes or have weird style preferences sometimes, it's generally a good idea to have a language syntax that doesn't let them shoot themselves in the foot.

    3. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0, Interesting

      Easy to read? The author must have never seen code in the wild, especially from asia.

      Java is a general purpose language that can do anything.... badly.

    4. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      main classes is "M".

      I've seen this too! "Q" for queue, "PQ" for priority queue, "L" for list, etc.,

    5. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      Easy to read, eh?
      ++++++++[>++++[>++>+++>+++>++>+>->>+[>.>---.+++++++..+++.>>.>+.>++.

    6. Re:"Easy to read" is non-sense by jfdavis668 · · Score: 3, Interesting

      That would make sense, but the system I am referring to doesn't. There is a "Q" class, but it is not a queue. I don't think the people who wrote this know what a queue is. Took us a while to figure out that "rlogic" was the actions initiated from the right side of the screen. Doesn't tell us what they do, but it made some sense. The amazing thing is the system works, even if we don't know what the parts do. The naming standards look more like algebra than Java. We think the whole system must be trying to solve for "x".

    7. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      Also, easy can be determined by time to understand. For example, C# has lately added features that take longer for a person to understand what's going on in a complete way. Two that pop out of my head are:

      1. The use of var (the datatype previously known as variant)
      2. Lambda expressions

      These aren't unreadable, especially to someone who chooses to use them for brevity, but they take longer the re-read a few weeks or months down the line.

      int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };
      var wtf = numbers.Count(n => n % 2 == 1);

    8. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0, Insightful

      Don't know about Ada or Pascal, but VisualBasic is not easy to read. It's a mish-mash of different syntaxes ranging from GWBASIC to Smalltalk to C/C++ - depending on which was hot at the time, or should I say MyGWBasic to MySmalltalk to MyC/C++. A poor programmer can make any language difficult to read without really trying.

    9. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      Java code was fairly easy to read in the early versions of the language (this is true of a lot of programming languages, tools and APIs).

      Then Tiger came along.

    10. Re:"Easy to read" is non-sense by Hognoxious · · Score: 1

      Is there one called DTN?

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    11. Re:"Easy to read" is non-sense by funkymonkjay · · Score: 1

      I am wondering if that code was decompiled. Actually, I am pretty sure class names are kept intact in the byte code. Not so much for internal variable names. If it was done on purpose, maybe there's a speed benefit when searching for a class. Or it was as you said it was coded by a math nut who is incapable of naming things with more than 2 letters.

    12. Re:"Easy to read" is non-sense by DuckDodgers · · Score: 3

      Java doesn't have obscure syntax - part of that is the language itself, part of that is the fact that it explicitly doesn't support operator overloading and that prevents people from making incomprehensible DSLs ( Scala's SBT, anyone? )

      On the other hand, in terms of "readable" I still think calling Java readable assumes a familiarity with C style syntax. I think if you took someone that never read or wrote code before and showed them 100 line, idiomatic programs in Java, Javascript, Python, Ruby, PHP, Perl, Lisp, Haskell, C, Fortran, COBOL, Basic, and a few other languages that Java would not top the list for readability. My guess is that the winners would be Basic, COBOL, and Python.

      One of the biggest reasons C++ became popular was that it was a relatively small step away, in terms of syntax, from C. I really think Java became popular mostly because the syntax is a small step away from C++.

    13. Re:"Easy to read" is non-sense by Giant+Electronic+Bra · · Score: 1

      You really cannot refactor something like this with a modern IDE and change the class names to something sensible? Ugh.

      I totally agree with you about Java though, its quite readable. I have a LARGE code base and I can hand pieces of it to people and they can grasp what it does. I won't pretend its a model of perfect design, like any large old code base it has plenty of stupid in it, but the classes make sense, the overall organization and design is pretty good, and even if some of the APIs and such aren't exactly what I would do today and certain practices are sub-standard on the whole it works well, survives refactoring without too much pain, and does what it is supposed to do. It will almost surely be in production for decades hence.

      --
      "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson
    14. Re:"Easy to read" is non-sense by Giant+Electronic+Bra · · Score: 4, Insightful

      Right, but I would argue it extends far past easy to read. Java is easy to grasp. It is very clear which method will be invoked when you make a method call. It is very clear what the lifecycle of a memory allocation is and there's no question about who is responsible for managing that chunk of memory, etc. Its just VASTLY easy to code in Java. Now, the development tools/environment may not be as simple as scripting languages, which tends to push untrained 'do-it-yourselfers' into things like PHP where they can see some results on day one, but for the organization which has real business needs and develops code to meet them, Java is an excellent choice because in all respects its clear what things do and how they work. I can look at virtually any piece of decently-written Java code and understand it. At the very least I won't find out that it does something totally different than it appears, which is COMMON in C++.

      --
      "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson
    15. Re:"Easy to read" is non-sense by darkwing_bmf · · Score: 1

      I think Ada and Pascal are the most easily readable.

    16. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 1, Insightful

      Mod parent up, code readability is a trait of the programmer, not the language.
      the reason Java stays is, imo, because it was every educator and manager's wet dream. Yet I still have to find a single coder that knows more than 5 languages who prefers writing Java over anything else.

      Personally, I'd rather have my nutsack removed without anesthetic than write java

    17. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      BASIC was easy to read too

    18. Re:"Easy to read" is non-sense by oh_my_080980980 · · Score: 1

      Lot of "ifs" in that statement of yours. But your fundamental assumption is flawed, it is not easy to read code period. It's easy if you developed it and it's easy if you routinely code in that language but when you are not the developer and you don't routinely use that language, then it becomes difficult. Not too mention programmers suck at documenting their code. The point of high level languages is that they would be readable like the english language. Java is pretty close to that.

    19. Re:"Easy to read" is non-sense by oh_my_080980980 · · Score: 0

      Have you seen .NET......

    20. Re:"Easy to read" is non-sense by fulldecent · · Score: 4, Funny

      Yes, and if you gave someone who never read or wrote code before and gave them a printed sheet of Perl... they might wonder if the sheet is upright or upside down.

      --

      -- I was raised on the command line, bitch

    21. Re:"Easy to read" is non-sense by Megol · · Score: 2

      Are you joking? Ada is easy to understand because it was designed to be. It is verbose and partially redundant by design as that is known to 1) increase understanding of programs 2) decreases some types of common errors.
      Pascal wasn't really designed for ease of use (even though it is), one big problem is the use of semicolon as a separator: it isn't always obvious where they should go and misplaced semicolons can generate errors.

    22. Re:"Easy to read" is non-sense by Capt.Albatross · · Score: 4, Insightful

      If a piece of code is well written...

      This is not an article about what is possible, it is about what actually happens. I have seen incredible abuses of operator overloading, for example. I have also seen some highly confused Java, but its pedestrian syntax seems to make it a little harder to write cryptic bad code in.

    23. Re:"Easy to read" is non-sense by peppepz · · Score: 1

      No, it wasn't... in the old times it allowed you to skip whitespace in order to save memory, so programs used to become wall of characters, and you couldn't even call a variable "sprint" because it contained the reserved word "print". And its later incarnations were full of puzzlers. Just the first ones that come into my mind: "On Error Goto 0" means "throw an exception"; functions and procedures have a different invocation syntax and invoking a procedure as a function doesn't fail but results in a different operation; the assignment operator is different between objects and non-objects; function parameters are passed by reference by default...

    24. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      Yeah, that's easy to read. Data pointer always moves forward, never back, it has a few unclosed loops, and it's output is all outside the 32-127 band of the AscII table.

    25. Re:"Easy to read" is non-sense by __aaclcg7560 · · Score: 1

      When I took "Introduction to Java" in college, two students got into trouble for having submitting identical code with one slight variation. The variable used by the first student was "x" and the variable used by the second student was "y". Being cute doesn't get you a passing grade.

    26. Re:"Easy to read" is non-sense by LWATCDR · · Score: 4, Interesting

      I disagree that it is because java is easy to read. Java is easy to write. A good programer can write an app in Java and have it work really well. A bad programer can write an app in java it will work.
      With C++ a good programer can write an app and it will work but you really have to watch for a lot of gotchas. A bad programer can not write a program that works in C++ because it will leak memory, stomp on memory, and have issues with pointers.
      Java is better at stopping the little brain farts from blowing up in your face.
      C++ is a lot more fun to write in IMHO.

      --
      See my blog http://ilovecookes.blogspot.com/ for light hearted technical information.
    27. Re:"Easy to read" is non-sense by budgenator · · Score: 1

      Perl definitely is hard to read as normally practised, but you can write very legible Perl with little added effort. If you avoid regular expressions and use English.pm and can't read the code, you'd probably have trouble reading even COBOL.

      --
      Apocalypse Cancelled, Sorry, No Ticket Refunds
    28. Re:"Easy to read" is non-sense by __aaclcg7560 · · Score: 1

      When I went back to school to learn computer programming after the Dot Com bust, the community college couldn't afford to renew the Microsoft site license for a few years. All the required courses was taught in every flavor of Java. The dean taught some C/C++ programming in his Linux administration courses. After the site license got renewed, we had Visual Studio to learn C/C++ proper (as in a job skill). I haven't touched Java since I graduated from college. These days I use Python at home and PowerShell at work.

    29. Re:"Easy to read" is non-sense by wonkavader · · Score: 3, Informative

      I'd put it differently: When you keep legibility and understandability in mind as a goal when writing in perl, the many syntax constructs available in it which are not in Java (for example) allow you to write much more understandable code in perl than you could in most other languages.

      The fact that it also allows you to write stuff non-perl people cannot fathom is a problem, and any coding projects started in perl need a day-two code review and some conversations with the people involved. They need to know they're coding for the next user of the software more than they're coding for themselves. If they have trouble with that, then they're too young to be trusted with your business.

    30. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 1, Insightful

      "When you use a command in Java, it does what its supposed to do."

      Does it? Because I don't think it does.

      Foo bar1;
      Foo bar2;

      bar1 = bar2;

      int bar1;
      int bar2;

      bar1 = bar2;

      One of these is a copy assignment, the other one is not.
      No way to tell by the syntax.

      foo(bar); where bar is an int vs foo(bar); where bar is an object - pass by reference, and again no way to tell by the syntax.

      The _exact_ same syntax, often means two completely different behaviors.

      In c++, if you want a pointer or a reference you have to explicitly say so.

      When I make a function taking a Bar&, I want a reference to some damn Bar.
      I'm explicitly telling you I do not wish for you to give me a null pointer.
      No 30 lines of boilerplate null checking required.

      In the same way, if i'm calling a Foo( Bar bar ), I do not expect for the function to change the state of my bar.
      In java, there is no way to be sure of this.

      In Java you have to be constantly on the lookout for someone to screw your objects up in a way you did not anticipate.

      I don't call that "doing what it's supposed to do". /end of rant

    31. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      The problem is that in the real world as the lifespan of a project increases the probability that some developer at some point said "fuck readability I have a deadline to meet" approaches unity.

      As such language legibility has to be evaluated at their worst case not their best case. As the code base of a project will degrade towards the worst case over time.

    32. Re:"Easy to read" is non-sense by RockGrumbler · · Score: 1

      I do not think english is particularly good at unambiguously specifying the steps necessary for algorithms. I do not think that making computing languages resemble english is intrinsically good.

    33. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      I quickly glanced at it an understood immediately that it counts the number of odd numbers in the array. Well, if you consider "0" to be odd.

    34. Re:"Easy to read" is non-sense by anarkhos · · Score: 1, Flamebait

      It's not nonsense, it's bullshit.

      Not only is Java NOT easy to read, it clearly has nothing to do with its popularity.

      The reason it's popular is for the same reason smalltalk was not: vendor support. Java was free with multi-platform compilers and corporate support. It was pushed heavily in universities which is how this foul language spread. There is nothing inherent about Java which made it popular.

      You could say the same thing about UNIX.

      --
      >80 column hard wrapped e-mail is not a sign of intelligent
      >life
    35. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      Smalltalk is an easy-to-read programming language and a heck of a better language than Java by a country mile. As for Java, James Gosling should be exported to Iraq and handed over to ISIS.

    36. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      Java is not easy to read because it uses C syntax to some degree, and C syntax, along with it derivative languages, is very hard to read. I have found the easiest language to read is Ada. It clearly marks if statements and loop statements with end if and end loop statements. This makes it easier to read than Python and just any other language.

      Any language can me made easier to read or harder to read with depending on naming conventions, indentation, etc, and of course good code or bad code can be written in any language.

    37. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0
      To quote a different annon

      Easy to read, eh?
      ++++++++[>++++[>++>+++>+++>++>+>->>+[>.>---.+++++++..+++.>>.>+.>++.

    38. Re:"Easy to read" is non-sense by ttucker · · Score: 1

      int things[10];

      things[11] = 47;

      What is that supposed to do?

    39. Re:"Easy to read" is non-sense by rnturn · · Score: 1

      ``...they might wonder if the sheet is upright or upside down.''

      Um... surely you're thinking of APL.

      --
      CUR ALLOC 20195.....5804M
    40. Re:"Easy to read" is non-sense by 0bject · · Score: 1

      Identify code as being programmed by a moron.

    41. Re:"Easy to read" is non-sense by DMUTPeregrine · · Score: 1

      Well, even when you can refactor it you have to figure out what the classes do before you can give them sensible names.

      --
      Not a sentence!
    42. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 1

      It's not nonsense, it's bullshit.

      Not only is Java NOT easy to read, it clearly has nothing to do with its popularity.

      The reason it's popular is for the same reason smalltalk was not: vendor support. Java was free with multi-platform compilers and corporate support. It was pushed heavily in universities which is how this foul language spread. There is nothing inherent about Java which made it popular.

      You could say the same thing about UNIX.

      Boy are you a victim of mis-moderation. People are modding you down because they don't like the way you said something that others have said above and been modded 5, Insightful. What a crock! Sorry, I tried to mod you up from a 3, but when I finished the cooks had modded you to -1 Flamebait. I wish someone that disagreed would put some effort into explaining why, because I think you're spot on with the reason why Java got popular. It was heavily lobbied for by Sun, not only in industry/corporate circles but in academia where it took off because of its gradual on-ramp to use (like a lot of scripting languages). It was easy to teach to people that had minimal experience with languages that came before it (BASIC, Pascal, C/C++ and Fortran) and its syntax and grammar made it more difficult to botch things up. Plus, it hand a sandbox in the JVM (that was actually riddled with holes and vulnerabilities early on) that provided JIT compilation so you could run apps quickly to test functios as you went along and debugged them. There were some features that made it compelling for corporate and academic use, but human readability of the source code wasn't one of them.

    43. Re:"Easy to read" is non-sense by AuMatar · · Score: 2

      Don't worry- Java people are learning how to make up for that by creating whole incomprehensible sublanguages based on annotation processing that make C macros look good.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    44. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      COBOL rules dude.

    45. Re:"Easy to read" is non-sense by plopez · · Score: 1

      I was once complimented on the clarity or my Perl code. I posted some and got several stero-typical responses fo 'well it could be written better as....'. Then someone piped in and said something like, "screw it, It's clean and easy to read. There's nothing wrong with it". And that is what my experience as a maitnence programmer taught me. If no one can read it to maintain it, it is crappy code.

      --
      putting the 'B' in LGBTQ+
    46. Re:"Easy to read" is non-sense by ttucker · · Score: 2

      It is supposed to fail, but instead does something terrible. I guess the whole C++ is more sensible than Java thing is called into question by counterexample.

    47. Re:"Easy to read" is non-sense by orlanz · · Score: 1

      Doesn't the end if and end loop become the same crap but more verbose once you have nested ifs and loops?

    48. Re:"Easy to read" is non-sense by malacandrian · · Score: 1

      I agree that var is bad, and that if you use it you are a bad person; but used well lambda expressions can greatly enhance readability - particularly when used with LINQ queries. Consider the following two tests (code written from memory, it's been a long time since I've done this, there's probably mistakes)

      Assert.IsTrue(list.Any(item => item == value));

      against

      bool matches = false;
      foreach(Type item in list) { if(item == vale) { matches = true; }}
      Assert.IsTrue(matches);

      The first one is obviously a lot shorter, but its real advantage is that it actually looks like what it does with no need to parse loops or introducing tracking variables.

    49. Re:"Easy to read" is non-sense by Cro+Magnon · · Score: 1

      COBOL is a very readable language. That didn't stop people from writing code that could rival the worst Perl code as far as understanding it went.

      I agree that writing Java is not much fun.

      --
      Slow down, cowboy! It has been 4 hours since you last posted. You must wait another few hours.
    50. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      >At the very least I won't find out that it does something totally different than it appears, which is COMMON in C++.

      That's a gross misrepresentation. C++ code that abuses overloading and general magic to do something unexpected is obviously horrible code, but it's not anywhere near commonplace. Or maybe you didn't pick up on what most people expect and are confused by the norm, but coming from C it is overwhelmingly to me.

    51. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      If you design your language with the assumptions that your users are stupid and need to be handled as such, you end up with PHP or JS.

    52. Re:"Easy to read" is non-sense by styrotech · · Score: 1

      Also as a non Java coder who used to be able to mostly read Java, I found Generics have put a stop to that.

      Java might've been kinda sorta easy to read a decade ago, but it isn't now.

    53. Re: "Easy to read" is non-sense by Anonymous Coward · · Score: 0

      "var" has nothing to do with variants (or dynamic), it's just syntactic sugar that lets the compiler deduce the type for you. The object has the same type regardless. In a well-factored codebase, the type should be obvious to the reader anyway, no need to spell it out again.

    54. Re: "Easy to read" is non-sense by Anonymous Coward · · Score: 0

      Both are assignments. It's just that you have no idea what the fuck you are talking about and don't understand assignment of references.

      Java does a good job of hiding the idea of pointers/references... except when it doesn't.

    55. Re:"Easy to read" is non-sense by vilanye · · Score: 1

      foo(bar); where bar is an int vs foo(bar); where bar is an object - pass by reference, and again no way to tell by the syntax.

      Java is always pass-by-value. ALWAYS

      What gets mistaken for pass-by-reference behaviour is really just a mutable object getting changed in a method call.

      Primitive or object, Java is always pass by value.


      swap(Type arg1, Type arg2) {
              Type temp = arg1;
              arg1 = arg2;
              arg2 = temp;
      }

      Type var1 = ...;
      Type var2 = ...;
      swap(var1,var2);

      Those semantics fail in Java, because Java is always pass by value

      In the same way, if i'm calling a Foo( Bar bar ), I do not expect for the function to change the state of my bar.
      In Java, there is no way to be sure of this.

      Sure there is, if an object passed is mutable, the state of the object might be changed. That's it. Check the method docs to see if it does change it. If the object is immutable, it obviously won't change.

      It is not that complicated.

      Some day, Java might even be acceptable. It finally got a real lambda, too bad Swing is dead or it would really benefit from not having all those inner-classes making a mockery of proper programming.

    56. Re:"Easy to read" is non-sense by anonymous_wombat · · Score: 1

      I really think Java became popular mostly because the syntax is a small step away from C++.

      It's simpler, and more portable than C++. Also, it interacts seamlessly with other JVM languages.

    57. Re:"Easy to read" is non-sense by shutdown+-p+now · · Score: 2

      part of that is the fact that it explicitly doesn't support operator overloading

      I would argue that this creates as many problems as it solves. E.g. when working with BigInteger or BigDecimal, a.multiply(b) is less readable than a*b.

    58. Re:"Easy to read" is non-sense by DuckDodgers · · Score: 1

      Excellent point. Perl is a fantastic language. But like C++ and Scala, the problem isn't in the well-written code. The problem is that it's too easy for someone to write unintelligible crap with abuse of syntax corner cases, macros (for C++ and Scala) and operator overloading.

    59. Re:"Easy to read" is non-sense by DuckDodgers · · Score: 1

      The non-overloaded code has a readability problem, I agree. But for example the Scala Built Tool, SBT, has operator overloading abused to hell and it makes complex build files useless to read for all but really experienced SBT users. The XML-driven Java build tool Maven, the Groovy-driven Java/Groovy build tool Gradle, and the Clojure-driven Java/Clojure build tool Leiningen are all much easier to read. Though to be fair, Groovy supports operator overloading, the Gradle team just chose not to abuse the feature for build management.

      Look at some SBT examples, for example https://github.com/playframewo... In that file we have %, +=, :=, , none in a mathematical context, all on top of normal Scala operator syntax =, ==, =>, _, etc... I'm surprised I didn't see ")*&%()*$&%&&*XR&R^NO CARRIER" at the end of the file.

    60. Re:"Easy to read" is non-sense by DuckDodgers · · Score: 1

      Dammit, Slashdot nixed half the funky characters I put in my message because they used a less than sign.

    61. Re:"Easy to read" is non-sense by shutdown+-p+now · · Score: 1

      Scala's problem, I think, is not that it has operator overloading, but that the conventions around the language encourage its use for DSLs. C++ also has this problem, but to a significantly smaller degree, and C# doesn't have it at all.

    62. Re:"Easy to read" is non-sense by Anonymous Coward · · Score: 0

      if you avoid regex, what's the point

    63. Re:"Easy to read" is non-sense by DuckDodgers · · Score: 1

      But contrast that with Lisp or one of the Lisp dialects like Clojure - you can use macros to make a DSL, but no matter how you slice it the code is bone simple to read if you know regular Lisp syntax.

    64. Re:"Easy to read" is non-sense by shutdown+-p+now · · Score: 1

      I disagree. "Lisp syntax" is almost a misnomer, as there's so little of it. Pretty much the only thing you're guaranteed is that () are for grouping, and spaces are separators (and even that is not necessarily true in CL). Everything beyond that is up to the DSL in question, and people can and do get overly "creative" with the syntax such that it's not simple or obvious to read at all.

    65. Re:"Easy to read" is non-sense by DuckDodgers · · Score: 1

      The fact that Lisp syntax is so simple is a strength of the syntax, not an absence. Instead of spending days to grasp all of the syntactic quirks of a language, you can grasp the whole thing in just a few hours.

      The parenthesis inherently give you grouping, so there are no operator precedence rules to grapple with. And often you don't need a fancy DSL for a syntactic map to your data structure, you can use Lisp data structures as-is.

    66. Re:"Easy to read" is non-sense by squiggleslash · · Score: 1

      If you avoid regular expressions and use English.pm

      True. Similarly French is very easy to understand if only words that are common to English and French are used, and if the speaker speaks them with an English accent...

      --
      You are not alone. This is not normal. None of this is normal.
    67. Re:"Easy to read" is non-sense by shutdown+-p+now · · Score: 1

      In my experience with Lisp, its absence of syntax is only beneficial for macros, but both writing it and reading it is a pain (comparatively to other languages with more rich syntax). People claim that this is subjective and you get used to it, but I find it hard to believe that human brain can't do better with more and easier to grasp clues when parsing things. Someone should make a study on how easy it is to parse Lisp vs, say, Scala.

      In any case, we have deviated from the original point, which is the readability of custom DSLs. I don't see anything special about Lisp that makes them any easier to understand.

  3. Not as easy to read as Python though by mann17 · · Score: 5, Funny

    Not as easy to read as Python though

    1. Re:Not as easy to read as Python though by Christian+Smith · · Score: 1, Informative

      Not as easy to read as Python though

      Properly, consistently indented Java is. It's just that python has to be correctly indented to work, which is great, BTW!

    2. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0, Insightful

      ROFL

    3. Re:Not as easy to read as Python though by gatkinso · · Score: 4, Funny

      Two words: tabs, spaces.

      --
      I am very small, utmostly microscopic.
    4. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0

      They both have their pros and cons, I guess, but when it takes me scrolling through 100 pages through 5 different files of Java to read a program that would have fit in 100 lines of Python, I don't really consider that "easy to read" no matter how many languages it is annotated with for clarity (English/Pseudocode/Math/Lisp/Swahili)

    5. Re:Not as easy to read as Python though by AchilleTalon · · Score: 1

      BTW, in case you haven't noticed, Python syntax is similar to Fortran syntax which is among the oldest, if not the oldest programming language still alive.

      --
      Achille Talon
      Hop!
    6. Re:Not as easy to read as Python though by engun · · Score: 3, Insightful

      Exactly. Having used Java in an enterprise setting for many years, and having had the good fortune to move to Python, I couldn't be happier. I realised how much more verbose Java was than its Python equivalent. Even if you overlook that - there's an inherent structural complexity that Java engenders to its code - one only need look at the Python equivalent to see why. For example, take a look at a basic Hadoop WordCount example here: http://wiki.apache.org/hadoop/... Now compare a rough Python equivalent here: http://mrjob.readthedocs.org/e...

      It's not just stuff like the lack of lambdas (it looks like Java 8 has fixed this), or the static typing that contributes to this complexity. I suspect that the culture that has sprung up around Java favours over-architecting and over-engineering, which is exacerbated by its statically typed nature. The Java language itself is simple enough.

      In contrast, there is a cult of simplicity around Python, and the language itself has a high-level of expressivity, allowing for a clearer exposition of one's intent - instead of burying it in layer upon layer of abstraction built to please the language and its type system. C# is a language that fares much better than Java in this regard - it's a lot cleaner. For starters - no type erasure!

    7. Re:Not as easy to read as Python though by TeknoHog · · Score: 2, Interesting

      BTW, in case you haven't noticed, Python syntax is similar to Fortran syntax which is among the oldest, if not the oldest programming language still alive.

      This. I think Fortran (and now Julia) strikes the best balance, because it doesn't have the tab/space issue that may produce problems, especially when sharing code. Like Python, it lacks the ugly {} ; punctuations, but it needs something to denote the end of a block, so it uses the English word "end" to keep things simple and clean.

      --
      Escher was the first MC and Giger invented the HR department.
    8. Re:Not as easy to read as Python though by jellomizer · · Score: 1

      Except when you are trying to debug code where the indents are mixed with Spaces and Tabs.

      --
      If something is so important that you feel the need to post it on the internet... It probably isn't that important.
    9. Re:Not as easy to read as Python though by Marginal+Coward · · Score: 4, Insightful

      I agree: that seems to be the thing that Python does better than any other language, IMO. That also points out a fallacy of the premise in TFS: it doesn't really make sense to attribute the success or failure of a given language to any single factor. Instead, programmers evaluate each on a combination of factors, and each has strengths and weaknesses compared to others. Therefore, each language fits into different areas, and a language thrives and prospers according to how many such areas there are and how important those areas become.

      IIRC, the original strength of Java was supposed to be "write once, run anywhere." I think it was the first language to feature that as the primary selling point, though others have followed. It's surprising that its primary initial selling point would now be eclipsed (tee-hee) by supposedly being "easy to read" - especially since that could be said about several other languages, depending on one's personal preferences in that regard.

    10. Re:Not as easy to read as Python though by Anonymous+Brave+Guy · · Score: 2, Insightful

      I've been programming in Python professionally for something close to a decade now, and in all that time the number of tab/space bugs I've seen in production is: 0.

      Get a good edit -- any good editor -- and worry about problems that actually matter. This one was solved in about 1927.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    11. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0

      Five words: That applies to most languages.

    12. Re:Not as easy to read as Python though by pr0nbot · · Score: 1

      I frequently find myself digging into some Python library for some reason, only to be surprised at how little code there actually is. Python somehow seems to be concise and expressive. I can't say the same for the Java code I've looked at.

    13. Re:Not as easy to read as Python though by wonkavader · · Score: 1

      Two more words: pretty print.

    14. Re:Not as easy to read as Python though by __aaclcg7560 · · Score: 1

      Get a good edit -- any good editor -- and worry about problems that actually matter. This one was solved in about 1927.

      Let's see... 1927... had the first working TV. I guess you can't edit something without seeing it first.

    15. Re:Not as easy to read as Python though by tbttfox · · Score: 1

      If Python encounters mixed indentation, it raises an IndentationError and points you to the exact line the error occurred. If you've got an editor that will run a linter on your code, it'll catch it even before you run. I use vim, so I just use retab, and go on with my life.

    16. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0

      The Python equivalent overrides a base class with most of the boilerplate already handled. The Java one doesnt, but easily could (plus for extra verbosity uses StringTokenizer instead of just splitting the string on an RE as the Python one does). Otherwise they are actually more or less the same.

      As a java developer for closing in on 20 years (yes I was in quite close from the start), I have grown to really love it. Can't speak for anyone else but I find the tool support is simply incredible, removing much of the frustrating verbosity of writing in the old days, when you had to manually add your imports, look up javadoc'd methods in seperate browser etc. Nowadays the bookwork gets done for you. The strict type system which I used to hate with absolute vengeance (primarily because of the hassle of writing things with it, not reading it) I recognise as having saved my bacon on countless occasions, and the fantastic IDE's (which are able to be so powerful precisely because of that strict type system) take away almost all the excessive verbosity of writing. Yes I can and occasionally do "bare bone" it with vim for very short standalone programs, but noone who has ever worked on a large codebase with something like IDEA (or presumably eclipse or netbeans) is ever going to want to stop using them because they save you an insane amount of time. They pretty much leave you figuring out what you want to name things, and how you want to arrange the code. Most of the rest of typing gets done for you, plus they offer a huge number of incredibly powerful refactoring possibilities, superlative code navigation facilities, and code flow analysis etc.

      I don't consider myself some kind of elite hacker, but I do feel sorry for people on other projects looking at their problems on the odd occasions I have had to help, and am happy to have lucked onto Java.

    17. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0

      I've been programming in Python professionally for something close to a decade now, and in all that time the number of tab/space bugs I've seen in production is: 0.

      And in development I have seen lots of python programmers who printed out their own code to meditate on where the one bug is they could not find on screen - only to waste another few hours because the tab/space bug was obfuscated by a page break in the printout.

      Get a good edit -- any good editor -- and worry about problems that actually matter. This one was solved in about 1927.

      Curious, which editor from 1927 would you recommend?

    18. Re:Not as easy to read as Python though by Anonymous+Brave+Guy · · Score: 2

      And in development I have seen lots of python programmers who printed out their own code to meditate on where the one bug is they could not find on screen - only to waste another few hours because the tab/space bug was obfuscated by a page break in the printout.

      Good for you. The last time I saw a programmer do that was... also never in my entire career, actually. If your programmers have trouble meditating on a print-out of a language with syntactic whitespace, you might suggest they instead use any modern text editor and a macro/plug-in that makes mismatched whitespace show up in bright red. Then they can become enlightened, spend less time "meditating" like programmers who work with punch cards, and spend more time making useful software.

      Curious, which editor from 1927 would you recommend?

      I doubt that there was any text editor available in 1927 that got tabs/spaces wrong when working with Python code. Take your pick.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    19. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0

      BTW, in case you haven't noticed, Python syntax is similar to Fortran syntax which is among the oldest, if not the oldest programming language still alive.

      This. I think Fortran (and now Julia) strikes the best balance, because it doesn't have the tab/space issue that may produce problems, especially when sharing code.

      I'm gonna have to call shenanigans on that assertion. Have you ever looked at the Fortran sections of CHARMM (MD package)? You want something hard to read that will make your head explode, go look at some of that mess! Not only is everything in CAPS there are space indents in the code and if you don't match those up, WHAMMO! error time!

    20. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0

      BTW, in case you haven't noticed, Python syntax is similar to Fortran syntax which is among the oldest, if not the oldest programming language still alive.

      This. I think Fortran (and now Julia) strikes the best balance, because it doesn't have the tab/space issue that may produce problems, especially when sharing code. Like Python, it lacks the ugly {} ; punctuations, but it needs something to denote the end of a block, so it uses the English word "end" to keep things simple and clean.

      Forth was the best. RIP.

    21. Re:Not as easy to read as Python though by TeknoHog · · Score: 1

      Have you ever looked at the Fortran sections of CHARMM (MD package)? You want something hard to read that will make your head explode, go look at some of that mess! Not only is everything in CAPS there are space indents in the code and if you don't match those up, WHAMMO! error time!

      I haven't had a look, but from your description I assume it's Fortran 77 (or even older, though that's unlikely). It's a good point, though; everything good I've said about Fortran refers to F90 or later. I agree that F77 is a mess and it lacks a lot of the modern niceties, for example with vector/matrix types (imagine writing auto-parallelized matrix math in the 1990s).

      I'm pretty sure that all the bad things people generally say about Fortran are because they're only familiar with the horrible old versions. The change to F90 didn't exactly happen overnight with all the legacy code around; the only time I've worked with F77 was at CERN in 2001, but fortunately I got to write my part in F90, only using the legacy bits as reference for the data format.

      --
      Escher was the first MC and Giger invented the HR department.
    22. Re:Not as easy to read as Python though by Anonymous Coward · · Score: 0

      Not as easy to read as Python though

      Properly, consistently indented Java is. It's just that python has to be correctly indented to work, which is great, BTW!

      Disagree somewhat. Java also tends to be more verbose than python - which reduces its readability IMO.

      (Don't get me wrong. Java also has some areas when it does excel over python, I just disagree wrt readability)

    23. Re:Not as easy to read as Python though by mattventura · · Score: 1

      I've never actually seen issues with that. Establish an indentation style for your project, whether it's tabs or X spaces (4 being the typical Python style), and enforce it. If someone can't commit code with the right indentation style, they shouldn't be writing code in the first place.

    24. Re:Not as easy to read as Python though by engun · · Score: 1

      I don't disagree. Static typing shines for the tasks you mentioned, and I have felt its absence in Python on several occasions. I have wondered about Python's scalability in larger projects - but I think the lower cognitive burden in Python counteracts any losses incurred from the lack of static typing. Plus, test cases can take care of that to a great degree too.

      In Python, people rarely use code generators. It's hardly ever needed. I think that says something too. There's often a lot less boilerplate.

      WRT to your comment on the two examples - yes, the boilerplate could have been reduced. Yet, it hasn't been - why is kind of my point. If you work with Python libraries for an extended period of time, you will see this simplicity recurring again and again and wonder why the Java equivalent is almost always more complex. In fact, I would be happy to throw down the gauntlet and say that for any given piece of Java code, the equivalent Python code would often be easier to grok. (One way to test this would be to compare equivalent code using the standard libs)

    25. Re:Not as easy to read as Python though by DrVxD · · Score: 1

      "python -tt" is your friend.

      --
      Not everything that can be measured matters; Not everything that matters can be measured.
  4. Corollary: It's difficult to be "clever" in Java by Anonymous Coward · · Score: 5, Insightful

    And that's a good thing.

  5. verbose enough to be easy to read by antiperimetaparalogo · · Score: 4, Insightful

    Yes, while verbose, i find Java easy to read - and i think its verbosity helps in this (after a while you know what/how to read Java code, and your reading becomes "smooth").

    --
    Antisthenes: "Wisdom begins by examining the words/names." - excuse my English, i am (slightly...) better with my Greek!
    1. Re:verbose enough to be easy to read by Anonymous Coward · · Score: 0

      You find Java verbose? Clearly you're yet to discover the "wonders" of Obj-C syntax.

    2. Re: verbose enough to be easy to read by Anonymous Coward · · Score: 0

      I don't really agree and that's why I find C# much better than Java.
      Verbosity makes it painful to write code and also painful to read and understand it.

      Imo C# beats Java in this.

  6. Not easiest to read, but forgiving... by CraigCruden · · Score: 3, Insightful

    The popularity of Java is not because of it's "easy to read" nature, but because it is fairly forgiving for programmers that don't really know what they are really doing.

    I programmed in Java for 15+ years and it is not the best language now (more of a legacy language) that tends to get riddled with boilerplate code which requires code generation and produces an outcome that is not as clear and concise as it could be.

    It is however a forgiving language where if you don't understand memory management -- it is not a big problem. For example I remember a system written by programmers in another language that was riddled with memory leaks because of cylindrical references. The code was literally translated into java and all the problems disappeared. The programmers on that project just figured that the language that they programmed in was the problem -- but in reality java saved them from their inability to understand the basics of what they were doing.

    1. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 3, Funny

      You made me google "cylindrical reference".

    2. Re:Not easiest to read, but forgiving... by invid · · Score: 4, Insightful

      A problem with Java and C# is that it is possible to create memory leaks in those languages, but since people rely so much on garbage collection they don't think about it and get bit in the ass. Event handlers shared across processes are particularly dangerous.

      --
      The Moore-Murphy Law: The number of things that will go wrong will double every 2 years.
    3. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      It's used with the Moebius garbage collector..

    4. Re:Not easiest to read, but forgiving... by Daniel+Hoffmann · · Score: 1

      I think he means circular reference ( http://en.wikipedia.org/wiki/C... )

    5. Re:Not easiest to read, but forgiving... by dimeglio · · Score: 2

      Hard for me to agree that a language is forgiving when it avoids syntax pitfalls other languages might contain. Forgiving implies it let's things go. In this case, Java by its design and nature, helps avoid problems you would otherwise need to deal with when using another language.

      --
      Views expressed do not necessarily reflect those of the author.
    6. Re:Not easiest to read, but forgiving... by asylumx · · Score: 5, Funny

      Give him a break, he's been programming in java for 15+ years.

    7. Re:Not easiest to read, but forgiving... by Chris+Mattern · · Score: 5, Funny

      A cylindrical reference is like a circular reference, except it happens when your code is three dimensional.

    8. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 2, Insightful

      Hmmm. I enjoy driving my modern car because it has an fuel injection and an engine management CPU. I guess I'm just not a real "driver" because I drive such a forgiving car. If I really knew what I was doing, I would drive a car more like a Ford Model A with a crank start, manual choke, and manual spark advance on the steering column.

      Machines (I'm including computers in this category) that provide useful abstractions that relieve the machine's users from having to be concerned with details of the machine's operation that are not germane to their primary purpose in using the machine are valuable, not props for the weak-minded.

      If we all still coded by hand in machine language or (slightly better) assembler, we would not be able to produce code at anywhere near the rate we do. Languages that are forgiving in the sense that they take care of the details that machines are good at taking care of, and allow the programmers to focus on solving the real problems are a tribute to our ability to continually improve. The implication that programmers using such a language "don't really know what they are doing" naively assumes that what programmers should be doing is worrying about memory management instead of understanding the actual problem to be solved using the computer.

    9. Re:Not easiest to read, but forgiving... by Xest · · Score: 1

      Maybe it's where you create an array of circular references?

    10. Re:Not easiest to read, but forgiving... by pr0fessor · · Score: 1

      You have just described why java has been such a pain in my neck. Otherwise nice looking software that functions until the memory leaks cause it to crash.

      As for c# events, delegates, and event handlers in the msdn documentation is a mess it's not surprising it's a issue. I've read a few of the tutorial and I'm not sure the people writing them even understand what they are doing.

    11. Re: Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      Shouldn't that be spherical?

    12. Re: Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      ROTFL

    13. Re:Not easiest to read, but forgiving... by Giant+Electronic+Bra · · Score: 1

      Yeah, but they are a class of leaks which are generally not that hard to sort out. Now, I've seen a few ugly leaks in my time that had no really obvious source, but even then it was very easy to determine WHAT was leaking and HOW, even if the exact explanation of WHY was rather obtuse. Your average programmer can understand most of the common cases though, like "gosh I created a static list of unbounded size and put 9 billion object references in it, that won't work!"

      --
      "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson
    14. Re: Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      That makes a tesseract where everything happens at the same time.

    15. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      I programmed in Java for 15+ years and it is not the best language now

      You seem to be confused that there's such a thing as "best language". Is there a "best tool", or are different tools suited to different jobs? You also seem to be confused that Java is now "legacy". Legacy implies nothing new is being developed in it, and no new developers are learning the language. The standard for a legacy language is COBOL, or even Pascal. Do you really think Java is in the same category as those languages? Java currently competes with C/C++ for most popular language, so it's about as far from legacy as you can get.

    16. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      Shouldn't that be a spherical reference?

    17. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 2, Interesting

      C# is like a cleaned-up, easy-mode Java. It's really difficult to not know what you're doing if you actually paid attention in your 101-level programming courses in college.

      C# delegates are just, in C terms, typedef'ed function pointer prototypes. Now, C doesn't really have those. But you know what a prototype is, you know what a function pointer is, and you know what typedef-ing does. Now combine these ideas. "This is a name for a specific format of a function pointer that I'm going to use over and over later." Due to the C++ influence, it also has an object protection level specified.

      The format is: {protection level} delegate {return type} {typedef name} ({parameter list});
      Example: public delegate int Foo(int a, int b);

      Now, when you want to use one (for a callback, probably), you simply accept a parameter of your delegate type. (Example: void DoSomethingAndCallAFoo(int blah, int blah2, Foo callback))

      And to provide that delegate, you would write a function in a class somewhere that has the same signature as the delegate, then pass it as the argument to DoSomethingAndCallAFoo. So, if you had a function named Bar that matches the Foo delegate's signature, you could call DoSomethingAndCallAFoo(blah, blah2, Bar); or optionally, you could make it slightly more obvious what's going on by calling DoSomethingAndCallAFoo(blah, blah2, new Foo(Bar));.

      As for events, they're just function pointer lists that only(*) accept pointers to delegates with an expected signature: public delegate void Whatever(object sender, EventArgs e). (EventArgs is covariant, so derived EventArgs can be passed in as well.) Those pointers-to-delegates-with-an-expected-signature are called event handlers. The EventHandler generic handles all of this for you. Declaring a member event as public event EventHandler ShitHappened; will accept the Whatever delegate above (and you don't even have to declare the delegate, since the signature-matching happens anyway at compile-time). All that's needed now is a dispatcher function, typically named On{event name} (in this case, OnShitHappened), and accepting only the appropriate EventArgs as a parameter. It should check for a non-null event pointer list, and call the event handler with a this-pointer and the event args parameter it was supplied with.

      You shouldn't really have tricky memory leaks to watch out for unless you're doing threaded stuff (due to the way thread memory allocation works, you can abandon a thread in a messy way and leave a bunch of un-GC-able stuff lying around that won't get cleaned up until the process goes away). Just using delegates and events shouldn't cause any trouble.

      (*) "only", if you're sane. You can force events to use non-standard delegate signatures, but you're an idiot if you do. Nobody will be able to maintain your code. Not even your 6-months-future self. Especially if I'm your boss and catch you using that unmaintainable crap, because your 6-months-future self won't be working near me or that code anymore.

    18. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      If we all still coded by hand in machine language or (slightly better) assembler, we would not be able to produce code at anywhere near the rate we do

      Judging by how shitty most code that was written in a hurry is, maybe that would be a good thing.

    19. Re:Not easiest to read, but forgiving... by jareth-0205 · · Score: 1

      A problem with Java and C# is that it is possible to create memory leaks in those languages, but since people rely so much on garbage collection they don't think about it and get bit in the ass. Event handlers shared across processes are particularly dangerous.

      I mean, yes, you can't get away with not knowing anything at all about memory management in Java, but singling out edge cases that are a problem vs the vast majority of cases where it's superior is sort of missing the point. Rather like saying that wearing shoes is a problem because you sometimes get a stone in them, far better that you should always go bare feet and constantly make sure you don't step on anything sharp.

    20. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      I remember running into these issues about a month out of college. Took me a day to figure it out, never made the same mistake again. If you regularly see these issues, stop having just graduated employees writing bad code. Just let them know ahead of time, if your event handlers point to delegates that reference objects, make sure you clean up those delegates, especially when working with anonymous methods.

    21. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      Someone mod this funny!

    22. Re:Not easiest to read, but forgiving... by invid · · Score: 1

      I was just saying it was a problem. As it just so happens I'm plugging up someone else's memory leaks right now in a C# program. I worked in C and C++ for decades, so I love garbage collection. Just because I point out a problem doesn't mean I want to dump Java or C#.

      --
      The Moore-Murphy Law: The number of things that will go wrong will double every 2 years.
    23. Re:Not easiest to read, but forgiving... by nitehawk214 · · Score: 1

      I had a spherical reference once...

      --
      I'm a good cook. I'm a fantastic eater. - Steven Brust
    24. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 1

      Yeah, but in Java/C# if you have a leak it might take days for the program to consume all the RAM and make the system run sluggish. Whereas in C/C++ since there is no bounds protection, you get random crashes and buffer overruns exploits every minute of every day.

    25. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      He looks like he needs a jailbreak, not just a break.

    26. Re:Not easiest to read, but forgiving... by FranTaylor · · Score: 1

      Otherwise nice looking software that functions until the memory leaks cause it to crash.

      if you approach java with the concept that it does not suffer from memory leaks, you're just deluding yourself.

    27. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      A cylindrical reference is like a circular reference, except it happens when your code is three dimensional.

      It would have been more nerdy to say "A cylindrical reference is like a circular reference, except it happens in a stack."

    28. Re:Not easiest to read, but forgiving... by pr0fessor · · Score: 1

      I don't have a problem with it but we can't assume that everyone took 101 programing that was c because that just isn't the case those in their 30s or 40s probably did.

    29. Re:Not easiest to read, but forgiving... by shutdown+-p+now · · Score: 1

      Ironically, you have actually got a few things wrong here.

      First of all, delegates are not just function pointers. They're bound method pointers, meaning that they can capture the receiver of the call in addition to the method itself. This makes it possible to create a delegate to an instance method, which is not something you can do with function pointers alone in C++ (there, you need to define a data structure that combines the function pointer with the object pointers; or use something like mem_fn or bind that'll do it for you).

      More importantly, when you say that "events are just function pointer lists", this is actually what delegates are, rather than events. Given your definition of Foo, for example, it is possible to say:

      Foo f = ...
      Foo g = ...
      Foo h = f + g; // look, a delegate that references two different methods!

      In the most common case, at least when passing them around as arguments, a delegate object will refer to a single method. But it can refer to arbitrarily many methods of different objects, and it's still denoted by the same delegate type. The rules defining what happens when you invoke such a delegate are not obvious (in particular, with respect to return values and out/ref parameters) - order matters, for example, and so do repeated inclusions of the same method (i.e. it's not a set, it's an ordered list).

      (In theory, it is possible to have delegate types that are not lists, if you define them as inheriting from Delegate rather than MulticastDelegate on IL level - this is legal per CLI spec. But no .NET language that I know of provides the ability to define such types in practice, so you'd need to use something like ilasm.)

      Events, on the other hand, are an entirely different concept altogether. The most crucial difference between an event and a delegate is that event does not define a type, nor is it an object. An event is simply a pattern of two accessor methods - one to add an event handler (represented as a delegate), the other to remove a handler - formalized on language level. When you write something like:

      public event EventHandler ShitHappened;

      what it does is define two methods named add_ShitHappened and remove_ShitHappened, both taking an argument of type EventHandler. Because you didn't specify the implementation of those methods, it will also automatically generate them as if you wrote it like this:

      private EventHandler ShitHappened;
      public event EventHandler ShitHappened {
      add { ShitHappened += value; }
      remove { ShitHappened -= value; }
      }

      (In practice it actually uses atomic operations to ensure that handlers can be registered concurrently from different threads without one overwriting the other, but I've omitted that for the sake of simplicity. For single-threaded case, the above code is equivalent.)

      You can't actually write it like that yourself, because it's not legal to have the same name for the field and the event - but for automatically generated accessors it is legal, and distinguishing between them depends on the context where it's done. If you're referencing ShitHappened from the same class, then you're accessing the field. If you're accessing it outside the class, you're accessing the event.

      Either way, the important part is that, regardless of whether the event has implicitly defined accessors or not, users of the class only see the add/remove accessors, and do not have access to the backing storage. This means that they cannot, for example, raise the event from the outside, or enumerate the list of subscribers and directly invoke some of them, or remove a delegate from that list that they haven't themselves added (or obtained from elsewhere, which is why it's a good idea to make all event handlers private).

      And that is the so

    30. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      AspectJ is pretty much a requirement for reducing the amount of boiler-plate code in Java. Break the boilerplate code out to .aj files and keep your Java classes as close to a POJO (Plain Old Java Object) as possible. Spring Roo can be useful for generating the gets/sets and some other things as you add/remove properties from the class.

    31. Re:Not easiest to read, but forgiving... by Anonymous Coward · · Score: 0

      ah, that's why writing 3D befunge is such a challenge.

    32. Re:Not easiest to read, but forgiving... by DrVxD · · Score: 1

      +1 - YOMANK

      --
      Not everything that can be measured matters; Not everything that matters can be measured.
  7. C++ Template Syntax by glennrrr · · Score: 3

    Maybe it's improved with the new versions of C++, but I coded in C++ for many years before transitioning to iOS development, and I never wrote my own templated classes, mainly because I would never be able to understand what any kind of semi-complicated template would do. So, I just used STL and Boost, and only with the templates I was comfortable with.

    1. Re:C++ Template Syntax by Anonymous Coward · · Score: 3, Insightful

      The syntax isn't what makes C++ templates hard. They're hard because they're templates.

      However, they're powerful because of it. There's no "generics meta programming" because generics don't offer any sort of comparable power. That said, the reason template meta programming is so useful is because C++ lacks reflection.

    2. Re:C++ Template Syntax by Anonymous Coward · · Score: 0

      >C++ lacks reflection.

      To be fixed in C++17!

    3. Re:C++ Template Syntax by shutdown+-p+now · · Score: 1

      Generics can absolutely offer comparable power. The extremely limited versions of generics that exist in e.g. Java and C# do not do so, but if you just add structural typing to them, you can get the same expressive power as C++ templates.

    4. Re:C++ Template Syntax by rdnetto · · Score: 1

      The syntax isn't what makes C++ templates hard. They're hard because they're templates.

      However, they're powerful because of it. There's no "generics meta programming" because generics don't offer any sort of comparable power. That said, the reason template meta programming is so useful is because C++ lacks reflection.

      I disagree. Take a look at D templates (and compile-time function evaluation) - that syntax will be easily readable to anyone familiar with a C family language, because it's the same syntax (just with 'static' or 'pure' peppered everywhere).

      C++ template meta-programming is hard for two reasons. The first is that templates use a syntax of their own, which is one more thing to learn. The second is that the template language is functional, which is quite alien to most C++ programmers. D uses native D syntax to do the same thing (with the requirement that functions be pure), and that's much easier to read.

      --
      Most human behaviour can be explained in terms of identity.
  8. Stability by Anonymous Coward · · Score: 5, Insightful

    A huge standard library that has been stable for 20 years (backward compatible as much as humanly possible) has a lot to do with it as well.

    In other languages, I feel like I have to re-learn basic elements every decade to "how it's done now"...

    1. Re:Stability by DickBreath · · Score: 4, Interesting

      Not only do you have to re-learn basic elements every decade, you might have to rewrite very old code to work on current systems.

      The people who make these incompatible changes vastly underestimate the cost of such incompatibilities.

      The sheer amount of working Java code is not only why the language will stay around for a long time, but economically represents a very large amount of wealth.

      --

      I'll see your senator, and I'll raise you two judges.
    2. Re:Stability by drerwk · · Score: 2

      A huge standard library that has been stable for 20 years (backward compatible as much as humanly possible) has a lot to do with it as well.

      In other languages, I feel like I have to re-learn basic elements every decade to "how it's done now"...

      No kidding - especially the socket libraries that let me write network code in the later 90s that would work on Sun, Mac, Windows, and Linux. Getting cross platform network code to work in C at that time was quite painful. And I don't recall any C++ libraries that I found pleasant to use before boost, and now Qt. And even now, while I consider boost essential, it's really only pleasant in the same way as no longer having to get your braces tightened qualifies as pleasant.

    3. Re:Stability by Anonymous Coward · · Score: 0

      'And now' Qt? It literally turned 20 this week.

    4. Re:Stability by Anonymous Coward · · Score: 0

      A huge standard library that has been stable for 20 years (backward compatible as much as humanly possible) has a lot to do with it as well.

      LOL. I've run into many, many java applications that require one specific version of the JVM, and won't work with anything else.

      Even things like the next point release not working (jre1.6.0_32 vs jre1.6.0_33).

      And fix the version numbering already - if it's java 6, call it java 6 instead of java 1.6

    5. Re:Stability by _xeno_ · · Score: 1

      Hell, I've run into Java code that only runs on 32-bit versions of Java.

      I'm not sure how they did that, but it absolutely requires you to have 32-bit Java 6 prior to a certain patch level.

      Thankfully the part of IT demanding we run that software eventually caved to the part of IT demanding that the software running on every computer was, y'know, not full of security holes.

      --
      You are in a maze of twisty little relative jumps, all alike.
    6. Re:Stability by Anonymous Coward · · Score: 0

      A huge standard library that has been stable for 20 years (backward compatible as much as humanly possible) has a lot to do with it as well.

      In other languages, I feel like I have to re-learn basic elements every decade to "how it's done now"...

      True, but Java has accumulated quite a few "how its done now"s (that are mostly nice and make for tighter - more understandable - code): "for each" loops, to Lambda expressions - and generics are much nicer than Object+typecast too,

  9. Verbosity is easy? by DJ+Rubbie · · Score: 4, Insightful

    Really? Having a pile of needless verbosity makes it more difficult to read in the long run simply because one needs to figure out what exactly is being done even for the most trivial client application. To do even just simple fetch of some resource over HTTP requires rather laborious conversion routine from a stream to a string type before most common JSON libraries would be able to use it. In any more modern language it can simply be used right away rather than having to figure out which JSON libraries to use or why toString() doesn't seem to work on InputStream (I mean intuitively shouldn't toString() on a stream get back a string?).

    Granted the Apache commons can make this a bit easier, I find it extremely annoying to have to cast things into the right object type just to access some simple JSON object, instead of just doing something like result['collections']['links'][0] which is much easier to understand. Dumbing things down does not necessary make better programmers.

    --
    Please direct all bug reports to /dev/null
    1. Re:Verbosity is easy? by Anonymous Coward · · Score: 5, Insightful

      Your mindset is exactly what causes problems with other languages. What you expect isn't readability but a higher power density. If you push this too far, you get too much implicit functionality, and that makes code difficult to read, because you can no longer understand what's going on if you're not familiar with all the idioms.

      There are fundamental differences between a stream and a string (hence the existence of separate classes), so something has to give if you want to use a stream where a string is expected. If you make this implicit, then someone who doesn't know the semantics first has to realize that there is something implicit going on, and probably look up what it is, while in Java the conversion is explicit. Java isn't "surprising".

    2. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      But "some resource over HTTP" can also be an image. How would you just "toString()" that?

    3. Re:Verbosity is easy? by Daniel+Hoffmann · · Score: 1

      Well, this implicit functionality is rather useful, that is why you see libraries like Apache IOUtils (like IOUtils.reafLine()) that bring some of that magic back. But the fact that you can go to the lower level is a good thing, I just wish the Java designers had these kind of utilities backed into the core of the language.

    4. Re:Verbosity is easy? by bwwatr · · Score: 3, Interesting

      I agree with this guy. Java forces you to acknowledge and address subtle differences between different types of objects. Yes, sometimes code is overly verbose, but overly compact code that does a lot of "magic" for you, is far worse. I unfortunately work in PHP a lot, and you can pretty much treat any value as any type and usually get away with it, until you suddenly don't. Strong typing and an IDE that whacks you with a stick every time you forget it, is far preferable, even if your code is a few lines longer.

    5. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      The crucial difference is that it isn't part of the language. Of course you can use a class library which defines similar functionality for string and stream parameters, but to anyone reading the code, it is immediately clear what's going on and where to look if they need to dig deeper. No surprises. If the language performed the conversion implicitly, someone reading the code might not even realize that the class which is used with a stream isn't written to handle a stream but receives an implicitly created string instead.

    6. Re:Verbosity is easy? by Pastis · · Score: 2

      > I mean intuitively shouldn't toString() on a stream get back a string?

      Yes it should return a String (enforced by polymorphism) but not the String you imply.

      From the API

      Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.

      So your String should be a description of the InputStream, not its contents.

      For example: "InputStream for URL: http://google.com/" or whatever satisfies the concise informative representation that is easy for a person to read.

    7. Re:Verbosity is easy? by TheSunborn · · Score: 2

      Why would you expect toString() to work on a InputStream?

      There is no general safe way to create a String from an InputStream, because mapping from a byte stream(Which is what a InputStream is) to a string is not 1:1.

      That is: The same string can be encoded as different bytes, depending on the encoding such as UTF-8, UTF-16 iso-8859-1).

      The funny thing is that Sun did not think about this when they first created Java, so there are a bunch of deprecated methods which create strings from bytes, trying to guess the encoding or reading in from the systems default locale.

    8. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      http://www.asciify.net/ ?

    9. Re:Verbosity is easy? by a_claudiu · · Score: 3, Informative

      A Stream is not a String. A Stream is a pipe which can serve you bytes as soon as some of them available.
      If the InputStream.toString() will give you the full content of the stream you will have some very nasty errors. Eg. A beginner wants to read a file using a stream and is doing a toString() suddenly all the file will be loaded into memory into a big String eating all the memory. Another beginner listens to a tcp port using a stream does a toString() and suddenly the thread hangs until the client closes the channel. Plus you need a reader on top of the stream to have proper String encoding. Stream is for binary Reader is for strings.

      “I find it extremely annoying to have to cast things into the right object type” This is by design, Java is strongly typed. If you find yourself casting too much then is something wrong with your code style or the library that you are using.

    10. Re:Verbosity is easy? by Giant+Electronic+Bra · · Score: 1

      So, what you want is a horribly type-unsafe mess which presupposes a specific type of encoding of the string (Yay ASCII or die!). Instead what you have is a robust type-safe mechanism where you can make it clear in code that you are decoding a string, or accepting a serialized Java object over HTTP if that was what you wanted to do. What you call 'excessive verbosity' I call "Computers are stupid, always tell them explicitly exactly what to do because if you leave it up to them, they'll fuck it up." and that philosophy means the line-of-business code I write is phenomenally reliable and often sails right through major changes in external factors without any problem because it was correctly written on day one. YOUR code OTOH blindly jammed binary data through some unknown default binary-to-text conversion, and when you want to make it work correctly? Now you have to write some hokey nonsense to defeat default incorrectness. That's all fine for the time when you want to write a one-off screen scraper to grab some data and you have one hour to do it. I've written a LOT of perl, but don't mistake Java's strengths for weakness.

      --
      "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson
    11. Re:Verbosity is easy? by quietwalker · · Score: 5, Insightful

      Agreed.

      The whole "convention over configuration" theme is maddening, because if you don't know the conventions - or haven't figured out the new conventions that a particular project uses to drive execution and data flow, you're going to be lost. What is gained in brevity is added cost on the maintenance side. I once spent 2 days helping someone troubleshoot a currency formatting issue on a RoR app; someone had created a mixin to extend a base string class method, in a file describing a service. Fixing the code took all of 5 minutes, but finding it took forever.

      With Java, it's worse now than it used to be. A decade ago, your major threat to readability was someone with pattern prejudice; those who ended up encapsulating everything in a factory-factory to factory to interface to abstract to etc, etc, etc, making every data object change require changes to 5-10 files just to surface the changes to the end methods using it, just for the sake of doing it.

      Today you've got stuff like Spring. Ever try to do a manual, non-runtime code analysis of a project of decent size that heavily uses Spring, even where it's not necessary (like interfaces that will only ever have a single implementation)? Or worse, have you guys seen the OSGi development model? Let me put it this way; imagine using the original J2EE bean model, with home and remote interfaces and all that, only we've decided to use CORBA as our architectural focus. So every method can be a dependency-injected service-provided module, ready for you to call the service factory and grab an instance of the feature you want, which incidentally makes static analysis of code by humans more or less impossible.

      Yes, I understand the concepts for these features, and OSGi actually has some neat capabilities (that we've had since the mid 90's via similarly laborious mechanisms like CORBA or more often, DCOM), but they do detract heavily from both the readability and maintainability of the code. If a new developer can't determine the execution or data flow for a given scenario in a few minutes, it's going to be onerous for them to maintain the system. That pain for the benefit of what we all know is the patent myth of polymorphism; that every project is going to have a need for unplanned sibling code modules in the future - it doesn't seem like a good trade off to me.

      I've started to really appreciate code that I can use tools - often just the 'find in files' feature of an IDE - to trace through execution and data flow. It's becoming less and less common, and sourcing and correcting bugs is taking up more and more of my time because of that rarity. I sometimes look back on 'tricky' C code that uses/abuses pointer arithmetic and requires complex memory management, and I feel wistful for when it was that simple, that you could know what the code was actually doing. .. aww crud. I'm like a few years away from complaining about those darn kids on my lawn, aren't I?

    12. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      Granted the Apache commons can make this a bit easier

      It reduces it to a single function call (IOUtils.toString()). It couldn't really get easier.

      As for JSON, use Jackson, it's piss easy and widely used. btw. Jackson can take InputStream and write to OutputStream

      Basically your problems are solved by using the libraries everyone uses anyway.

    13. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      (I mean intuitively shouldn't toString() on a stream get back a string?)

      no.

    14. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      I find it extremely annoying to have to cast things into the right object type just to access some simple JSON object, instead of just doing something like result['collections']['links'][0] which is much easier to understand.

      You ARE aware that Java predates JSON by over five years right? How about that arrays in Java can only be reference with int indices? I'll grant you that the Java APIs from Oracle could provide a simple String-to-Map converter, instead of requiring a third party library, but even that is problematic, considering you may want a String-to-Array converter instead.

    15. Re:Verbosity is easy? by phantomfive · · Score: 1

      A decade ago, your major threat to readability was someone with pattern prejudice; those who ended up encapsulating everything in a factory-factory to factory to interface to abstract to etc, etc, etc,

      lol it fascinates me how common this problem is (and why always choose factory?). And then you half your code is converting from one object type to another.

      --
      "First they came for the slanderers and i said nothing."
    16. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      I mean intuitively shouldn't toString() on a stream get back a string?

      Streams maybe unending and/or infinitely long. Do you really want to tostring something that may never finish?

      fyi, TCP is a stream, I do not recommend doing a ReadUntilEnd style ToString when attempting to download a multi-petabyte file. You may be in for a world of hurt when you get an out of memory exception.

    17. Re:Verbosity is easy? by multimediavt · · Score: 1

      .. aww crud. I'm like a few years away from complaining about those darn kids on my lawn, aren't I?

      Nope, you're there. Welcome to the club. Now, get off my lawn!

    18. Re:Verbosity is easy? by quietwalker · · Score: 2

      You may know the quote: "Premature optimization is the root of all evil," but the whole quote in context explains why it is so:

      "Programmers waste enormous amounts of time thinking about, or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%."
      - Donald Knuth

      In fact, it takes an experienced eye to know when and where to optimize, to identify that critical 3%. In the meanwhile, novices are so worried they'll miss it that they try to overoptimize everything, not having the experience of maintaining programs written in that way.

      So when you see that sort of pattern abuse, especially naming classes after patterns, like -Facade, -Decorator, -Adapter, -Mediator, (and -Mixin depending on the language) realize that what you're dealing with is a novice's code, written by an amateur with no clear understanding of the entirety of their job, and adjust your expectations accordingly.

    19. Re:Verbosity is easy? by Anonymous Coward · · Score: 0

      AMEN!

      And whoever came up with the idea of making annotations control what actually runs (instead of just being used for documentation) and how it runs should be shot in the face. Give me java 1.4 all day long.

    20. Re:Verbosity is easy? by Twinbee · · Score: 1

      A future programming language would simply assume UTF-8 from the start, and not worry about trying to support the other encodings. Such a language would have a lot less bloat attached to it.

      --
      Why OpalCalc is the best Windows calc
  10. Re:It's time to round up the Muslims by Anonymous Coward · · Score: 0, Offtopic


    It's time to round up the Muslims (Score:0)
    by Anonymous Coward on Thursday May 21, 2015 @08:23AM (#49742663)

    you know what I mean.

    You can try. But we are growing in number every day while you Christians are decreasing in numbers and growing softer and softer in your decadent lifestyle. In two or three generations we will control Europe and in another generation we will control the United States. Then we will have true submission of the world as the Prophet Muhammad spoke of over 1,000 years ago. The funny part is we can speak of our plans boldly, but Allah has our future in his hands and you cannot do anything about it.

  11. Readability is crucial for new languages by Anonymous Coward · · Score: 2, Insightful

    Java's readability is part of its staying power, which is part of the reason that Java is able to overcome its severe age and lack of features. As a software developer, I spend 90% of my time reading other peoples' code and 10% of the time writing my own. I also need to read code that I read over 6 months go, which I largely won't remember writing.

    This is a major part of the reason why languages such as Scala haven't taken off. Scala, Perl, and other similar languages are largely "write-only" in my opinion. Newer languages must be designed primarily for readability.

    1. Re:Readability is crucial for new languages by DickBreath · · Score: 4, Interesting

      Readability goes along with 'toolability'. The fact that tools can 'understand' Java code and therefore can correctly make so many kinds of automated changes to the source code is a major sign of readability. If it is not possible to make tools that can do precise and sophisticated manipulations of the source code, then chances are that humans cannot understand it easily.

      As an example of what I mean by 'toolable'. When I rename a variable in Java, every instance of that variable throughout the entire project are changed. This is not a dumb 'search and replace'. It is a precise change made by tools that use most of the Java compiler front end in order to make these changes. Similarly if I rename a method, the change is precisely made throughout the source code. It doesn't matter if there is a variable, or a class or even another method elsewhere with the same name, there can be no possible confusion. Just as the compiler has no confusion about what identifier 'foo' in some line of code refers to, the renaming and refactoring processes are equally precise. That is what is meant by toolable.

      --

      I'll see your senator, and I'll raise you two judges.
    2. Re:Readability is crucial for new languages by Anonymous Coward · · Score: 1

      Your comment about renaming a variable is entirely an IDE function. An IDE for any language could be designed to allow for variable renaming in this fashion. If a compiler can understand the code enough to compile it, an IDE can be written that also understands the code to the same level. The difficulty of writing such an IDE might vary between languages, but there's no reason it wouldn't be possible for any language that uses variables.

    3. Re:Readability is crucial for new languages by DickBreath · · Score: 1

      Yes, it is a function of the IDE. But the language itself has something to do with why this was easy enough to implement for Java that it was done long ago and not just recently. I'm sure that even for the Java language it is not easy to implement. But the language is statically typed. You cannot reference members via strings (like in JavaScript). The meaning of an identifier does not depend on anything that happened at runtime prior to that identifier being used. It is possible to statically analyze the code easily without so much research into what might affect the meaning of the code you're looking at. No operator overloading (that also affects readability, or ability to abuse things).

      --

      I'll see your senator, and I'll raise you two judges.
  12. If it aint broke dont fix it by Billly+Gates · · Score: 1

    Just like IE 6 it is so engrained into our business processes that it won't ever leave. At least here in the office which greatly angers web developers greatly, but operations doesn't care.

    Java is around for no technical reasons. It is here because it is already here. Why change for the sake of change and .NET wasn't worth the effort in 2005 as IIS was a steamy piece of poo back then. So now no one wants to take the risk and $$$$ for something that already works. Yes we stayed on XP too until 2014 but my employer is not alone.

    My post melts the brains on hipsters lucky enough to be working at .COMs in SV or still in school tinkering. Your souls havent been left yet for the real world yet

    1. Re:If it aint broke dont fix it by Anonymous Coward · · Score: 0

      Java has a number of technical reasons to still exist. It's just that if you happen to be into "git-er-dun!" scripting platforms like PHP, Rails, AngularJS, django or the like, you won't appreciate them.

      Java was designed for security from the ground up. Yes, recent client-side Java implementations have been security nightmares, but the fact of the matter is that most languages never even tried. They don't generally have sandboxes or security APIs. I love PHP, but not when security is at stake.

      Java has been developed for performance and scalability. Everything from the just-in-time dynamically optimizing bytecode compiler in the JVM up to and including the vast collection of ready-made frameworks for caching, clustering and so forth. It generally participates in universal performance boosters such as memcached, but also offers products unique to the Java sphere. Many of the universal performance boosters in fact offer special features in their Java APIs.

      Java expects rigor. It does a lot of compile-time checking and while that means that the coding phase of the product lifecycle takes longer it means that you aren't likely to get taken down at year-end time because the report that only runs once but has to be sent to the Feds in 5 days or less didn't have code in it where you were supposed to be processing wombats but another module passed you a spittoon instead.

      If the way your boss measures productivity is in how fast you can get pretty web pages online, Java is a poor choice. But if your boss is more worried about credit--card numbers being shipped in bulk to Ukraine, nightly processing actually running every night or scaling by more intelligent means than simply throwing processors by brute force at a problem, Java looks a lot more attractive.

    2. Re:If it aint broke dont fix it by Anonymous Coward · · Score: 0

      We use Win7 at work, a few people have Win8.1, servers are in the process of getting onto Win 2012R2 and SQL 2008R2. Still stuck on .Net 4.0, sucks, no async. We'll soon have two 10Gb uplinks for transit, with a single 10Gb transit failover with another ISP, and are looking into a possible dedicated 10Gb "cloud" connection with Level 3 for low latency high bandwidth connections to AWS, Azure, and several other cloud/datacenter providers.

  13. Platform independent by Anonymous Coward · · Score: 0

    More likely its the nearest thing to C++ that is platform independent.

    I use to program in C++, but after switching from Windows to Android, I also switched from C++ to Java, and the transition wasn't such a big deal.
    A lot of the libraries I use on C++, are there on Java. A vector is a vector, a float a float, etc. It's not that much of an issue.

    The alternative for me was to switch to C# and Winforms or similar, and I decided that I didn't want to end up churning out B grade corporate apps, which is really what that is about.

  14. Yeah right. Then explain COBOL. by gatkinso · · Score: 4, Insightful

    That's what I thought.

    It was purely serendipity, and now the install base is so large you can;t get rid of it.

    --
    I am very small, utmostly microscopic.
  15. It's not that great by BECoole · · Score: 2

    I could sure do without the { }.

    1. Re:It's not that great by Hognoxious · · Score: 1

      Would you rather have begin/nigeb or something dumb like that?

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    2. Re:It's not that great by dunkelfalke · · Score: 1

      What exactly makes curly brackets inherently not dumb? They are non-indicative and typing them on many keyboard layouts that are not en-US is quite uncomfortable.

      --
      "It's such a fine line between stupid and clever" -- David St. Hubbins, Spinal Tap
    3. Re:It's not that great by Hognoxious · · Score: 1

      What exactly makes curly brackets inherently not dumb?

      Nothing. Why do you ask?

      They are non-indicative

      They're indicative of the start and end of a block.

      typing them on many keyboard layouts that are not en-US is quite uncomfortable.

      Doctor, when I do this with my arm, it hurts.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    4. Re:It's not that great by nitehawk214 · · Score: 1

      Let me guess, you and GGP write Python? Starting out in C, I can't get my head around any language that doesn't have a bracket system.

      I am not saying you can't do dumb things with {}. (I am not sure what the term for the brace style is called.) In fact it makes it easier to do dumb things in some instances. But it also lets you do one liner things to make the code more readable. (such as the parenteticals in this paragraph (of course sometimes they make it harder to read such as this one))

      What do you suggest as an alternative?

      --
      I'm a good cook. I'm a fantastic eater. - Steven Brust
    5. Re:It's not that great by Rockoon · · Score: 1

      Personally I like {}'s
      Its the ;'s that I could do without.

      I actually think VB got this one almost right, with linebreaks separating statements, but has both an operator (:) to separate statements within a line when thats advantageous, as well as an operator (_) to continue statements onto the next line when thats advantageous.

      Its really easy to write a bunch of C-style code and miss a semicolon. Its really hard to write a bunch of VB code and miss a linebreak, or have an erroneous line continuation or line separator. One of these is obviously better overall.

      --
      "His name was James Damore."
    6. Re:It's not that great by shutdown+-p+now · · Score: 1

      Virtually anything; for example, "begin" and "end" as in Pascal; or implicit beginning of the block and "end" as in Lua; or parentheses in languages that don't distinguish between expressions and statements, like OCaml (OCaml additionally defines "begin" and "end" as aliases of "(" and ")", though).

    7. Re:It's not that great by Twinbee · · Score: 1

      That's a problem with those keyboards then. If had my own way, I'd have a single press key for the curly braces, or perhaps move to square brackets instead.

      --
      Why OpalCalc is the best Windows calc
    8. Re:It's not that great by tepples · · Score: 1

      typing them on many keyboard layouts that are not en-US is quite uncomfortable.

      Doctor, when I do this with my arm, it hurts.

      Rapidly switching back and forth between en-US and the keyboard layout for your native language can be uncomfortable as well. "Doctor, the contortions that I have to make between doing this with my arm and doing that with my arm hurt. I am required to do both for my job."

    9. Re:It's not that great by Hognoxious · · Score: 1

      Stop looking for a heavier screwdriver. Use a hammer.

      For the benefit of any self-identifying "makers", I mean right tool, right job.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    10. Re:It's not that great by Hognoxious · · Score: 1

      Virtually anything; for example, "begin" and "end" as in Pascal

      Why would you type 8 characters instead of 2?

      But at least they're actual words, which means you're likely to type them correctly. Unlike esac.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    11. Re:It's not that great by shutdown+-p+now · · Score: 1

      I'm not necessarily saying that begin..end is better, just that it's an obvious alternative. Personally, I don't mind {}, though I think that it's really redundant, and the proper way is to treat everything as an expression, in which case semicolon becomes a sequence operator (i.e. "a;b" means "evaluate a, then throw the result away and evaluate b" - like comma in C), and you just use parens to group things where needed.

    12. Re:It's not that great by swilver · · Score: 1

      The semi-colon's mean I can split up a long line of code in nicely lined up parts with just the enter key. Without them, I might be changing what the code does, or I'd need to fix all the parts and add somekind of continue operator.

      The fact that those semi-colon's are there is one of those things that makes Java more readable. I don't have to guess that a line will be continued or not (see Javascript). Making it optional just serves to confuse future readers of the code - that's why Java makes these mandatory. You can leave them out, but then you're code means something else.

      This and the fact that Java often only gives you one option to write something is exactly what makes the language so readable. Try explaining that though to the Scala / Groovy / Clojure / Hip++ crowd however... they seem convinced that the number of keystrokes it what dictates development speed... perhaps I should sell them Dvorak keyboards...

    13. Re:It's not that great by tepples · · Score: 1

      Then let me rephrase: What's the right tool for entering both native language text and program code?

  16. Re:It's time to round up the Muslims by Anonymous Coward · · Score: 0

    > But we are growing in number every day

    Nothing a few nukes couldn't fix.

  17. Sure, easy to read by ememisya · · Score: 1

    But you'd think the fact that it works the same on a Mac, Linux, Android or Windows would have something to do with its popularity as well, no?

    1. Re:Sure, easy to read by DickBreath · · Score: 5, Informative

      You'd think that the industrial strength JVM might also have something to do with it.

      You can have a JVM with a heap of tens of Gigabytes and with a modestly tuned (not extremely tuned) configuration, have Garbage Collection times in the tens of milliseconds. If you need hundreds of Gigabytes in your heap, Azul can sell you a JVM that can do this with GC pauses of about 10 ms.

      The JVM dynamically compiles the bytecode down to native code. Not like a C compiler does ahead of time. But it compiles it for the actual processor and features that your hardware has. The JVM compiler aggressively inlines methods instead of making function calls. So there is no drawback to writing lots of small methods. Even tiny methods like getters and setters. You can dynamically reload a class binary at runtime. But what if the new class has a new implementation of a method that some other foobar method had inlined by the compiler? No problem. The JVM knows this and it de-optimizes the class that had the foobar method so that it no longer has inlined a 'stale' version of the code in the class that was just now dynamically reloaded. If dynamic profiling reveals that the foobar method truly is a hotspot for the cpu, then the JVM will again compile it to native code -- based on the now current conditions of what code is in the overall system. It's like having a global -O 5 optimizer that can dynamically change / recompile any or every thing based on any code changes dynamically made to the running system. Want to change from a carburetor to caffeine injection while driving down the road at 70 mph? No problem.

      Call me when a dynamic language or other system can do that.

      Is it any wonder that so many languages other than Java also run on the JVM? The JVM might even stick around longer than the Java language.

      The JVM and Java run on the smallest systems to big iron. The SIM card in your phone is a tiny self contained secure tamper proof computer -- running Java. It verifies certificates using a private key that was forged inside the SIM and never leaves the SIM. Your Blue Ray player runs Java. You can write a Java program that provides the 'menu interface' for your disk. Old flip phones from 2000 run Java.

      --

      I'll see your senator, and I'll raise you two judges.
  18. Easy to read? by AchilleTalon · · Score: 2, Informative

    Almost all programming languages are easy to read. This is not the reason of Java's success at all. A complicate algorithm in first place will not make a program easy to read whatever the language you pick to program it. If you find Java easy to read, it is only because you cope with trivial algorithms.

    --
    Achille Talon
    Hop!
    1. Re:Easy to read? by Dog-Cow · · Score: 5, Insightful

      If you confuse easy to read with easy to understand, you aren't a skilled programmer.

    2. Re:Easy to read? by Anonymous Coward · · Score: 0

      If you confuse easy to read with easy to understand, you aren't a skilled programmer.

      Devil's advocate time. Doesn't reading require comprehension, and comprehension require understanding? As a contrary, I can read anything written in Latin or Cyrillic characters, doesn't mean I understand what it says. I think that the readability of computer code (regardless of language used) requires that what is read is understandable (comprehensible). The algorithm at work is non-dependent on code readability, but code readability will help you understand any algorithm, or did I miss something?

  19. Re:Corollary: It's difficult to be "clever" in Jav by DickBreath · · Score: 5, Funny

    final T up = (T) throwable;
    throw up;

    --

    I'll see your senator, and I'll raise you two judges.
  20. Re:Dafuq did I just read? by Anonymous Coward · · Score: 0

    Dafuq did I just read?

    Since when is java easy to read?

    Since 20 years ago.

    Can't you read?

  21. Hold Release Until April 1, 2016 by Anonymous Coward · · Score: 0

    Sorry, the wire services missed the instructions.

  22. Well, duh by Anonymous Coward · · Score: 0

    Most of the cost of maintaining any body of code over time is in maintenance, not in initial creation

    That's like saying "most of the cost of the grocery bill is made up by the most expensive item". I couldn't come up with a car analogy this early in the morning.

    1. Re:Well, duh by DickBreath · · Score: 1

      I think you are not understanding the insight behind the maintenance remark.

      Tools that work on the Java source code can be exact in what they do. No ambiguity exists. A method call foo() is understood by the compiler to be exactly one certain method. It doesn't matter how many other foo() declarations there are, or that there may also be variables and classes named 'foo'. The tooling makes maintenance tasks like refactoring very easy.

      If I am reading some dynamic languages, I might have to do some searching or research to determine exactly what is being called by this foo() function call. Java tools can tell you exactly, prior to compile time, what method is being called -- and that it is declared, and where it is. The tooling doesn't get confused no matter how badly the code might be structured.

      Maintenance becomes a big factor on a huge code base. The cost of maintenance can truly dwarf the cost of initial development.

      --

      I'll see your senator, and I'll raise you two judges.
    2. Re:Well, duh by undefinedreference · · Score: 1

      Only very small programs have less time invested in development than maintenance. Most code has at least 10 times more invested in maintenance than the initial development.

      There was an idiom the escapes me that one of my professors used to use (this was almost 20 years ago) that succinctly explained this. It has been well documented for at least 40 years now. Write programs with the realization that they will need to be maintained for perhaps decades on end, because if the code and company are successful, it will be.

  23. You must be joking by joseph90 · · Score: 3, Insightful

    I am sorry but can I just say:

      BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
      input = bufferedReader.readLine();
      number = Integer.parseInt(input);

    In Pascal (1960's) you could just do something like:
    integer number;
    read(number);

    See if the compiler knows number is an integer do I really have to tell it to create a stream and parse it as an int? seriously?
    Java is an abomination.

    1. Re: You must be joking by Anonymous Coward · · Score: 0

      I have no problem reading that Java code fragment, which is exactly the point of the original submission. It may be verbose to write, but once written, it's easy to read.

    2. Re: You must be joking by Anonymous Coward · · Score: 1

      Your Java code reads a line, and parses It as an integer. Without knowing the details, i still understand that it will fail on the input "1abc".

      Your pascal code, on the other hand, happily reads the number 1 and moves along.

    3. Re:You must be joking by Anonymous Coward · · Score: 5, Insightful

      I think you prove the author's point. Where the fuck is your pascal snippet reading from? How does it abstract bytes to characters? Why is there only an input with no output? Is `read` taking an integer and doing something with it? How is data getting out? In the java snippet, everything is laid out. You're reading from standard in. You're line buffering (with default encoding, but that's fine when reading from STDIN and not a file. Usually). You're reading exactly 1 line, then parsing that line for an int value. It's extremely explicit what's going on and has no magic. The whole passing in an outvalue thing that C and Pascal do is an AWFUL KLUDGE OF A DESIGN. It makes code harder to read and harder to understand.

    4. Re:You must be joking by Anonymous Coward · · Score: 0

      You could overload a read function to take ints, Strings, and so on. But Strings are not mutable in Java (for good reason) and there is no pass by reference (references are passed by value), so that's not available either. You could simplify a bit though:

      ObjectInputStream ois = new ObjectInputStream(System.in);
      int number = ois.readInt();

    5. Re:You must be joking by DickBreath · · Score: 1

      Pascal would be 1970's.

      The read() function (and writeln()) are not even functions. They are built ins in the compiler. Sure, they compile to calls in the pascal runtime library. But you cannot control where read/write go to except through implementation specific tricks, if at all. In Java there is no behind the scenes magic.

      Every part of the operation, the I/O, the parsing, the byte to character conversion (using what char encoding?) is explicit. And all these small pieces can be wired together in infinite ways. You get access to all the small nuts and bolts. In Pascal you don't get access to what ever integer parser that was used by read().

      I'm not saying there is anything wrong with Pascal. I loved it for a dozen years covering the 1980's and into the 1990's.

      In Java you can in just two or three lines of code make your own simple to use read() function using the basic parts.

      --

      I'll see your senator, and I'll raise you two judges.
    6. Re:You must be joking by Giant+Electronic+Bra · · Score: 2

      int number = Integer.parseInt(System.in.readLine());

      --
      "Malo periculosam, libertatem quam quietam servitutem." -- Jefferson
    7. Re:You must be joking by Anonymous Coward · · Score: 0

      Because reading from command line is the most common use case ever

    8. Re:You must be joking by Anonymous Coward · · Score: 0

      Pascal was and is a nice language for teaching algorithms. For one thing, it has a compact syntax and feature set.

    9. Re:You must be joking by Anonymous Coward · · Score: 0

      By default it reads from stdin. Modern languages are much more verbose.

    10. Re:You must be joking by Ksevio · · Score: 1

      In Pascal (1960's) you could just do something like: integer number; read(number);

      Unless they changed it in the past 30 years, I believe you'd have to do:
      number : integer;
      read(number);

    11. Re:You must be joking by shutdown+-p+now · · Score: 1

      Where the fuck is your pascal snippet reading from?

      From the standard input. Which is called "standard" for that exact reason.

      How does it abstract bytes to characters?

      By using the default conversion that is appropriate for the current locale (note that this is actually implicit in the Java code, as well).

      Why is there only an input with no output?

      What a stupid question. Because for the purpose of this discussion, we're talking about reading an integer, and nothing more.

      Is `read` taking an integer and doing something with it?

      Probably the sole valid complaint here. Though the notion of output parameters is not exactly obscure, it's nice when they're spelled out as such at call site, and not just when defined. For example, as in C#: read(out x).

      The whole passing in an outvalue thing that C and Pascal do is an AWFUL KLUDGE OF A DESIGN.

      Not really, it's just a way to tell the function what type to read. Since you've already explicitly spelled out that type when declaring the variable, there's no reason to repeat it again when reading into that variable. DRY and all that.

    12. Re:You must be joking by shutdown+-p+now · · Score: 1

      It seems that OP is confusing Algol-60 with Pascal.

    13. Re:You must be joking by maestroX · · Score: 1

      Where the fuck is your pascal snippet reading from?

      It's reading from System.in, whatever that is. You'll need to guess or look read() up. Once. After that, you'll know when and how to use it.
      You see, because in these Pascal times, there was no IDE with auto completion or snippet compiler (Lambert's ABC was one of the earlier).
      After years away from Java, I don't remember or guess to use both InputStreamReader and BufferedReader,
      because it's simply anal.
      Besides that, there aren't many languages that encourage red tape and overengineering like Java does.

  24. Re:Yeah right. Then explain COBOL. by Greyfox · · Score: 1

    Well if there's one thing programmers hate more than unreadable code, it's typing shit, and COBOL was an awful lot of typing shit. And for some reason, even though the individual lines were easy enough to read, something about the language made it very difficult to follow overall. Since the language was so overly verbose, functions usually ended up being pretty long, and it was very easy to get lost in them, in any COBOL code I was exposed to anyway. I'm sure there was probably some clean, well written COBOL code in the industry, but I never got a look at it.

    --

    I'm trying to teach myself to set people on fire with my mind... Is it hot in here?

  25. Libraries tools and 3rd party, oh my ! by Anonymous Coward · · Score: 2, Insightful

    Libraries tools and 3rd party support in the form of books, articles developer know how, WORA, etc. It's very very fast no matter what people around in the 90s may still think, it has an unbelievable number of extremely high quality, battle proven open source libraries for highly specialized and useful functions and of course the tools supporting it like IDEs are out this world good. So I can do anything I want, I can run in most anywhere, I have vast libraries at my disposal and best in class documentation from multiple independent sources.

    Pretty much sums it up.

    I use other languages, sure, but I get sick when I see people (evangelists, consultants) ushing some new "better" language because frankly they have positioned to make a ton of money off it shuld demand for it sky rocket. It's software engineering's own secret sin- people reinvent a non-broken wheel in order to profit. It happens all the time. There's gold in them thar hills if you can just "create a buzz" and reach enough developers by co-opting enough "thought leaders" to create a "tipping point" in demand for your new "break-through language / platform / way of programming".

    James Gosling recently said it best when he said that new important innovations aren't going to come from inventing new computer anguages, they're going to come from the world IoT and how create devs use languages.

    Yes, I am posting the AC for a reason. Let the onslaught begin...

    1. Re:Libraries tools and 3rd party, oh my ! by Anonymous Coward · · Score: 0

      James Gosling & co. have also written core library code where class constructors throw checked exceptions.

      That makes them assholes.

  26. BS! by Anonymous Coward · · Score: 0, Troll

    Java is no easier to read than C++, Objective-C, et al. It depends upon how the code is written, and I have read Java code that is as obtuse and ridiculous as any C++ code I have encountered in my 35 year career as a software engineer. FWIW, I got my first Java compiler directly from James Goslin in the mid-1990's, the inventor of the language. His intention wasn't "readability", but portability - the ability to "write once, run anywhere". Guess what? The UCSD-P system did this 2 decades before!

  27. What is Java... by Anonymous Coward · · Score: 0

    But a more convoluted, heavy weight Scheme? If we adopted Lisp 20 years ago the world would be a better place.

    1. Re:What is Java... by EmeraldBot · · Score: 1

      But a more convoluted, heavy weight Scheme? If we adopted Lisp 20 years ago the world would be a better place.

      #1. Java is nothing like Scheme, it's a fundamentally different language.

      #2. Scheme is a Lisp, so if Java were a heavy weight one, we would have a widely adopted Lisp.

      #3. Why would having Lisp being a widely adopted "make the world a better place"? Does it donate to charity?

      And frankly, I personally consider the Lisps to be heavily overrated to begin with.

      --
      "Set a man a fire, he'll be warm for the rest of the night. Set a man afire, he'll be warm for the rest of his life."
    2. Re:What is Java... by Anonymous Coward · · Score: 0

      There used to be a "Lisp machine".

      But that might be closer to 30 years ago now.

      Not much heard about it these days. About the only real remnants of it are the strange alt/shift/meta/etc keys used by EMACS, which, come to think of it, is probably also a remnant of it. The Lisp machine had a really funky keyboard.

  28. Really? by CaptainDork · · Score: 1

    Most of the cost of maintaining any body of code over time is in maintenance ...

    --
    It little behooves the best of us to comment on the rest of us.
  29. obvious much? by l3v1 · · Score: 1

    "the cost of maintaining any body of code over time is in maintenance"

    No, really? The cost of maintaining is in maintenance? Well, now that's some earth shattering surprise.

    Anyway, the intention was probably to say that maintaining is more costly than creating. However, since it says "any body of code" I'll just call it the deepest bullcrap. I've seen and heard lots of people talking out of their behinds over the years dismissing the effort going into creating some really nice algorithms and realizing them in applicable and useful code, simply thinking about the whole process as "coding" which is usually the easiest part. Also, maintenance costs a lot mostly when the coder monkeys hacking the code together were crap in the first place. Just stop paying outrageous amounts of money to idiots who put together unmaintainable code and then leave to another company to do this again and again, and by the time their code needs "maintenance" they're already gone and couldn't care less.

    --
    I am putting myself to the fullest possible use, which is all I can think that any conscious entity can ever hope to do.
    1. Re:obvious much? by tobiasly · · Score: 1

      No, really? The cost of maintaining is in maintenance? Well, now that's some earth shattering surprise.

      I thought the same thing when I first read that, but then again we're talking about an architect for the language that brought us "Foo foo = new Foo();" so a bit of redundancy is to be expected ;)

    2. Re:obvious much? by Anonymous Coward · · Score: 0

      Lets do a little timeline experiment of a codebase that will last a company say, 20 years. If you aren't coding your systems to run for 20 years, you aren't worth talking to. I'll give you the benefit of the doubt.

      Year 1: Develop the system
      Year 2-20: Maintain the existing codebase created in Year 1. This includes necessary business logic changes, bug fixes, and enhancements that increase overall business productivity.

      How the fuck do you not understand that?

  30. Re:Corollary: It's difficult to be "clever" in Jav by subanark · · Score: 1

    If your going to put in that hack, you might as well just include lombok into your annotation processing and just put @SneakyThrows everywhere. If only Java had gone with real generics like c#, we wouldn't have had all these erasure hacks.

  31. Re:Yeah right. Then explain COBOL. by DickBreath · · Score: 1

    Serendipity could also mean that it was in the right place, at the right time, and that is why the base of code written in Java become so huge. It solved a problem. And did so better than other solutions at the time. And arguably, still does.

    Other solutions may look sexy. And for smaller projects, they probably are.

    But long term maintainability is important. Does your project still need to work in ten years? Twenty?

    Having a compiler is also probably a major factor to Java success. If I make a typo in my code that breaks something, red flags start appearing on files in the source code tree all over the project for files that no longer will be able to compile. Lots of things that dynamic languages don't discover until runtime (or hopefully unit testing) are immediately discovered by the compiler. In a sense, the compiler is the zeroth step of unit testing before you even run the unit tests. The compiler effectively provides the first most basic set of 'tests' on the codebase.

    People who don't understand why Java sticks around also don't comprehend the sheer size of some Java code bases. I would like to see what would happen if a dynamic language were used to write a system that had hundreds of different forms or over a thousand; and maybe thousands of different reports it could produce.

    I'm not saying there is anything wrong with other languages. Just that Java does have a place. It is a solution to a real problem.

    If there were one perfect programming language, then everyone would already be using it.

    --

    I'll see your senator, and I'll raise you two judges.
  32. Re:Corollary: It's difficult to be "clever" in Jav by asylumx · · Score: 1

    Yes -- You have to be clever about being clever.

  33. I think it's really ugly by necronom426 · · Score: 1

    I just had a quick look at it and it looks like C to me. Really ugly.

    Why do this:

    public class HelloWorld
    {
            public static void main(String[] args) {
                    System.out.println("Hello World!");
            }
    }

    When you can do this:

    Print "Hello World"

    What's with all the horrible curly brackets everywhere? What's wrong with endif, next, etc? Bring back BASIC, it what I say!
    If I want to write something for myself to use I use Blitz Basic.

    At work I've use COBOL quite a bit, and that's nice to read. Full stops are okay. Not as hideous as curly brackets.

    1. Re:I think it's really ugly by PPH · · Score: 1

      Not as hideous as curly brackets.

      Be careful what you wish for. You could end up with Python.

      --
      Have gnu, will travel.
    2. Re:I think it's really ugly by Xest · · Score: 2

      I see this sort of mindset a lot, but it's illustrative of short sightedness.

      If you can't understand the importance of namespaces and structures, then you can't have worked on anything but the most trivial and small of codebases utilising little or no external libraries. If all you know are CS101 examples then sure, having to declare namespaces, methods, and so forth might look relatively bad.

      If however you work on anything that actually matters then methods, namespaces and so forth become kind of important.

      I don't see how endif is superior to }. Why would I want to type more than I have to to convey the exact same meaning? Curly brackets are meant to be jarring and to stand out, they do that to tell you a block has ended.

    3. Re:I think it's really ugly by shutdown+-p+now · · Score: 1

      Thing is, there's no reason to have a class for the program (that doesn't actually ever have any instances), and for main to be a static method of the class. That class is completely unnecessary scaffolding, that exists solely because the designers of the language wanted to "simplify" by saying that everything is a method in a class. Every Java application has the same "public static void main" line in it, exactly identical to any other such line. That is a clear indicator that it is superfluous.

      In practice, this has an opposite effect for pedagogical purposes, since you have to either explain all those things before getting to something as simple as "Hello, world", or else just handwave them away by saying something along the lines of "you just always type this exact same thing when you want to do this; we'll go over what it actually means later".

      In contrast, take something like Python. It does have namespaces, and classes, and objects (and indeed, unlike Java, in Python "everything is an object" is actually true!). But you don't have to know any of that to write or understand "Hello, world", because it also allows for global functions, and for code outside of functions, and it automatically imports the builtins namespace with the most frequently used functions that are useful to get started. So you can explain the basic concepts like variables, conditionals and loops to people first, and then gradually introduce them to procedural programming with functions (and locals and recursion), and then to OOP with classes, and to code structuring with namespaces. And at all levels in this progression, the new skills learned are purely additive - once you learn classes, you can do classes, but things that make more sense as global functions still remain global functions.

      It's also nice for app development because you can use the most basic instruments that are necessary for the task at hand. If you're writing a simple console app that reads input, processes it, and spits the result out, you probably don't need any classes, and the language doesn't force you to write any just because.

    4. Re:I think it's really ugly by Xest · · Score: 1

      So what's the alternative? I don't see how having code lumped arbitrarily somewhere, with no clear indication that it's the application entry point is better either.

      There needs to be some indication in a project that that's where the program starts, else what happens when you have say 3 or 4 lumps of code in separate files in the project all lumped in the global namespace, where does it start?

      It also makes it explicit that there even is a starting point, as opposed to it being, say, a library with no application entry point.

      I fully get what you're saying about making things easier for beginners to spew out code, but for a multi-purpose language it also needs to support maintainability too. I'm not even convinced that making it easy for new developers to get used to bad practice even helps them that much. I remember when I learnt C as my first language, I became dependent at the start on the global namespace because that's how the tutorials said it was easy to get started. It took a while to break out of that awful habit, and start writing actual good code. God only knows I've seen others fall into that trap - I had the misfortune of temporarily maintaining a massive VBA based application whilst simultaneously throwing it away to replace it with something that was actually not shit. Everything was a global variable, the list of globals went on for page after page. It was brutal.

      Long story short, I'm not convinced that making it easier for beginners to fall right into bad practices is in any way superior to making them learn a bit of boiler plate to keep things structured from the outset. I agree the syntax can be cleaned up and improved a bit, but I don't agree that it's pointless, or that writing straight into the global namespace in an unstructured manner is superior.

    5. Re:I think it's really ugly by shutdown+-p+now · · Score: 1

      There needs to be some indication in a project that that's where the program starts, else what happens when you have say 3 or 4 lumps of code in separate files in the project all lumped in the global namespace, where does it start?

      In case of Java, there's no clear indication where the code starts, either. Any class that has a static method called "main" can be the entry point, which is why you have to provide the name of the class to Java when starting your program. It's not any different in Python - you provide the name of the startup script, and the code that is in that script on the top level is your entry point, starting with the very first line of it. This seems a very straightforward definition to me: when you tell it to run X, it starts to run X from the beginning of X.

      BTW, note that there is a difference here between "outside of the class" and "global namespace". There's really no such thing as "global namespace" in Python - every .py file is implicitly a package with its own namespace. If you want to access something from another package, you have to import it and reference things using their fully qualified names (or import those specific things).

      I fully get what you're saying about making things easier for beginners to spew out code, but for a multi-purpose language it also needs to support maintainability too. I'm not even convinced that making it easy for new developers to get used to bad practice even helps them that much. I remember when I learnt C as my first language, I became dependent at the start on the global namespace because that's how the tutorials said it was easy to get started. It took a while to break out of that awful habit, and start writing actual good code. God only knows I've seen others fall into that trap - I had the misfortune of temporarily maintaining a massive VBA based application whilst simultaneously throwing it away to replace it with something that was actually not shit. Everything was a global variable, the list of globals went on for page after page. It was brutal.

      And Java approach to forcing everything into a class doesn't really do anything to solve that, it just makes it long winded, because now all those globals are statics in some class called "Utility" or some such.

      Fundamentally, some kind of global variables is plainly necessary, which is why Java offers them in a thinly veiled form as statics. It's semantically not different from globals at all, except that it forces you to spell out a prefix (class name) every time. And no, it's not there for namespacing purposes, because Java already has packages for that. Static classes just add another useless layer that is kinda sorta like packages but not really.

      Consider something like math functions or constants like pi. In Java, these are put into the Math class. Why? That class never has any instance of it created. A proper design would be to put them into something like java.math package, and the only reason why they're in a class instead is because a package cannot directly contain methods and fields. So that restriction is directly contrary to good API design here, and necessitates hacks like introducing a class that is functionally a package for all effective purposes (but still different syntactically, both when defining it and when using it), and the users are forced to write Math.abs, Math.PI etc for no good reason. Later on, because of the verbosity and the disparity, they've added "import static", which is basically another hack - it makes static classes look even more like packages, and finally lets API clients write "abs" and "PI" without qualification, but many differences still remain.

      IMO, the proper approach here is rather to educate people as to why global shared state (regardless of its lexical scope) is usually not the right thing for large applications, excepting certain things such as common constants and utility functions.

      And, of course, for many small applications (command-

    6. Re:I think it's really ugly by Anonymous Coward · · Score: 0

      Maybe you do not know about import static, allowing you to have the syntactic sugar of not having to provide the classname for constants, or static methods.

      import static java.lang.Math.*; ...
      double r = cos(PI * theta);

    7. Re:I think it's really ugly by shutdown+-p+now · · Score: 1

      If you read my post, you'll see that it specifically calls out "import static", and why it's not really good enough.

  34. In the real world you leave under such conditions by lommetennis · · Score: 1

    I am really sorry to hear about your working conditions, but with todays possibilities as a programmer, why do you even put up with that shit? You are supposed to have a boss to take those battles for you. Where I live they would have no people left if they stuck to their ways like that. Training new employees is expensive, and that is a language your accountists understand. Three months after finishing uni and getting my first job, recruiters started calling me (ooh, experience!). Maybe you are stuck in the only place in rural Kansas that employs programmers, but we leave in a global economy with remote working possibilities, so no excuses.

  35. Re:Corollary: It's difficult to be "clever" in Jav by jellomizer · · Score: 1

    It is, just as long what you are doing is similar to what everyone else is doing. Sometimes, you may need to break the mold. But that is actually very rare. And you need decades of experience to really know when you really should break the mold.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  36. More like...... by Anonymous Coward · · Score: 0

    Minecraft requires it

  37. python white space by goombah99 · · Score: 3, Interesting

    Like most people I thought pythons enforced white space and avoidance of braces and elimination of semicolons was constricting. Then I realized how easy it was to read other people programs. Python used to be even simpler to read when it only provided one idioms for one job (avoiding a dozen way to do the same thing resulting in dialects). Now it's adding new idioms and genres so it's a little more opaque. But it's still easier to read than any language with comparable expressiveness. (Lua is refreshing for similar reasons).

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:python white space by Anonymous Coward · · Score: 0

      The issue I have with Python's whitespace thing is that really formatting should be handled by your IDE, and you should be able to run the same code through different formatting passes without changing it.

      It shouldn't matter if the raw file uses spaces or tabs or just crammed everything into one line. The IDE should be able to present it to you with the model you prefer and save a file that any other IDE can do the same with.

    2. Re:python white space by praxis · · Score: 1

      Not too many Python programmers use an IDE, though.

    3. Re:python white space by iwbcman · · Score: 2, Interesting

      Pythons inane whitespace conventions make it impossible to simply copy and paste python code. Now for a seasoned python programmer this is a nobrainer, but for beginners, people trying to learn python it is critical. I grew up reading computing magazines and typing in code reprinted in the magazines, later I would copy and paste code bits from webpages/blogs etc. in various languages to try to learn how they work. Yet with python this simply does not work until you have already mastered it's conventions, one bloody misplaced whitespace and the code becomes worthless, unless you already know how it works. Python, from my perspective, would be the last language I would try to use to help people learn to code. I get that its powerful. I get how much you can do with so little code. I can appreciate what you are saying about whitespace in python helping with readability.

    4. Re:python white space by Anonymous Coward · · Score: 0

      The Lua developers at PUC are fscking saints. Their resolve to keep things simple is unmatched. And yet Lua is still insanely powerful: stackless symmetric coroutines, lexical closures, guaranteed tail recursion, a C API that is a first-class citizen (including stackless coroutines), and a boat load of other features. Plus there's the incredibly powerful LPeg module (shipped separately). And despite all those features, the interpreted VM still smokes Python, Perl, and Ruby in performance, even though it didn't cut corners like those languages did. (Honorable mention to LuaJIT, which even the V8 developers envy.)

      The only thing keeping Lua from ruling the world is the fact that they don't mind breaking backwards compatibility when they need to--for example replacing kludgy function environments in Lua 5.1 with lexical _ENV for Lua 5.2. That leaves the community fractured. But that flexibility is what has allowed them to hone Lua into the shining beacon on the hill that it is today.

      I'm torn between wanting Lua to become mainstream, which would require the community settling around a specific version for a longer period, and not wanting to forgo whatever the next iteration of Lua will be. Fortunately Lua 5.3 just came out, is very much compatible with 5.2, and there's usually a gap of 4-5 years or so between major releases.

    5. Re:python white space by narcc · · Score: 1

      Then I realized how easy it was to read other people programs.

      I find it it frustrating. It's unnecessarily difficult to tell where various blocks begin and end, particularly when two or more nested blocks end together.

      On top of that, the myth that python is inherently easy to read has lead to some ridiculously illegible python code. I cringe every time I need to deal with anything written in python.

    6. Re:python white space by penguinoid · · Score: 1

      Like most people I thought pythons enforced white space and avoidance of braces and elimination of semicolons was constricting. Then I realized how easy it was to read other people programs.

      So what? Just set up your programming environment to replace all braces and semicolons to the appropriate whitespace instead.

      --
      Don't waste your vote! Vote for whoever you want, unless you live in a swing state it won't matter anyways
    7. Re:python white space by strikethree · · Score: 1

      Like most people I thought pythons enforced white space and avoidance of braces and elimination of semicolons was constricting. Then I realized how easy it was to read other people programs.

      Ever looked at the source for Anaconda, Redhat's installing program? Go ahead, take a moment...

      Yeah... about Python being easy to read...

      --
      "Someone needs to talk to the tree of liberty about its ghoulish drinking problem." by ohnocitizen
    8. Re:python white space by Anonymous Coward · · Score: 0

      Pythons inane whitespace conventions make it impossible to simply copy and paste python code.

      Nonsense, I do it all the time without having any issues. It's impossible if you use tools that aren't capable of pasting without reformatting the code. That's why some editors have a paste mode that prevents reformatting. If you use Python with tools that don't handle this well then your tools and the language don't fit well. That doesn't necessarily mean that much is wrong with either, it's just the combination that doesn't work well. If you only use a screwdriver then you will have trouble with handling nails. That doesn't mean that nails are bad, they just don't combine well with your tool.

      I don't mind at all if you dislike Python's use of white space, but please don't misrepresent the issue, the issue is with a combination that doesn't work well, not with one of the parts.

    9. Re:python white space by goombah99 · · Score: 1

      yes everyone gets burned by that one time. then it's a non-issue.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    10. Re:python white space by goombah99 · · Score: 1

      What about "other peoples code" did you not understand. I'm not talking about reading my own code.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    11. Re:python white space by penguinoid · · Score: 1

      It's just a display thing -- you could set up other people's code to display with whitespace instead of braces and semicolons.

      --
      Don't waste your vote! Vote for whoever you want, unless you live in a swing state it won't matter anyways
  38. Re:Dafuq did I just read? by Anonymous Coward · · Score: 0

    You guys can squirm all you want but he's right. Readability is far from being a Java selling point. Of the several languages I've had the [dis]pleasure of using, and the tens of thousands of lines of code I had to review, Java was, by far, the hardest to read.

  39. Re:Yeah right. Then explain COBOL. by Anonymous Coward · · Score: 0

    It might be strange for today's standards for computer languages, but one of the main COBOL goals was exactly to be readable even for laymen (maybe the military who sponsored its development feared spy programmers).

    from wikipedia:

    "COBOL has an English-like syntax, which was designed to be self-documenting and highly readable"

  40. Re:Yeah right. Then explain COBOL. by gatkinso · · Score: 1

    serendipity
    serndipd/
    noun
    the occurrence and development of events by chance in a happy or beneficial way.

    --
    I am very small, utmostly microscopic.
  41. Re:Dafuq did I just read? by Anonymous Coward · · Score: 0

    since people that have only seen java in their lives try to go to other languages rambo-style overconfident in their abilities as programmers.

  42. The COBOL argument by pigiron · · Score: 1

    "It's Easy To Read"

    Ah yes, the old COBOL justification. It was BS then and it is BS now when applied to Java. The hacks at Oracle would have been better off sticking to "write once, run anywhere."

  43. Re:Umm... the fat lady is singing by DickBreath · · Score: 1

    You do not know what you are talking about.

    Java has not stagnated. It is one of the top programming languages. You would know this if you had looked at the article. You might not like Java, and that is fine. But at least get your facts right.

    Write once run anywhere is also true for large projects. You could move a major web server project between OSes without even recompiling it. I have personally moved installed my employer's web application on a different OS than it is officially deployed on just for amusement. Because it could be done. I also tried it on a Raspberry Pi (prior to the 2) and it 'ran' (in the sense of how a snail can 'run'). But it actually worked and connected to a database server running on a big box running a different OS.

    GC on Android is not a problem. Billions of devices are in daily use. What kind of 'problem' are you talking about? Something hypothetical?

    Java at Google may be a fork, but it can't be any worse the the multiple dialects of other languages and compilers like C / C++ or Python 2 / 3 and other examples.

    Java is not perfect for every problem. If there were a perfect programming language, everyone would already be using it. But at least get your facts right. Java is going to be around for a very long time. The language has just gotten some major new features in the last couple releases. More major improvements are on the horizon. The sheer size of Java codebases alone is proof enough that it will be around for a long time.

    --

    I'll see your senator, and I'll raise you two judges.
  44. Re:Yes & the sheer amount of existing code/fra by Anonymous+Brave+Guy · · Score: 4, Interesting

    I'd agree with the ecosystem being a huge factor in Java's success.

    More than that, it is a relatively closed ecosystem. Tools like JNI are available, but in practice few projects seem to use them. Mostly, either you're working in JVM world or you're working somewhere else. That's a lot of momentum to overcome for any long-standing project or development team to move to another language, tool chain, standard library, and so on.

    I also think the summary's claim that Java is easy for humans to understand at a glance because of its simplicity is a mischaracterisation. Java is a relatively verbose, inexpressive language, so actually it can take quite a long time to figure out how any given piece of code works. What Java does offer is that an average developer can reliably figure out how any given piece of code works, even if it takes a while. For long-running, large-scale projects that is a valuable attribute for a programming language.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  45. Yes, and that's why lambdas are a bad idea by bradley13 · · Score: 2

    Yes, Java is pretty easy to read. It contains all the standard control structures, and not a lot more. Aside from inheritance (which, by now, pretty much all developers understand), there isn't a lot of hidden functionality: See the code, understand what it does.

    This is one reason that I object to the introduction of Lambda's in Java 8. Lambdas belong in functional languages, where they make sense in the context of the language. Java is not functional, so lambdas break the paradigm. Moreover, they are unfamiliar to most developers, and they are cryptic in a way that hides functionality.

    --
    Enjoy life! This is not a dress rehearsal.
    1. Re:Yes, and that's why lambdas are a bad idea by Anonymous Coward · · Score: 1

      They're just trying to keep up with C#.

      Lambdas in C# are just a shortcut to writing a delegate, which is a "safe" function pointer. I'm pretty certain that Java uses lambdas in a similar fashion.

      So think of lambdas as function pointers and treat them accordingly. If you don't need function pointers, don't use lambdas.

    2. Re:Yes, and that's why lambdas are a bad idea by FranTaylor · · Score: 1

      Java is not functional, so lambdas break the paradigm.

      Java is NOT not-functional. You have been able to mimic most of the behavior of lambda expressions with anonymous classes for quite some time now. You can most certainly code up functional programs in java if you want to.

    3. Re:Yes, and that's why lambdas are a bad idea by shutdown+-p+now · · Score: 1

      Lambdas are cryptic in the same way classes are cryptic: it's an unfamiliar concept to many people because they haven't met them yet, but it's also a very powerful concept that makes it possible to write neat, concise and readable code when learned. C# developers were similarly bitching when lambdas were introduced there in 2008, but by now everyone uses them and loves them.

      The notion of distinct paradigms is bullshit, anyway. There's no reason why OOP and FP (and other stuff) cannot coexist in the same language.

  46. Re:It's time to round up the Muslims by Anonymous Coward · · Score: 0

    Maybe, but the Angry atheists are Pissed Off.

    They lose their shit when someone says God Bless You. Imagine what they'll do when you come along and try to make them get on their knees to worship a child molester.

  47. Re:In the real world you leave under such conditio by Anonymous Coward · · Score: 0

    >Maybe you are stuck in the only place in rural Kansas that employs programmers

    Maybe it's because he says stupid things like this at interviews:

    >Java is around for no technical reasons. It is here because it is already here.

    >change for the sake of change

    >.NET wasn't worth the effort in 2005 as IIS was a steamy piece of poo back then.

    > So now no one wants to take the risk and $$$$ for something that already works.

    My post melts the brains on hipsters lucky enough to be working at .COMs in SV or still in school tinkering. Your souls havent been left yet for the real world yet

  48. Java is better... by SpaceCommander · · Score: 1

    ...says its maintainer. Story at 11. This is bollox.

  49. Dumb Slashdotters by bigsexyjoe · · Score: 3, Insightful

    This is an article about why Java has decent staying power, not about why it is the perfect language, nor most readable language possible. The article does not say people will be using Java in 1,0000 years. But Java became popular and continues to have strong staying power for an old language. There are reasons for that, even if it isn't your cup of tea.

    1. Re:Dumb Slashdotters by __aaclcg7560 · · Score: 1

      The article does not say people will be using Java in 1,0000 years.

      I recently got a new nVidia Geforce 720 video card. The back of the box promised that the video card had a 40 year lifespan for office applications or a 12 year lifespan for video games. The physical electronics may have a 12 to 40 year lifespan. The moment that the newest version of Windows doesn't have a driver, the video card is obsolete and tossed into the trash. This is why I got this new card, as a half-dozen older video cards in my junk box didn't have a Windows 8.1 driver.

      I doubt any programming language will last a 1,000 years. A century maybe. But not ten times that.

    2. Re:Dumb Slashdotters by Anonymous Coward · · Score: 0

      even if it isn't your cup of tea.

      Ohh I see what you did there.

    3. Re:Dumb Slashdotters by Anonymous Coward · · Score: 0

      How the fuck old are your other cards? Geez.

    4. Re:Dumb Slashdotters by __aaclcg7560 · · Score: 1

      I had a Nvidia GeForce 6200, Nvidia Quadro 3400, ATI Radeon 3850 and a few others that were probably AGP. The ATI Radeon 7960 was my newest card out of the bunch when it died from a dead fan. I had to install the Windows Vista driver file to get the ATI Radeon 3000-series motherboard graphics to work under Window 8.1.

    5. Re:Dumb Slashdotters by H725_IT · · Score: 1

      ... he is talking about one year, with for zeros after the decimal separator... I'm sure java will still be used then. (in Italy we use , as decimal separator)

  50. Apache software sucks by Anonymous Coward · · Score: 0

    Granted the Apache commons can make this a bit easier,

    Apache software is great, until they go from v1 .to v2 where they completely break compatibility and increase the complexity by an order of magnitude.

    Axis 1 to Axis 2 for example. Then there's Log4j 1 to 2.

    An speaking of Log4j. from Apache there's: Log4j, Commons Logging, and JULI.

    All from Apache.

    Then there's Apache CXF which is much more complex than both X-Fire and Axis 2, which it replaced.

    I am just happy they didn't get their claws on Hibernate and Spring--they would screw them up by over-complicating and breaking backward compatibility to make them nearly unusable.

    1. Re:Apache software sucks by Anonymous Coward · · Score: 0

      That, unfortunately, is not a thing unique to Java. Consider the mess that Gnome 3 and systemd made of things. Over-reaching, over-complex, and often missing vital features of their predecessors.

      Fred Brooks defined the "Second System Effect", noting some of the things that happen when people go in for a major overhaul of a complex system, but it appears that it doesn't just have corrosive effect on projects, it has a corrosive effect on products as well.

      On the other hand, for the record:

      I find CXF to be pretty easy to work with, actually.
      I'm still scratching my head over Log4j2 (Incidentally, JULI is part of the Java core, not Apache).
      Axis 2 was horrible. They shifted paradigms from function-based to document-based, effectively breaking everything from top to bottom. It should more rightfully have been given a new project name, unrelated to Axis.

    2. Re:Apache software sucks by Anonymous Coward · · Score: 0

      So the huge increase in complexity is annoying, but I would argue that breaking things from version 1 to version 2 is both acceptable and expected, especially if the project follows semantic versioning (which I wish every project did).

  51. The reason is : Corporate buy-in. by quietwalker · · Score: 1

    Java was the first language on the scene that came with a top-to-bottom marketing rollout. They had certification, training, professional tutorials and classes, sponsored competitions, commercials and corporate branding, full page ads in trade magazines, and a one-size-fits-all modular system of components to mix and match and fit every need, and you could even become certified as a java evangelist - that used to be a real job at some corporations.

    Once they got solid buy-in, well, companies are loathe to change unless there's either a pain point or a generational technology gap, and sometimes not even for the latter (see batch processing mainframes running cobol and RPG programs).

    So that's what it is. If anything, as the language matures many people actually want to get away from readability; they want annotations and dependency injections controlled by some non-centralized mechanism, such that you must either rely on everyone else who worked on the product getting things 'right' and just magically working without your understanding of other processes (a theoretical goal of good OO development), or more often, you must understand all the code running at all times. Try doing a manual analysis of a good sized project that relies heavily on Spring, or worse, an OSGi project.

    Projects using those features are not self-documenting code. Tracing execution or data flow is extremely difficult. All I can say is at least it's not Ruby, Objective C, or Smalltalk.

    So, no, it's not readability. There's a good subset of programmers who are strongly against readability. It's money, plain and simple. It's a corporate investment, and that's all there really is to it.

    1. Re:The reason is : Corporate buy-in. by FranTaylor · · Score: 1

      Java was the first language on the scene that came with a top-to-bottom marketing rollout. They had certification, training, professional tutorials and classes, sponsored competitions, commercials and corporate branding, full page ads in trade magazines, and a one-size-fits-all modular system of components to mix and match and fit every need, and you could even become certified as a java evangelist - that used to be a real job at some corporations.

      okay you probably weren't around in the 1960s and 1970s but FORTRAN and COBOL had all of those things back then.

    2. Re:The reason is : Corporate buy-in. by quietwalker · · Score: 1

      That may explain why it's still around even after it's been technologically eclipsed, in a similar vein to Java.

      They're not around because they're easy to read or the choice language or any other criteria that would make sense to a developer, but rather because there was a corporate investiture. Money spent means more to a business than other metrics.

  52. Laughable by theendlessnow · · Score: 2

    What makes "Java" or anything object oriented difficult to read is that objects tend to produce more spaghetti code and have a ton of easily overlooked side effects. Debugging can be a nightmare. I see more "pitch till you win" code maintainers.... so much so, that some consider it normal to just keep trying stuff until it "works". I'm not saying you can't create "good" object oriented code.... I just haven't seen any yet.

    1. Re:Laughable by Anonymous Coward · · Score: 0

      Yeah. I wholeheartedly agree. Java is one of the worst languages for certain debugging - it's difficult to track down the actual code behind any particular method invocation. When everything is working, then all those abstractions are great. But the bugs happen when things don't work across those interface boundaries and when those happen, you need to be able to see both side of the abstraction, but Java hides the underneath so well that it makes debugging difficult.

    2. Re:Laughable by FranTaylor · · Score: 1

      have a ton of easily overlooked side effects. Debugging can be a nightmare.

      you're clearly not very famliar with java, it was expressly designed with the intent of not having "easily overlooked side effects"

      perhaps you might be able to tell us what some of those "side effects" are?

    3. Re:Laughable by Anonymous Coward · · Score: 0

      There's already grumblings in the new-old-new-old-guard (guys brought up professionally in the late 90s) when Java and OO were "hot concepts", eager and young and soft-headed... Anyway these folks are now thinking that they spent 20 years wasting their lives on OO as they discover the joys of "functional" programming, or return to iterative/procedural code... I personally hate OO... Some of the concepts are good, but for the most part it's turned into a giant plate of ravioli. At least with spaghetti, you can follow the fucking noodle and figure out, eventually, where you're going. Ravioli? Who the fuck knows what's inside and once you've broken through you're face with more What the fuck is this filling? OO ends up becoming a no-true-scotsman argument amongst its die-hard practitioners. In reality, OO is just the new LOC: it makes you look productive so you can keep convincing your bosses you're worth your paygrade.

    4. Re:Laughable by Anonymous Coward · · Score: 0

      Look at the Linux kernel.

      Yes it is written in C, but the devs use OO *concepts* everywhere

  53. Re:Corollary: It's difficult to be "clever" in Jav by firewrought · · Score: 4, Insightful

    It's difficult to be "clever" in Java

    To the contrary, Java's lack of expressiveness resulted in people writing tons of external XML files, code generators, DI frameworks, and build tools to glue the whole mess together. Instead of small, judicious bits of cleverness in the main language/runtime, it's been pushed to very clever tools on the periphery that come with relatively large learning curves. That's not really a win from the readability standpoint.

    --
    -1, Too Many Layers Of Abstraction
  54. BASIC and COBOL are easy too by ruir · · Score: 1

    Honestly,I have seen many, and this one about been readable must be the more strange argument I have seen lately.

  55. Seen enterprise software? by ThePhilips · · Score: 4, Interesting

    It is pretty easy to read Java code and figure out what it means.

    Many who deal with the "enterprise" software would simply laugh at the statement.

    But hey, the same argument was often made about the BASIC. And I always said that Java and BASIC users are very similar.

    --
    All hope abandon ye who enter here.
    1. Re:Seen enterprise software? by Anonymous Coward · · Score: 0

      There's nothing wrong with basic in the right flavor.

      http://powerbasic.com/
      Powerbasic can run circles around .net in terms of efficiency.

    2. Re:Seen enterprise software? by FranTaylor · · Score: 1

      It is pretty easy to read Java code and figure out what it means.

      Many who deal with the "enterprise" software would simply laugh at the statement.

      do you have any actual basis for your comparison? do you have any enterprise-level applications written in any other language that you can compare to?

    3. Re:Seen enterprise software? by ThePhilips · · Score: 1

      Yes. Billing systems.

      In a way, the experience is a confirmation of the RTFA. When newhires come, everybody is in the awe of the Java part, and everybody is terrified of the C/C++ part. But the thing is, a year later most change their opinion. Java might look beautiful - but the beauty is skin deep. We have had clients changing project design and architecture because developers were throwing in a white flag: they simply couldn't fix something in the Java part, and the workaround had to be put somewhere else.

      With the C/C++, the usual problems tend to keep the development down to the ground. While with the Java, developers very often succumb to the fancy of implementing all the fancy things people on the internet are so fancy about. Like for example the good design practices. No, no, no - only the best design practices! Because that's how it supposed to be!! End result are the huge monstrosities, which are more compliant with the programming books than with the customer requirements.

      The saddest part is that good Java pros are acutely aware of the problem. But one can't just swim against the tide.

      --
      All hope abandon ye who enter here.
  56. Re:Yeah right. Then explain COBOL. by Anonymous Coward · · Score: 0

    I was about to post, I had to debug COBOL and FORTRAN as part of a previous consulting stint and COBOL you can AT LEAST guess what's going on just by reading it (without a binder full of docs)

    By today's standards COBOL is wordy and nonsensical, like comparing Elizabethan prose to a text message, but you can still READ it

  57. Re:Corollary: It's difficult to be "clever" in Jav by Waffle+Iron · · Score: 2

    It is not difficult to be "clever" at all. Look at various "bean" frameworks. Use their object marshaling features. Throw in some of their aspect-oriented programming features.

    Now you usually have a bloated, incomprehensible mess. Sure you can easily read any couple of lines of code in isolation. But the system as a whole is a huge pile of gratuitous redundant layers of abstraction and confusing action-at-a-distance creepiness.

  58. Clickbait by Anonymous Coward · · Score: 0

    This isn't news, this is clickbait.

    Nothing to see here, move along...

  59. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    I like C# for the same reasons, or mostly the same. Easy to write, easy to read, powerful, flexible, enough performance, easy to debug, easy to write strict code that makes it hard to use incorrectly.

  60. Re:Yeah right. Then explain COBOL. by medv4380 · · Score: 1

    True, we tried to build in obsolescence with two digit dates to force the banks to upgrade by 2000, and they rather liked forcing COBOL programmers back in at a premium to fix the issue. Even the screams of a coming apocalypse couldn't get rid of it.

  61. Inertia? by snookiex · · Score: 1

    The last two major releases (7 and 8) have been awful. I think the only reason why Java still gets so much attention is because there's a lot of time and money already invested on Java applications. As a Java developer and FOSS advocate myself, I have to confess that I'm closely following the results of Microsoft flirting with the open source community. I never thought I would say such thing, though.

    --
    Open Source Network Inventory for the masses! Kuwaiba
  62. Easy to read != easy to understand by hcs_$reboot · · Score: 1

    Nowadays to be part of a Java project you have to speak not only Java, but all the vertical and horizontal layers that are the frameworks. Spring, Struts, Hibernate, Spark, Tapestry ..........

    --
    Slashdot, fix the reply notifications... You won't get away with it...
  63. Java vs. C# amuses me by msobkow · · Score: 3, Interesting

    What amuses me is that many people rave on about how great C# is, while denouncing Java. Yet other than a few minor syntax tweaks (like the way you write getters/setters and the "?" indicator for nullable attributes), they are virtually identical right down to the API.

    They're both very easy to read and code with, and if you know the packages/libraries of one you'll find the equivalent in the other in short order, with very, very few differences in the details of the APIs.

    Yet C# is "great" and Java "sucks".

    Go figure.

    --
    I do not fail; I succeed at finding out what does not work.
    1. Re:Java vs. C# amuses me by Anonymous Coward · · Score: 0

      What amuses me is that many people rave on about how great C# is, while denouncing Java. Yet other than a few minor syntax tweaks (like the way you write getters/setters and the "?" indicator for nullable attributes), they are virtually identical right down to the API.

      Identical? Your amusement probably has something to do with the Dunning-Krueger effect.

      I have a long, long list of complaints about Java but lack of pass by reference for atomic types and lack of unsigned integers alone are enough to make me think Java is crap.

    2. Re:Java vs. C# amuses me by Anonymous Coward · · Score: 0

      C# had generics and lambda functions long before Java did.

      C# has an attractive syntax (LINQ) for querying data that works the same across several different data backends.

      Both of the above make it much easier to write generic, re-usable libraries.

      Although you denounced it, the nullable type syntax sugar is pretty useful when you're interacting with systems that have nullable types, like SQL databases and JSON APIs. Since most of what most business applications do is one of those two things, that is pretty compelling too.

      Modern Java has largely caught up with these capabilities, but for years they resisted and this created the impression that Java was stagnant and that the real innovation was going on in C#.

    3. Re:Java vs. C# amuses me by ndykman · · Score: 1

      Well, there's some differences that do make C# seem easier and less clunky. They are similar, but not identical, and their differences do matter.

      Properties. Yes, Java has getters and setters, but those are methods. C# makes the distinction between a property and method. To be fair, this doesn't really come up until you deal with reflection and more advanced cases, but it is a useful distinction to make.

      Generics. Java has type erasure, which has it's issues (you can't do T newThing = default(T) in Java). If look at the lambdas, there's a lot of stuff they have to do around typing to handle primitives versus objects, etc. C# just has a Func and Action types. For APIs that use higher-order functions, this makes things a bit clearer (I want a function that takes a string and returns a bool, for example). Compare this to things like mapToInt in the streams API, and C# is just more consistent and natural in this area.

      LINQ. True, Java 8 streams add a lot of this, but they don't expression tree support, which makes things like LINQ to Entities and LINQ to XML, etc. possible. Granted, LINQ has it's own issues (LINQ to Entities code can fire runtime exceptions that LINQ to Objects won't), but this power is really useful. And it requires language and compiler support to transform a lambda to a expression tree versus a closure.

      Async/Await. Now, this is newer, but this is a huge difference between C# and Java. Non-blocking code is great, but it can quickly turn into a nest of callback functions. Sure, promises help, but that's a chain of objects. Async/Await provides a much easier to use model that provides many of the benefits of asynchronous programming, but keeping a more synchronous like code base. Scala, JavaScript are all adopting this model because it works well.

      In practice, it can be very useful. I was working on ASP .Net MVC 4 project. I bumped it up to five and some improvements. I then just used the asynchronous APIs in MVC, etc. It was a fairly simple change, but boom, less CPU usage and more overhead for concurrent connections. A noticeable gain for little price.

      Finally, the libraries do diverge beyond the core. Entity Framework and Hibernate are different. WPF couldn't be more different than Swing, etc, really. Java doesn't have a standard library like Windows Workflow Foundation. And there are Java libraries that C# doesn't really have, of course.

      While I agree that Java can get too bad of a reputation, it does show it's age. Also, the JSR process has grind to almost a complete standstill. When C++ gets lambdas before Java, it shows just how slow the process has become.

      I think C# embraces newer features much more readily, and that's why some really advocate for it.

    4. Re:Java vs. C# amuses me by msobkow · · Score: 1

      I must admit it's been a few years since I last used C#, and I've yet to shift from Java 7 to Java 8. Both have moved forward.

      But at the point I was heavily using both, they were more alike than different. At that point, LINQ had just come out so no one was using it for production systems yet.

      --
      I do not fail; I succeed at finding out what does not work.
    5. Re:Java vs. C# amuses me by Anonymous Coward · · Score: 0

      You clearly haven't done much work with generics. Type erasure in the JVM results in runtime errors just as difficult to understand and debug as C++ templating compiler errors, with the added benefit that the compiler doesn't catch them for you so you can ship software with that class of bugs.

    6. Re:Java vs. C# amuses me by Anonymous Coward · · Score: 0

      I wouldn't go so far as to say "Java sucks", but Java tends to be much more memory bloated, and in my experience, runs slower. Also an anecdotal observation, many of the same basic operations in C# don't require objects, which reduces heap allocation and GC clean-ups. Lots of minor differences add up quickly to create better scaling. C# also allows me to micro-optimize and get GC CPU time under 1%, which is important when you realize GC does a stop-world and Amdahl's law starts to kick your butt on highly threaded work loads.

      I have seen a single foreach statement, that requires an enumerator to be allocated, in a corner cases that happened less than 10% of the time, account for 90% of my memory allocations and drop my performance from 99% CPU usage on a 32 core CPU to near 50% cpu usage, because of Amdahl's law. Even small allocations add up quickly.

    7. Re:Java vs. C# amuses me by shutdown+-p+now · · Score: 1

      Up until C# 3.5 (when lambdas and LINQ first showed up), C# really wasn't all that different from Java; though it already had non-erased generics, which, I think, are a huge benefit if you use them heavily. It was really 3.5+ that started adding new and very distinct features at a fast pace.

      By the way, one thing that GP forgot about (possibly because it's not really used all that much) is "dynamic", which is basically opt-in duck typing.

    8. Re:Java vs. C# amuses me by ndykman · · Score: 1

      Oh, forgot about anonymous types, but Java has anonymous classes which work similarly. And I forgot about the yield syntax. And there's new stuff coming in 6.0.

      And I totally agree with the parent.

    9. Re:Java vs. C# amuses me by shutdown+-p+now · · Score: 1

      Java anon classes aren't quite the same because of the lack of "var" or similar - so you can implement interface members or override base class members, but you cannot introduce new members that can then be referenced outside of that object.

      OTOH, C# anon classes don't support base types...

  64. Cobol then? by Anonymous Coward · · Score: 0

    Cobol still runt lots om the worlds it systems. Cobol is readable for anyone with basic English understanding and yet powerful enough for anything.

  65. I miss Sun by Anonymous Coward · · Score: 0

    I worked at a competitor to Sun many years ago. Even though we said a lot of bad things about Sun at the time, it's now quite clear to me that Sun was a great company which was not only so much better than Oracle in my opinion, but was also probably better than the company I worked, in terms of open source, technological excellence, etc. It seems that Sun was too nice of a company and nice guys finish last.

  66. Corollary 2: It's difficult do anything in Java by Anonymous Coward · · Score: 1

    I've watched experienced and skillful Java programmers struggle for days "wiring up the beans" and then spending the rest of the project trying to get it to work.

    Any one line of Java is readable, but when you pile libraries on top of jars on top of frameworks it degrades into a mess. And lets not talk about Exceptions.

  67. Re:Yeah right. Then explain COBOL. by Anonymous Coward · · Score: 0

    Well if there's one thing programmers hate more than unreadable code, it's typing shit, and COBOL was an awful lot of typing shit. And for some reason, even though the individual lines were easy enough to read, something about the language made it very difficult to follow overall. Since the language was so overly verbose, functions usually ended up being pretty long, and it was very easy to get lost in them, in any COBOL code I was exposed to anyway. I'm sure there was probably some clean, well written COBOL code in the industry, but I never got a look at it.

    Funnily enough, that's the exact same thing I and a lot of other people have to say about Java.

  68. Yeah... it's a pretty genius tautology. by tlambert · · Score: 1

    Yeah... it's a pretty genius tautology.

    In related news, the major cost of creating new software is in the creation, and the major cost in deploying new software is in deployment.

  69. I hate python by wonkavader · · Score: 1

    Python's no fun to work in at all. But it's the right choice for business coding for precisely this reason.

    Boring is good. Rigid is good. The next person who works on your code is not going to understand anything you did. He/she will need to pore over your code and figure it out. The easier you make that, the more you can accomplish and walk away from -- leaving a trail of success in your path. Otherwise, you're either bound to the code and swamped with old projects, or trivial issues you missed never get fixed, leaving a trail of unhappy clients/users behind you.

  70. Two obvious reasons by Kohlrabi82 · · Score: 1

    You can look very busy having to deal with all the overhead and boilerplate to get trivial stuff done in Java. Programmers will feel needed and busy, while the superiors can avoid being bombarded by tasks, because everything takes ages.

    Another good reason is that non-programmers have very weird metrics for productivity. I remember studies being linked here on /. that measured a programmers productivity by the amount of lines comitted to github projects. This of course makes Java an inherently more productive language than languages where you can simply get shit done.

  71. Just plain wrong by wonkavader · · Score: 1

    Java lacks high-level control structures written in simple, understandable ways. This means that java programs are longer than they need to be. YES, you can look at three lines of java code and know just what they do. CONGRATULATIONS. But when the java program is 300+ lines long and only needed to be 30 in R, for example, which one will a person with any competence in a language understand faster?

    C# (an MS trap language you shouldn't use) is better than java. It has better syntax and makes things cleaner and shorter.

    Java is getting praise here because of its success. If it were put out today, it would be ignored. The fact that we would not have the VM-based code world we have without java is immaterial to an evaluation of the language. We should not lie to ourselves. Java programs are too long. This makes them hard to read and hard to pass on to other programmers. Period.

  72. Re:Yes & the sheer amount of existing code/fra by jeremyp · · Score: 5, Insightful

    Actually, it's easy to read because it is verbose and inexpressive as you put it. Generally speaking, the more information you pack into a sequence of characters, the harder it is to understand. There are also relatively few syntactic constructions to get your head around and tokens are not usually overloaded with different meanings. It doesn't take long to learn the whole language, which means that even a newbie has a good chance of reading a piece of code without coming across something they haven't seen before.

    --
    All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
  73. Is this supposed to be a joke? by NynexNinja · · Score: 2

    I guess we're not talking about working with Java Struts. When you do, turn on mysql logging, and then tail -f mysqld.log, you'll see garbage like this: select column_623 from table_943 where column_142='xxx'; ---- is that readable to you? Is that supposed to improve readability by abstracting so far away from the database that no one can understand what is going. I basically have to grep for values inserted or updated or selected from tables in order to figure out what table stuff is being written to. It's not ugly, its an abomination. Who ever thought up the idea doesnt know what they are doing. Easy to read..... YEAH RIGHT -- its a joke. It takes 5 times longer to reverse engineer this spaghetti mess than any other languages. Straight Java code is easy to read, if you don't intrude abstraction layers on top of the language, like Struts.

    1. Re:Is this supposed to be a joke? by ADRA · · Score: 1

      I beg to disagree. I don't know what your dev env is, but any ORM will cause dynamic table / column labels. This isn't a bad thing. This means you don't spend countless hours hand sculpting selects/updates.

      ORM Advantages:
        - Considerably faster to write and maintain queries / persistence
        - Significantly less code / DB coupling
        - Makes DB refactors easier to handle (depends on how much you leverage static DB-metamodels but that's another discussion)
        - Eager/lazy fetching makes foreign relations stupidly easy, like legitimately night and day
      ORM Disadvantage:
        - Often less efficient because its harder to pull in subsets of a table row vs. just fetching full rows (though totally doable, people generally don't bother)
        - Depending on the SQL abstraction, you can get some bad JOIN's if you don't know the gotcha (but these are generally poorly constructed large queries, but they do require debugging to fix)
        - Eager/lazy fetching can cause SIGNIFICANT poor performance if you aren't aware of what your queries / related code are doing

      If you want to know what's being pushed into the DB, put in breakpoints into the ORM layer or add persistence listeners to trace what's being stored / when (then turn it off for prod). If you're using raw JDBC, you don't have no excuse for traceability. Your problem isn't in the language, its about your ignorance about the framework / libraries your project is using.

      Plus, at least with Hibernate, it'd use bind variables, not poor performing literals unless your code itself is being written with native SQL queries in JDBC. The one thing not trivially easy in most ORM's is DB-side batch updates. I generally hand code my SQL in those cases, but it can be done.

      Don't blame a language for the mistakes of the developer. Don't blame the language for 'selecting bad developers'. Blame underperforming developers for underperforming, or blame management for not managing / training / filtering them very well.

      --
      Bye!
    2. Re:Is this supposed to be a joke? by Anonymous Coward · · Score: 0

      Fanfiction at it's best!

  74. Re:It's time to round up the Muslims by HornWumpus · · Score: 1

    Won't be needed. They all own 14 inch dishes.

    Their children watch MTV middle east and will behave in ways so gay that they would make emo kids blush. Two generations and it's all over. Right about the same time their oil money will end.

    --
    John McAfee 'It was like that time I hired that Bangkok prostitute; to do my taxes, while I fucked my accountant'
  75. Easy to read, simple language? by nitehawk214 · · Score: 1

    I wonder if with Java 8 and the ability to do lambdas and more complex functional programming techniques will hurt Java in the long run. I do Java as my day job, and have only recently finally been able to do Java 8 at work in the past few months. I am a big proponent of functional programming practices, and we do a lot of Javascript front end.

    Pre-Java 8 I was always concerned that the language would decay since it is syntatically decades old, and become the COBOL for the new millenium. I know I can jump into whatever the flavor of the month is, but I have always been happy doing this. Of course, flavor of them month became flavor of the year, then flavor of the decade... and now I have been doing Java for over 15 years. It sill might become the next COBOL, but it is flexible enough that you can do pretty much any business programming you ever need, while being interesting enough to bring in new programmers out of school.

    But my work has a small number of highly experienced developers. If I was still working at a big soulless corporation with dozens of bottom tier developers mixed in with the seasoned pros, I wonder if this would result in the code being unreadable? I have seen some terrible code in java 4 and 5, I can only imagine the horrors an idiot could wreak with lambdas. Granted, I am sure most of them are still doing java 6 compatible code, since only small companies can afford to change momentum and upgrade.

    --
    I'm a good cook. I'm a fantastic eater. - Steven Brust
    1. Re:Easy to read, simple language? by shutdown+-p+now · · Score: 1

      But my work has a small number of highly experienced developers. If I was still working at a big soulless corporation with dozens of bottom tier developers mixed in with the seasoned pros, I wonder if this would result in the code being unreadable? I have seen some terrible code in java 4 and 5, I can only imagine the horrors an idiot could wreak with lambdas. Granted, I am sure most of them are still doing java 6 compatible code, since only small companies can afford to change momentum and upgrade.

      C# went through this in 2008. It's still around, and practice has shown the fears to be unfounded. Lambdas are heavily used in idiomatic C# today, and many libraries (e.g. ASP.NET MVC) rely heavily on them, and it didn't really have any detrimental effect on code quality.

  76. Re:Yes & the sheer amount of existing code/fra by Gansan · · Score: 2

    Totally agree. The expressive languages that let you do a lot with relatively few lines often count on implicit behaviours that are not at all obvious unless you are familiar with them. It's a drag on coming into someone else's codebase and understanding what's going on. "Oh, I see, you're counting on this to fail in *this* certain way such that *that* happens."

  77. easy for humans? by Anonymous Coward · · Score: 0

    It's.not.even.easy.for.humans.to.find.both.ends.of.the.class.names.frequently.found.in.most.java.programs();

  78. Re:Yeah right. Then explain COBOL. by ADRA · · Score: 1

    I did a very large COBOL port a few years ago, and I must say it was very well written. We were increddibly lucky that the developers were maintaining the project for decades and wrote their code very consistently (though they significantly lacked in comments) and were quite comfortable with helping learn the in-s and outs of the system. The actual business logic of the product was factors more difficult to grasp than any simple technical issues with COBOL itself.

    Much in the same veign as C, COBOL's whole memory model is like a big block of crap, being able to remap memory blocks willy nilly over existing ones, sending memory blocks across programs, etc.. makes tracing memory much more difficult unless you had some sort good static analysis tools for tracing (which we didn't). The processing code was straight forward but obviously very simple, which meant that there was a lot of boiler plate (but completely drop dead simple since the same code was used consistently throughout the project).

    --
    Bye!
  79. Re:Yes & the sheer amount of existing code/fra by Parker+Lewis · · Score: 1

    You're mixing verbosity with understandability. Yeap, of course repeat the type of the object twice, the ugly diamond operators, use else if instead of elif, etc, produces verbosity, but this is not related to be easy or not to understand.

  80. Re:Yeah right. Then explain COBOL. by phantomfive · · Score: 2

    COBOL was relatively readable when it was invented, compared to the other languages of the time. The purpose was to be so readable that even managers could understand it

    Well written COBOL is understandable. The biggest complaint is that it's overly verbose (other problems like "no re-entrant functions" aren't problems anymore). In many ways Java seems like a modern version of COBOL.

    --
    "First they came for the slanderers and i said nothing."
  81. Re:Yeah right. Then explain COBOL. by Anonymous Coward · · Score: 0

    having read both java and cobol here's what killed cobol:
    1) global namespace. All fields are the equivalent of static java fields.
    2) periods as end of statements, but not strictly enforced. Imagine if you could write Java and skip the semicolon if the next word is a java identifier.
    if(a=b) { if(c=d) {d=a;} else {d=b;} else {c=b;}}
    becomes
    if a=b if c=d then d=a. else d=b. else c=b.
    or
    if a=b if c=d then d=a else d=b else c=b.
    both mean the same thing but good luck trying to figure out what this does:
    if a=b if c=d then d=a. else d=b else c=b.
    3) string serialization. It is extremely verbose to write an XML parser in cobol, or regular expression parser, due to the recursive nature of XML, and the global namespace.

  82. It's Only easy if the programmer wants it to be by Anonymous Coward · · Score: 0

    For crying out loud... Java is no clearer than C, C++ and a whole host of languages which share the same general syntax. What makes code readable is how the author writes it. Just go look at some obfuscated Perl contest winners.... There are some languages which I think are NOT readable by design, like FORTRAN, JCL, most shell scripts and sometimes python, but all the derivatives of C (C++, C#, Java, Perl, and such) are all about the same. But it depends on the author, not the compiler's choice of tokens... How do you write clear code?

    Tips for clear code no matter what language it is in:

    1. Use Identifiers which are PLAIN language... Skip type encoding in variable names and choose class that are nouns and method names which are verbs that make sense for what they do or are.

    2. Indentation - Always indent at logical edges, I don't care if you indent your braces, put them on the proceeding line, use 3 or 5 spaces, tabs or what, but ALWAYS indent.

    3. Comments - Method headers, Class headers should be required, Anything other than just setting a class variable is likely going to need a comment too. Anytime the loop/if logical test may be hard to find, reference it in an easy to understand comment for the end of the loop, the Else etc. Any time you have to think hard about what the code does when you are first writing it, chance are it needs comments to explain it.

    4. Use "this" - When you access a class variable, use "this"

    5. Be consistent - What ever you do, be consistent in your formatting. Operator overloading should only be done with caution.. If you end up writing something like "cat + dog" by overloading "+" you get what you deserve....

    There are more rules for readability out there, but IMHO it is the programmer that makes source readable, not the language being used by the compiler.

  83. Re:Yes & the sheer amount of existing code/fra by Anonymous+Brave+Guy · · Score: 1, Insightful

    Generally speaking, the more information you pack into a sequence of characters, the harder it is to understand.

    By that argument, doesn't any powerful abstraction make code harder to understand? Similarly, doesn't any verbose style make code easier to understand, even if the boilerplate contributes no additional meaning? Sorry, but I can't agree with this sort of reasoning at all. If it was that simple, we'd still be writing large software systems in assembly language and no-one would use any sort of libraries or modular design.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  84. Re:Corollary: It's difficult to be "clever" in Jav by nitehawk214 · · Score: 2

    throw up;

    That one never gets old. My favorite is:

    public void loveYou(long time);

    You can add an extra pun by adding a comment // this function takes a long time.

    --
    I'm a good cook. I'm a fantastic eater. - Steven Brust
  85. Re: In the real world you leave under such conditi by Billly+Gates · · Score: 1

    Well the last few places are run the same. If you are not an IT company the MBAs will fight tooth and nail not to touch what works as IT employees are plumbers. A cost center where data moves through pipes. Just reality and consider myself happy to have a job. Some don't or work minimum wage trapped.

    One client uses a pre sql database called pic from 1972. It won't ever be upgraded because it works and is too important to change

    Java is here because that's what's in house and work's

  86. define "easy to read" by Anonymous Coward · · Score: 0

    With basic training in OOP a "hello world" in java is easy to read, but even small projects easily use hundreds of classes which interact in a way that rarely is documented well.

    I am just rewriting a 700+ classes java program in common lisp - 95% of the functionality is there and I have not yet written a 100 LOC. Even if the last 5% need 900 LOC, I'm still 400 lines short of 700 times of a well indented "class X { }".

  87. Re:Yes & the sheer amount of existing code/fra by Anonymous+Brave+Guy · · Score: 4, Interesting

    Yeap, of course repeat the type of the object twice, the ugly diamond operators, use else if instead of elif, etc, produces verbosity, but this is not related to be easy or not to understand.

    The thing is, I think it is related to how easy something is to understand.

    If I can express an algorithm as a single function of 10 lines then, other things being equal, that will be easier to understand than distributing the same algorithm across 5 functions each of 20 lines. You can see the whole thing at once, instead of jumping around within or between files. You don't have overheads of passing around and returning values.

    Similarly, if I can express a simple bit of logic as a clean one-liner, while a verbose style requires 6 lines of manual loop/conditional logic and maybe a function wrapped around it, then I'm thinking about what that logic is doing and it how it fits in with the other logic around it while you're still worrying about loop counters.

    Here's a version of finding all the items less than 10 in a list, written in Haskell, a relatively powerful language:

    items = [1, 15, 27, 3, 54]
    result = filter (<10) items

    Here's a slightly more verbose version, written in Python, also a language known for being clean and expressive:

    items = [1, 15, 27, 3, 54]
    result = [item for item in items if item < 10]

    And in contrast, here is the best Stack Overflow has to offer about implementing this sort of requirement in Java.

    Spoiler: There are basically three kinds of replies. Some write out entire functions to implement the filter using a manual loop. Some use a third party library to do a more clumsy variation of the Python and Haskell examples above. And a few recent ones use Java 8 to do a slightly less clumsy variation of the Python and Haskell examples above. The clear trend is to try to get away from classical, verbose Java to something more powerful and expressive. Like Scala, according to the first comment on the original question...

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  88. python is not easy to read... by FranTaylor · · Score: 1

    ...if you have vision impairment and you're using some sort of screen reader, the python whitespace syntax rules are completely lost on the screen reader software.

  89. So do I by Anonymous Coward · · Score: 0

    Sun workstations were some of the best machines I ever worked on. The Sun 3/50 had a gorgeous screen with Sunview. The keyboard was sublime. X11R4 ran perfectly on my ELC.

  90. anything else? by Anonymous Coward · · Score: 0

    basic and pascal are also easy to read.

  91. If that is true, OO-COBOL wil rule you all. by 140Mandak262Jamuna · · Score: 1
    COBOL was designed to have readability as an end goal, more than even performance. Those days there were countless stories of computer wizards stealing fractions of pennies per transaction and committing million dollar frauds. It was designed to have "functional analysts" who define the business rules, laws to be obeyed and regulations to comply with and the "technical analysts" who will supervise the coding teams. The aim was for the legal and financial expert to read the code and approve.

    When the object oriented craze took off in 1990s, we were joking, next thing you know you would have OO-COBOL. And next thing we knew we had OO-COBOL.

    All of us know the staying power and entrenchment of that language designed specifically for readability.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
  92. Re:Yes & the sheer amount of existing code/fra by helixcode123 · · Score: 1

    I strongly agree with the parent. My favorite language implements this in a similar way to the parent's favorite:

    my @items = (1, 15, 27, 3, 54);
    my @result = grep { $_ > 10 } @items;

    I appreciate coding in a language that allows me to quickly and understandably (yes, Perl can be understandable... or not :-) get my thoughts into code. I used to enjoy coding in Lisp for the same reason (still would, if I could use Lisp at work these days). I enjoy coding in Java also, but the difference is noticeable.

    --

    In a band? Use WheresTheGig for free.

  93. Re:Corollary: It's difficult to be "clever" in Jav by Ksevio · · Score: 1

    I think that's one thing that makes Java both desired and despised. There are a lot of "clever" code chunks in other languages that are short AND easier to read. Even if it's not as easy to read, it's much nicer to decipher 4 lines of "clever" code than 100 lines of enterprise code spread over multiple files. To find out what a function does, you sometimes have to dig down through several layers of classes and compare across files. It's straightforward if you have the time to deal with it and you don't have to know too much about complicated theories to do it.

  94. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    It's easy to believe you know what a given bit of code will do, but really understanding that calling .close() on a connection might throw an exception or whatever (the famous 3 hour airline outage case) and how to handle that situation gracefully is far from obvious or easy for everyone.

  95. Re:Yes & the sheer amount of existing code/fra by AuMatar · · Score: 4, Interesting

    Totally disagree. If I see

    for(int i: items) {
      if(i<10){
        results.add(i);
      }
    }

    I know exactly what it does. Anyone who has done any programming in any language can guess what it does. Its simple, easy to read, and if you want can be pulled into a function. Your haskell and Python implementations are unreadable and requires the user to think about each line. They're inferior to straight forward programming by orders of magnitude and should never be used.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  96. Fortran FTW by Anonymous Coward · · Score: 0

    Fortran, way easier to read than Javascript.

    Who the hell can tell anything about a javascript routine once you are 20 levels deep in nested braces.

  97. All code should be readable. by plopez · · Score: 1

    With a few exceptions such as assembly if your code is not readable you are doing it wrong. Code needs to be maintainable. The maintenance costs and lifespan of code often far exceed development cost and time span. If you are not writing clear code you are writing crappy code.

    --
    putting the 'B' in LGBTQ+
  98. Re:Corollary: It's difficult to be "clever" in Jav by Kartu · · Score: 1

    Now you can basically officially do your own pre-compilation (check -processor option on javac) if you so wish.

    Tons of XML weren't really caused by Java's problems (do you actually remember what was put in them??), more of a fashion thing, now mostly replaced with annotations / cleverly chosen defaults.

    Most stuff you were doing with monstrous (my personal opinion) frameworks like Spring are part of the standard Java for quite a while (since 2009).

  99. Re:Yes & the sheer amount of existing code/fra by skids · · Score: 1

    All I had to do was glance at the haskell to know what it was doing. The python was a liittle hinky, but I got it easily enough.

    It really depends on how much experience you have with rich languages. If all you ever talk is C/Pascal/Fortran anything else will be harder to read.

    This goes for natural languages too, as well as cultural references. It's Joe Bauers' plight.

    The simple fact is that there are times to talk really slow with small words for a large audiences and times to use expressiveness to get thing done fast in a professionally erudite environment. Often, complex software design is a case of the latter, not the former. Management would like it to be the former, because H1B, of course, but that is a short sighted strategy destined to leave the company in the dirt.

  100. Re: Yes & the sheer amount of existing code/fr by Anonymous Coward · · Score: 0

    Tessst!!

  101. Re:Yes & the sheer amount of existing code/fra by diamondmagic · · Score: 1

    There's a difference between abstracting complexity away; and relying on a cute, obscure, not-quite-feature of a syntax in your program because it saves a few characters.

    When I open a TCP stream to another system, I don't muck around with any details of the features negotiation, speed... I just do it. When I write to the stream, it's a one-line operation, and the system takes care of retransmission for me, and when I read, the system takes care of packet ordering for me. I don't even need to know what a packet is. That's good abstraction.

    or

    var doubled = numbers.map(function(v){
          return v*2;
    });

    See, I can read that.

    The bad abstraction is the one that still exposes little-known things to the programmer.

    @error_or_die(50)
    function connect(**options):

    or

    if(~q.indexOf("=")){

    Like, what the hell is going on here?

  102. Re:Yes & the sheer amount of existing code/fra by wues · · Score: 2

    Generally speaking, the more information you pack into a sequence of characters, the harder it is to understand.

    Are you saying that

    256 * 2 = 512

    is harder to understand than

    two hundred fifty six multiplied by two is five hundred twelve

  103. Re:Yes & the sheer amount of existing code/fra by Darinbob · · Score: 1

    Most of those are libraries. Thus they've been solved with any language with similar libraries. Ie, networking - it's sort of there in Java, however there's no control over the networking and how it's implemented and it reflects a small subset of what you may want networking to do (it's good at web oriented stuff basically). Meanwhile just about any language that allows using POSIX libraries can do your basic networking that Java can do. For embedded devices, Java is still very high level, it does not give you register access to the machines for example, so where it is used most typically in embedded systems is as an application layer with the layers underneath written in other languages.

    I agree a lot has been added to solve problems. Which means I meet a lot of Java programmers who don't really program, they just tie together pieces of existing code.

  104. Re:Yes & the sheer amount of existing code/fra by AuMatar · · Score: 1

    No, it comes down to explicitness is always better than explicitness. There is no case in which yours is better, or even usable code.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  105. Re:Yeah right. Then explain COBOL. by Anonymous Coward · · Score: 0

    We have a rather large COBOL codebase which I would consider comparatively clean. Roughly 10 days a year are spent on fixing old errors, and those are mostly logical errors in the design, not in the coding.
    No dynamic memory allocation is cumbersome but safe. No recursion forces one to do everything step by step and makes debugging very easy. No concurrency makes debugging a breeze.

    After my initial frustration with the language I have found satisfaction in designing clever ways around those limitations. This really forces you to think of the algorithms in use, sometimes almost down to Knuth level.
    Although I would very much like to rewrite the math-heavy portions in Fortran...

  106. Re:Corollary: It's difficult to be "clever" in Jav by DickBreath · · Score: 2

    For C users:

    #define while if // makes code faster
    #define struct union // makes data use less memory

    --

    I'll see your senator, and I'll raise you two judges.
  107. Re:Yes & the sheer amount of existing code/fra by Pfhorrest · · Score: 3, Interesting

    I've never used any of the three languages in discussion here, and would barely count myself as a programmer at all, and upon initial reading of each of these routines this was my interpretation:

    Java (I assume yours is): For every integer (call it "i") in the set "items", if "i" is less than ten, do whatever the 'add' function of the 'results' object does to it. (No idea what that function is, but my first guess would be to do the math of "results" + "i". Upon reflection after seeing the other languages' versions of this routine, I get now that it means "put 'i' as a member into the set 'results', or more loosely, "add 'i' to the set 'results'".)

    Haskell: The set "items" contains members 1, 15, 27, 3, and 54. The set "results" contains every member of that set ("items") that passes the filter of being less than 10. (This is the clearest to me, and the one that shed light on the purpose of the other two).

    Python: The set "items" contains members 1, 15, 27, 3, and 54. The set "results"... uhh.... assuming this does the same thing as the Haskell function, I'd guess it means that "results" contains every "item", where "item" is any item in the set of items, but only if "item" is less than ten; a roundabout way of saying, in a more Java-like fashion, "for every item (call it 'item') in the set 'items', if 'item' is less than ten [then that is part of what the set 'results' equals]".

    --
    -Forrest Cameranesi, Geek of all Trades
    "I am Sam. Sam I am. I do not like trolls, flames, or spam."
  108. Re:Corollary: It's difficult to be "clever" in Jav by Anonymous Coward · · Score: 0

    #define yourMom unsigned int
    #define fat sizeof(yourMom)

  109. Re:Yes & the sheer amount of existing code/fra by mattventura · · Score: 2

    There's a sweet spot for conciseness versus verbosity. If something gets overly concise, then what you say is true. However, there's a such thing as too verbose as well, where it's so indirect that it becomes difficult to read.

    Not to mention, Java has a lot of things that are absent from other languages due to being relatively pointless or having better alternatives like public vs private things. On top of that, the fact that Java best practices dictate using getters and setters whenever possible mean lots of additional code. What's easier to read, "object.x = 5" or "object.setX(5)" plus the boilerplate function that actually does the setting? Yes, I'm aware that IDEs can take care of this, but when a language has so much copy-and-paste boilerplate code that an IDE can eliminate a huge chunk of it, that doesn't exactly reflect well on the language.

  110. Re:Yes & the sheer amount of existing code/fra by cheesybagel · · Score: 3, Funny

    He's probably a COBOL programmer.

  111. It shouldn't by Anonymous Coward · · Score: 0

    That means you don't understand the differences.

    Here's just some of the things I prefer about C#:
    1. Generics: C#'s type information is preserved. Java's generics loses type (type erasure), and can only do a compile-time check.
    2. Virtual functions: C# forces to you design a class to be overridden. Java's methods are overridable by default. The @Override attribute helps, but it's an after-the-fact band-aid.
    3. Structs (value-types): C# has the concept of stack-based objects, which can reduce GC.
    4. Exceptions: Java made a fundamental design error with checked exceptions, since checked exceptions is part of the interface.

    This is just off the top of my head. I'm sure I can come up with a lot more.
    It's also telling that Java is borrowing many, many ideas from C#.

    What Java has going for it is its far richer library (C#'s collections library, for example, pales in comparison).

  112. Re:Yes & the sheer amount of existing code/fra by Anonymous+Brave+Guy · · Score: 1

    Your haskell and Python implementations are unreadable and requires the user to think about each line.

    Maybe you personally aren't familiar with higher order functions or comprehensions. However, millions of programmers are, and would read and understand those lines without a second thought.

    Using filter in Haskell or a list comprehension in Python is as routine as using your for-loop is in Java, and the associated syntax is similarly familiar to anyone who's ever done a significant amount of programming in those languages.

    Moreover, these tools are declarative, which means you can use them in languages that better control side effects for safety, and you can use them in languages that optimise based on that extra knowledge for faster performance, and you will be able to use them in the data parallel languages of tomorrow to make more efficient use of modern processing hardware. In other words, in languages designed to take advantage of them, these styles immediately convey more information than the imperative style required by your for-loop version.

    Perhaps it was the filter function that confused you, if you aren't familiar with that particular terminology? If so, I would remind you that you just wrote a code example full of integers and an add function that has nothing to do with calculating the sum of those integers. (At least, I think you did. I notice that you missed out several lines of initialisation and type declarations for those variables, making your example code considerably shorter than it otherwise would have been if you'd actually written a like-for-like equivalent.)

    They're inferior to straight forward programming by orders of magnitude and should never be used.

    I honestly don't understand how any programmer, whatever their preference of language, can claim that an expression that says filter (<10) items and means choose the items that are less than 10 isn't straightforward. I think you're just trolling here.

    As for never being used, you're welcome to stick with yesterday's programming tools if you like. No doubt there will be plenty of need for programmers to maintain legacy systems for a long time to come. But tomorrow's programming tools will let us build bigger, more efficient, safer programs, and we'll be doing it faster and with fewer resources. If you're not familiar with these idioms yet, you might want to consider broadening your knowledge, because before long every 21-year-old kid who learned programming by messing around with JavaScript in their browser is going to be using them.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  113. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    In C++ it should be a for_each and a lambda.

  114. Re:Yes & the sheer amount of existing code/fra by Anonymous+Brave+Guy · · Score: 1

    There's a difference between abstracting complexity away; and relying on a cute, obscure, not-quite-feature of a syntax in your program because it saves a few characters.

    Of course there is, but at no point have I (or anyone else I've seen in this discussion) suggested doing the latter just to make the code shorter. The point is that there are plenty of languages that can say in one clean, readable line of code what takes half an editor window in Java. I gave some typical examples in my reply to another post.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  115. Re: Yes & the sheer amount of existing code/fr by Anonymous Coward · · Score: 0

    It's about code density. If a library abstracts something away, but it does it in a very terse and obtuse way, they yes: that /library's/ code becomes much more difficult to read. But client code that uses that library becomes cleaner and easier to read.

    Generally speaking, that's a win all around. You can go back and refactor the library to be more readable, understandable, and therefore maintainable (and likely more reliable due to all that).

  116. Re: Yes & the sheer amount of existing code/fr by Anonymous Coward · · Score: 0

    You haven't changed the number of tokens, so the complexity is equivalent. Take a regular expression versus a series of String.replace statements for a huge number of characters. The individual replacements are easier to understand for someone who doesn't have regex expertise. Of course regexes are more powerful and generally preferred, but they are a complex beast that one has to understand... because they can be understood.

  117. Up is down and left is right! by Anonymous Coward · · Score: 0

    ...and Java is easy to read. Seriously though, have I woken up in some bizarre alternative reality? What next: assembler is great because it's so portable? Basic is amazing because it is such a carefully designed and structured professional language? Smoking is good for your fscking lungs???

    Have these people never tried to maintain someone else's dogs breakfast of a java code-base?

  118. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    Actually, I'd say that particular example is one of the most confusing syntax you could come up with. The only way you can guess what it does is because you're already used to it from coding in Java or in C++ 11, but for someone who isn't familiar with that syntax they are bound to wonder what "i" is: Is it an int, or is it an "items"? They might know that "for" starts a loop if they are familiar with Algol-derived languages, but what does that particular loop do: Does it calculate a sum, or fill an array? The Haskell syntax looks much easier to parse in comparison. Or even if you want to stay in the same family of languages, the C# syntax uses a much clearer "foreach (int i in items) { ... }", although in that language one might replace the whole loop with a single instruction "result = items.Where(i => i10)".

  119. Re: Yes & the sheer amount of existing code/fr by Anonymous Coward · · Score: 0

    The problem with object.x=4 is that it not overridable, the therefore interferes with both the encapsulation and the specialization concepts within the OO world.

    I used to think that accessors and mutators were useless until I started really using classes in the way they were intended to be used.

    There's an anecdote about Gosling that goes something like he "thought that all objects in Java should be anonymous and implement well-defined interfaces." That sounds completely insane until you think about it from an OO-purist standpoint. Interfaces have no members, so everything is an overridable function. There would be no constructors (as you know them) and all objects would be created much like they are in the JavaScript world: by simply saying "this is an object that implements IWhatever, and here is its implementation.

    Of course, it is in fact insane because then the only way to get more than one instance of the same class would be to call a particular factory method. But then, you could always override the factory method and provide a different implementation.

    Some of this sounds truly foolish and, yes, idealistic and in some cases just "stupid OO shit... In my day, we wrote asm with only our pinky fingers because our other fingers were busy holding DIP switches/punch cards/vacuum tubes/our dicks" but there really are good reasons for some of the things seen as useless cruft by some.

    Refactoring is /much/ easier if none of the internals members of your classes are exposed to the outside. Especially if you are sharing your code widely. If you have a single huge code base with no dependencies then find: make everything public and have at it. But you'll end up with better code if you pretend that everything you write is a library that could potentially be used by someone in an entirely different setting. (Bonus: it makes u it testing easier, too.). So, wins all around for that so-called useless stuff Java makes you do.

  120. Re: Yes & the sheer amount of existing code/fr by mattventura · · Score: 1

    object.x = 5 isn't overridable in Java, but it is in other languages like Python.

    Refactoring is much easier when the language is actually conducive to refactoring. Java isn't conducive to refactoring at all, so as a result you have to always plan for the worst case scenario (e.g. use getters and setters for everything). Contrast to Python, which makes refactoring objects quite easy due to the amount of control you have over every aspect of your object.

  121. Re: Yes & the sheer amount of existing code/fr by Anonymous Coward · · Score: 0

    Fortran where construct

  122. Hardly by vilanye · · Score: 1

    It was designed for the mediocre programmer and that is what enterprises hire.

  123. Re: Yes & the sheer amount of existing code/f by Anonymous Coward · · Score: 0

    Any dynamically typed language makes refactoring difficult. Hell it even makes figuring out whats what hard. In Java I can search for references to things and who calls who really easily. I can come into a huge code base and just let the IDE take me to the right places. Try that with an even moderately to small sized python or JS project and you'll see what I mean. The fact that so much shit happens at runtime makes it impossible to even find things until you have a pretty good mental model of the application and how its built. I don't need that in Java (until we get to all the frameworks that things away in runtime stuff through configuration). The same thing makes refactoring hard because I actually have to refactor by hand now. If I so much as rename refactor object.x to object.y my IDE can't rename it in all the right places because it doesn't actually know where all those places even are because its only known at runtime. How can I write clean code by having proper names if I'm basically stuck with whatever shitty name developers before me came up with? If I have to run a full regression just to make sure that a rename didn't break anything, I'll just not rename things.

  124. Re: Yes & the sheer amount of existing code/fr by Anonymous Coward · · Score: 0

    Your example is NOT easy to understand to someone that doesn't know perl. WTF is $_? Sure i know because I've done perl. Does some kid fresh out of uni know jack squat what your code does? Heck he doesn't even get the grep!

    Now obviously $_ is such a basic and important element of perl that everyone doing perl for 5 minutes will understand it easily. Enter leaving out $_ because we can't be bothered to write even those two characters. Now lets assume $_ isn't actually $_ but whatever other implicit thing you can imagine in any of the obscure languages that are in use nowadays. Suddenly I have to know aboutt 100 functions that can operate on "$_" even when you dont explicitly state that. Sorry but that becomes unreadable.

    Theres a sweet spot between verbose and too frickin magic and Java used properly is pretty much it. When in doubt I'd rather read 2 minutes longer and delete a bunch of overly verbose java into regularly verbose java than to just not frickin get what that piece of JS does until I debug it at runtime to see that something from somewhere injects a new function somewhere overwriting the source code that I read to do sone funky stuff that ultimately breaks my software and has my boss breathing down my neck.

  125. Re: Yes & the sheer amount of existing code/f by Anonymous Coward · · Score: 0

    Why do I have to erite an automated regression test suite if a compiler in a statically typed language like java could just let me know that I missed renaming x to y in one place? Which wouldn't even have happened if my IDE had done the rename as a refactoring for me?

  126. debugging by senatorpjt · · Score: 1

    Something I don't hear mentioned a lot is that Java is exceptionally easy to debug. Each statement does so little that it is very easy to step through code in a debugger and pinpoint the place that something has gone wrong.

    1. Re:debugging by ThePhilips · · Score: 1

      Each statement does so little [...]

      Also true for the assemblers.

      [...] that it is very easy to step through code in a debugger and pinpoint the place that something has gone wrong.

      Except that it might take days or weeks to step through all of it.

      Except that it theoretically might take even months, if you need to debug problem related to some framework.

      [...] Java is exceptionally easy to debug.

      It's not. Unless it is relatively small and independent application. But in that case, literally every language is easy to debug. Even C.

      --
      All hope abandon ye who enter here.
  127. Re: Yes & the sheer amount of existing code/fr by shutdown+-p+now · · Score: 1

    The problem with object.x=4 is that it not overridable, the therefore interferes with both the encapsulation and the specialization concepts within the OO world.

    For starters, as noted, it's strictly a language issue - there's no reason why property-style access cannot be made customizable, and it is in C# (just to pick something that's relatively close to Java).

    Furthermore, there's no particular reason why you'd really want object.x=4 to be overridable in general. In a language that is designed well, there's simply no observable difference in that operation (and other treatment of 'x') regardless of whether it's a simple field or a code-backed property. Even C# gets it wrong (can't use properties as 'out' or 'ref' arguments of a function, for example), but other languages do it right. In that case, you always start with a field, and you change it to property accessors if and when you actually need it.

  128. Re:Yes & the sheer amount of existing code/fra by shutdown+-p+now · · Score: 1

    You're awfully confident about your subjective judgments. I don't see anything non-explicit about his code, and it's perfectly usable.

  129. Re:Yes & the sheer amount of existing code/fra by undefinedreference · · Score: 1

    The simple fact is that there are times to talk really slow with small words for a large audiences and times to use expressiveness to get thing done fast in a professionally erudite environment. Often, complex software design is a case of the latter, not the former. Management would like it to be the former, because H1B, of course, but that is a short sighted strategy destined to leave the company in the dirt.

    I always believed this, combined with the fact that schools kept churning out zombies that had never touched another language, was the main reason for the popularity of Java. It's an excellent language for teaching OO concepts as it is an exceptionally complete and verbose implementation, but it is an absolutely awful language to use in a business setting. This is why people kept coming up with more and more elaborate ways to work around all of the shortcomings involved in using it for anything more than a school project.

  130. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    In Python:
    results = [i for i in items if i 10]

    You're right, your Java example was so clear and simple but as soon as I tried to understand that line of Python my head exploded and there are currently mental health professionals coming to take me away for being so needlessly obtuse that they diagnosed it as a severe disorder.

  131. Re:Yes & the sheer amount of existing code/fra by brodock · · Score: 0
    you mean that it's easier to read than this?:

    results = items.select {|item| item

    (this kind of expressiveness cannot be achieved by java standard library)

  132. No, it fails compilation. by Anonymous Coward · · Score: 0

    Test.java:144: error: ']' expected
                            int things[10];
                                            ^
    Test.java:144: error: illegal start of expression
                            int things[10];
                                                ^
    2 errors

    1. Re:No, it fails compilation. by ttucker · · Score: 1

      Whooosh... the code example is in C/C++, not Java.

  133. Re:Yes & the sheer amount of existing code/fra by Twinbee · · Score: 1

    The former is obviously much better. It's not just better to read but also to write without the mind veering off from solving the problem at hand.

    Those who harp on about verbosity being a good thing don't realize how good things can be.

    --
    Why OpalCalc is the best Windows calc
  134. Re:Yes & the sheer amount of existing code/fra by Twinbee · · Score: 1

    I've often thought about a programming language where you only need to write the smallest possible amount of code to achieve what you're trying to do. And have it clear too (so not Perl style).

    No bloat, no header files, no semicolons at the end of lines, swap functionality of && with & and || with | (colour coding them too), power-of symbol (^), terse Haskell-style functionality, and even no forced declarations (the IDE can colour code variables according to whether they're int, double, string etc. automatically, and the scope is automatically defined as the outermost appearance of the variable). The compiler would do ALL the hard work to optimize the program.

    --
    Why OpalCalc is the best Windows calc
  135. Re:Corollary: It's difficult to be "clever" in Jav by Anonymous Coward · · Score: 0

    On the other hand you can write a huge amount of projects without ever encountering any of these clever libraries. I just love to keep my dependencies minimal.

  136. Re:Yes & the sheer amount of existing code/fra by Twinbee · · Score: 1

    Having not yet touched Haskell, I love the terseness of the Haskell example. To me it feels like a high level function, like as if it could be rewritten:

    items = [1, 15, 27, 3, 54]
    result = items.filter(<, 10)

    Perhaps all Haskell functionality can be converted like this?

    --
    Why OpalCalc is the best Windows calc
  137. Re: Yes & the sheer amount of existing code/f by Anonymous Coward · · Score: 0

    Yes, but you have a very narrow view, here. If I change the name of 'x' in the class, I have to change it /everywhere/, unless the language has a way for me to say "by the way, if someone assigns to 'x', really assign to 'y' instead.

    Try doing that in library code, where you don't have the ability to re-factor everyone's code that relies on yours and you'll see that property-backed accessors are not sufficient for robust and maintainable code - at least, not code used outside one's own toy examples.

  138. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  139. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    +1 for your java expression.

    I find the groovy addition of the "in" even more readable:
    items = [1, 15, 27, 3, 54];
    results = [];
    for (item in items) {
            if (item 10) {
                  results.add(item);
            }
    }

    Also the lambda version in groovy is not bad at all:
    items = [1, 15, 27, 3, 54];
    results = items.findAll { it 10 };

  140. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    Haskell: WTF are the types?
    Python: WTF are the types?
    Java: items is clearly a collection of integers (dictionary definition of collection - I can be totally ignorant of Collection.class and know that). The for loop clearly tells me I'm iterating through each element. Sure, .add(int) might be a bit ambiguous, but with Java, we have some damn nice tools called IDEs that'll give us a nice popup telling us results is a collection and the add method adds to it, and that's assuming there's not a line List results = new ArrayList(); right above the snippet you took.

  141. Cross-platform support is also important by Shirley+Marquez · · Score: 1

    Java's cross-platform support is mentioned in passing in the article. But they fail to recognize its importance in a key setting: the academic environment. Not only is Java available for all the important platforms that students may own (Windows, Mac, and Linux), the SAME implementation of it is on all those platforms. That means that students can use any of those platforms to do their assignments, and be confident that their programs will run correctly on the systems used by the graders. That is a key advantage over using C or C++.

    Python is also cross-platform, and it has seen substantial growth in academic use in recent years. Vendor-bound languages like Swift and C# aren't in the running for general academic use, though schools offer courses that are specifically about them. (C# may become more usable in the future now that Microsoft is opening up parts of .NET but it has to be considered a Windows-only language for now.) The next frontier may be browser-based programming environments using Javascript; those will offer excellent cross-platform compatibility so long as all students use the same browser (which means one that is available on multiple platforms such as Chrome or Firefox), and probably an acceptable level even if they use a different one.

  142. Re:Yes & the sheer amount of existing code/fra by surd1618 · · Score: 1
    http://stackoverflow.com/a/122...
    Quote about filters in Java from this link:

    Filter in place or into another collection?

    Haskell programmers are crying.

  143. Re:Yeah right. Then explain COBOL. by Toshito · · Score: 1

    The colon is no longer used, we only put one at the end of each paragraph (procedure).

    Parsing XML in COBOL is very easy. You use the XML PARSE command in a loop. Each time the parser finds an XML tag it return control to your program, giving you the tag name, attribute(s) and value. You process it, then call the parser again until the end of the document.

    Likewise, generating a complex XML document in COBOL is done by defining the hirarchical structure in a copybook, assigning values, and then calling a single command: XML GENERATE.

    It's very easy, and very fast.

    --
    Try it! Library of Babel
  144. Re: Yes & the sheer amount of existing code/f by shutdown+-p+now · · Score: 1

    Yes, but you have a very narrow view, here. If I change the name of 'x' in the class, I have to change it /everywhere/, unless the language has a way for me to say "by the way, if someone assigns to 'x', really assign to 'y' instead.

    And how is this different from setX?

  145. Standard input is often redirected by tepples · · Score: 1

    Reading from standard input does not mean "reading from the command line". Standard input is often redirected from a file, from another program's output (called a "pipe"), or from data provided by the client that connected to a running server.

  146. Variable type, name, and constructor should differ by tepples · · Score: 1

    Foo foo = new Foo()

    Which isn't necessarily good style.

    First, the type name in a declaration can and often should be more generic than the constructor. It could be an interface that the constructed class implements or an abstract class that the constructed class extends. For example, you can do Map map = new TreeMap() if you're not going to call any tree-specific methods later on.

    Second, why name the variable similarly to the class? Map enemies = new TreeMap() makes the variable's purpose easier to understand.

  147. Java is dysfunctional by tepples · · Score: 1

    Java is not functional

    Only because Oracle keeps breaking it. The Java virtual machine's security has proven to be Swiss-cheese enough that Oracle is falling back on the traditional video game console security paradigm (reliance on commercial code signing certificate authorities) rather than actually restricting what a program module can do.

  148. JavaScript by tepples · · Score: 1

    #2. Scheme is a Lisp, so if Java were a heavy weight one, we would have a widely adopted Lisp.

    We do have a widely adopted Lisp. But it's not Java; it's JavaScript. JavaScript implements Lisp-like semantics, and its syntax is a C-colored fulfillment of the "M-expression" syntax concept originally envisioned for Lisp.

  149. Re:Yeah right. Then explain COBOL. by Toshito · · Score: 1

    colon? I meant the period!

    Sorry for my poor english.

    --
    Try it! Library of Babel
  150. Clear code: Cultural background by DrYak · · Score: 1

    if you took someone that never read or wrote code before and showed them 100 line, idiomatic programs in Java, Javascript, Python, Ruby, PHP, Perl, Lisp, Haskell, C, Fortran, COBOL, Basic, and a few other languages that Java would not top the list for readability. My guess is that the winners would be Basic, COBOL, and Python.

    Depends. My bet is that it entirely depends on the background of the "someone" you've taken.
    - english speaker ? mostly used to litterature and philosophical logic ? yes, maybe as you list them.

    - background in mathematics ? The order will probably be reversed, with probably Haskell, C and Fortran near the top. And probably APL topping them all. And the guy complaining that most of them still miss support for greek alphabet.

    some people are used to see things written down in plain text, other are better used to see things written with symbols.

    plain text has the advantage of being a little bit clearer for a person who happens to be fluent in the language which was used to create the language (say hello to dialects of Logo and Excel macros translated into various languages). Otherwise it's completely useless (most of the language you mention are based around english. useless non-english speakers. when I was a kid, I started learning to code in basic before I knew english).

    symbolic notation has the advantage of being more compact (requires less typing, quicker to read)
    cf. the well know geeky joke of "add 1 to cobol giving cobol" vs "C++"

    And well, Perl, let's forget about Perl. It's a write-only language.
    The only language your cat can write legal code in just by walking across the keyboard. :-D

    (Disclaimer: I used to code a lot in Basic as a you kid. Started C a bit later, and learned english about this time. I code also regularily in Perl, C++, awk, php, 386 assembler, etc. I know bits of R, javascript, python, FORTRAN, did some Logo in french in school as a kid, etc.)

    --
    "Sufficiently advanced satire is indistinguishable from reality." - [Tips: 1DrYakQDKCQ6y52z6QbnkxHXAocMZJE61o ]
    1. Re:Clear code: Cultural background by DuckDodgers · · Score: 1

      C mathematical operator syntax is probably more intuitive for a mathematician or even just someone that completed high school math classes. But the other syntax for pointers and dereferencing pointers, arrays, and curly braces for code blocks is probably still unintuitive, even if you have a mathematician. They would probably still go from "complete novice" to halfway between beginner and intermediate faster with Basic or Python than with C.

      I can't speak for Fortran, I've only ever looked at a few snippets of it. As for Haskell - I think Haskell syntax is still puzzling. Yes, the function definitions are mathematical and the case matching mechanism for defining function paths is brilliant and elegant, but until you understand what it means, it looks bizarre.

  151. Re:Yes & the sheer amount of existing code/fra by swilver · · Score: 1

    Ah.. the word "filter" again.

    filter (10)...

    What does it mean?

    1) Filter out every item matching the criteria (ie, discard every item less than 10)
    2) Filter out every item not matching the criteria (ie, keep every item less than 10)

  152. Re:Yes & the sheer amount of existing code/fra by Anonymous Coward · · Score: 0

    I'd agree with the ecosystem being a huge factor in Java's success.

    .......................

    One ecosystem component must include the cost for a full kit at a school.

    SCHOOLS:
    At the time Java was hatched and multiple JVMs ported there was little in
    the way of a teacher adding it to a class.

    It is a worthy and well thought out language and that help.
    But I would assert() that the net cost for a class of 120 students
    on WindowZ boxes is the reason this worthy language gained traction.

    GCC was first out of the gate but it was not novice friendly
    for a gosh long time... It gained serious traction with Linux.

    As always we can look back with 20/20 hind sight but I watched
    it hatch and cost and availability was a critical component.
    Yes it helps that it was and is a decent language.

  153. Re:Yes & the sheer amount of existing code/fra by Anonymous+Brave+Guy · · Score: 1

    In this case, "filter" means select only those items that match the criteria, i.e., where the given predicate is true.

    This usage is about as consistent as anything you'll find in the programming world: languages using it this way include Python, PHP, JavaScript, Java, D, and many well-known functional programming languages including Haskell, several of the ML family, Erlang, Scala and Clojure. Some other well-known languages have related algorithms under other name, but I know of no counter-examples that use "filter" in the opposite sense.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  154. Re:Yes & the sheer amount of existing code/fra by Bugamn · · Score: 1

    Once when I was teaching Python, it amused me to notice a beginner try to write a function in a way that would be valid Haskell, but wasn't valid in Python. Your own post also seems to find Haskell more natural. I wish I could spend more time with Haskell, it seems very interesting.

  155. Re:Yes & the sheer amount of existing code/fra by Bugamn · · Score: 1

    Depends on how the language does comments. I think it wouldn't work on either Perl or Haskell.

  156. I must not be human by MoarSauce123 · · Score: 1

    I started learning Java at the university and found it to be the most complicated and convoluted way of programming. There is a ton of stuff you have to get straight before you can even print your first "Hello World!" to the screen. I dropped the class and changed the major...and apparently I am not human.

  157. Whicpaintbrush should I use to drill a hole? by Hognoxious · · Score: 1

    Your poor reading comprehension is perhaps the root of your confusion. I didn't say anything about a tool for all jobs.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  158. Explaining my thought processes: which tools? by tepples · · Score: 1

    Rapidly switching back and forth between en-US and the keyboard layout for your native language can be uncomfortable as well.

    Your poor reading comprehension is perhaps the root of your confusion. I didn't say anything about a tool for all jobs.

    I apologize for imperfectly understanding your comment. I'll instead try to explain my miscomprehension one step at a time so you can help me understand where I went wrong. As far as I understand your comments so far, you're suggesting using one tool for entering code and another for entering native language text. Writing a program includes both code in a programming language and comments in the language of the programmer team. And as I understand dunkelfalke's comment, the programming language is optimized for the en-US keyboard language, but the language of the programmer team is not en-US. If one's responsibilities include rapidly switching between writing code in a programming language and documenting it in a human language, what are you trying to say is the appropriate tool for each job?

    1. Re:Explaining my thought processes: which tools? by Hognoxious · · Score: 1

      The original invention is in doubt, but typewriters first became mainstream in the US. They were designed for English. When they were adapted for other languages with more characters and/or squiggles, dots and the like something had to give because, due to economies of scale, the number of keys couldn't be changed. That something was the less common punctuation marks.

      Unix, C and the like came from the US. They naturally make use of characters that are easy to type on a US keyboard.

      Seems to me the job design is wrong. It's like complaining that it takes time to get changed when switching twice an hour between cleaning operating theatres and shovelling pigshit. Maybe you could go back in time and lobby for spelling reform in whatever godforsaken babble you mumble in.

      For me, I set a UK keyboard to Welsh on the occasions where I've needed to add French or German texts to a program.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."