Slashdot Mirror


Google-backed Kotlin Gains Adoption in Open Source Android Apps; Scientists Say It Has Improved Code Quality (theregister.co.uk)

Kotlin, which Google blessed last year as an alternative to Java for programming Android apps, has already made its way into almost 12 per cent of open source Android apps, and in so doing has elevated their code quality. From a report: So we're told by computer scientists Bruno Gois Mateus and Matias Martinez, affiliated with University of Valenciennes in France, who observed that Google at the end of 2017 said Kotlin had infiltrated more than 17 per cent of Android apps developed with its IDE, Android Studio 3.0. Kotlin is an open source statically typed programing language that targets the JVM, Android, JavaScript (transpiling to ES5.1) and native platforms (via LLVM). JetBrains, the company that created it, contends Kotlin is more concise and more type-safe than Java. It estimates that apps written in Kotlin require about 40 per cent less code than they would with Java. With fewer lines of code, in theory, one can expect fewer bugs. In a paper distributed through pre-print service ArXiv, "An Empirical Study on Quality of Android Applications written in Kotlin language," Mateus and Martinez describe how they gathered 925 apps from the open source F-Droid repository, measured the amount of Kotlin code in each, and analyzed the code for "smells" as an indicator of code quality.

86 comments

  1. Fewer lines of code = fewer bugs by Anonymous Coward · · Score: 0

    WRONG.

    1. Re:Fewer lines of code = fewer bugs by Anonymous Coward · · Score: 0

      Thank you. If I want concise and truly elegant, I write Ruby. Doesn't make it any less prone to bugs.

    2. Re: Fewer lines of code = fewer bugs by Anonymous Coward · · Score: 1

      Possibly. Print hello world in assembly. Print hello world in basic. Which program would you suspect is more likely to have bugs?

    3. Re: Fewer lines of code = fewer bugs by Anonymous Coward · · Score: 0

      On most sane architectures hello world is three instructions.
      1) load the string address.
      2) call the printf function
      3) return

      Z80 version:

      ld hl, str1
      jp _printf ; I said 3, but call followed by ret can be merged into jp to save stack, size and cycles.
      str1:
      defb "Hello World!",10,0

    4. Re: Fewer lines of code = fewer bugs by Zero__Kelvin · · Score: 1

      Well you couldn't even write a single line of psuedocode in your subject line, trying to assign rather than compare ( = != == ) so you are right in your case at least.

      --
      Guns don't kill people; Physics kills people! - John Lithgow as Dick Solomon on Third Rock From The Sun
    5. Re:Fewer lines of code = fewer bugs by Anonymous Coward · · Score: 0

      Haskell laughs at your "truly elegant, I write Ruby" comment.

    6. Re:Fewer lines of code = fewer bugs by Anonymous Coward · · Score: 0

      That the ruby people have been at the forefront of automated testing is not a coincidence. Their default defect density is second to none. Few other languages will introduce new bugs in your existing working code merely by upgrading a library that you aren't even using in this file. Those that did would likely tell you that it was their own fault. Only ruby Devs would blame the author of the code that got broken.

  2. Smells are not a scientific measure by Anonymous Coward · · Score: 0

    And I say that as someone who is a big fan of Kotlin...

  3. Its only smells by Anonymous Coward · · Score: 0

    What this Kotlin smells

  4. Kotlin is Swift for Android by Anonymous Coward · · Score: 0

    Seriously.

  5. As a big fan of software quality by raymorris · · Score: 3, Insightful

    As a big fan of software quality, who has long studied how to make better quality software, my experience is that they can be a pretty good indicator.

    The smells don't always indicate a problem right there where the smell is (though they often do), they often tell you something about the skill and care with which the software was developed.

    To stretch an analogy, the smell of rotting meat is largely due to the aptly named putrescine. That's the smell that tells you something is wrong. Putrescine isn't particularly toxic. Putrescine, the smell, is an indicator that something dangerous such as serratia is likely present.

    1. Re: As a big fan of software quality by Anonymous Coward · · Score: 0

      Its an indicator of poorly designed code, but not of incorrect code, especially if unit tests are available. Smell is a much less useful metric compared to test coverage.

    2. Re:As a big fan of software quality by anadem · · Score: 1

      very nicely put! a smell test reveals quality

    3. Re:As a big fan of software quality by Anonymous Coward · · Score: 0

      "very nicely put! a smell test reveals quality"

      My code smells like roses.

    4. Re: As a big fan of software quality by phantomfive · · Score: 2

      A lot of these aren't code smells in the traditional sense, rather they are optimizations that reduce power usage. For example, one of them is using sparsemap instead of hashmap. While I agree in many cases the former is preferable, I'm not going to call the latter bad quality because it is 2 percent slower (which is approx thw number I got from the paper). In any case they should be talking about efficiency and power usage in the article, rather than overall code quality (because efficiency is only one aspect of that)

      --
      "First they came for the slanderers and i said nothing."
    5. Re: As a big fan of software quality by jrumney · · Score: 1

      One thing that makes code smell a particularly useless metric is that many categories of "smells" can be eliminated by simply not using object oriented languages.

      Is the reduced level of "smells" from using Kotlin over Java is because of quality, or because the "smell" cargo cult mostly concentrates on Java-like languages and Kotlin is doing things a bit differently in ways that conventional smell detectors cannot detect?

    6. Re:As a big fan of software quality by Anonymous Coward · · Score: 0

      or they just reveal a culture of coding, for good or for bad.

      for the first several versions, the Swift idiom was to use "if let" everywhere which lead to the "pyramid of doom" -- deeply nested if statements.

      obviously it is better to test variables for null and if they are null, exit early, instead of nesting every single if statement into a giant pyramid. eventually swift added support for "guard" which does exactly this, as well as compound if let statements. but the "if" style was obviously bad even before they added these feature.

      now people use the idiom of something like "if let val = val { }" which reuses the same variable name for two significantly different concepts - the optional value (up to that point) and the unwrapped coming from another language this stinks to high heaven, but swift people think this is fantastic and manual unwrapping is a smell.

      even though manual unwrapping is something that the IDE itself can confirm has been done.

    7. Re:As a big fan of software quality by Anonymous Coward · · Score: 0

      "very nicely put! a smell test reveals quality"

      My code smells like roses.

      Heh. I bet the windows code base smells like ass

    8. Re: As a big fan of software quality by AuMatar · · Score: 1

      And use what, a functional language? That's probably the biggest smell of all.

      --
      I still have more fans than freaks. WTF is wrong with you people?
  6. POST THE FUCKING REAL SOURCE by Anonymous Coward · · Score: 1

    At least link the source which is the Arxiv paper here.

    We don't come to /. to read a summary of a headline which links to a summary on another site summarizing someone elses summary.

    1. Re:POST THE FUCKING REAL SOURCE by viperidaenz · · Score: 1
    2. Re:POST THE FUCKING REAL SOURCE by Anonymous Coward · · Score: 0

      I wholeheartedly feel that board quality would be improved by allowing image replies.

    3. Re:POST THE FUCKING REAL SOURCE by Anonymous Coward · · Score: 0

      I wholeheartedly feel that board quality would be improved by allowing image replies.

      With the number of anon trolls on here? It will further extend the clusterfuck that is the slashdot comments. What they really need is to disable anonymous comments, while also preventing one from upvoting their own comment. Posting anon because mod points

  7. I would believe it by MikeRT · · Score: 2

    Kotlin has a lot of the advantages of Scala, but without the C++-like complexity that Scala can bring to the JVM (and without C++'s performance or hardware hooks).

    It's proof that you can have a language about as concise as Python, but with clean static typing.

    1. Re:I would believe it by Anonymous Coward · · Score: 0

      As a bezel scientist, I am concerned with notch support.

    2. Re:I would believe it by Anonymous Coward · · Score: 0

      Yes, like C. Already proven decades ago.

  8. It depends on how you get fewer by MikeRT · · Score: 4, Informative

    In Java, it's common to check if a list is null before iterating over it avoid a NPE. In Groovy we can do this:

    someList?.each { item -> something(item) }

    The null-safe operator ? tells the Groovy compiler to write that null check for me and quietly disregard the call to "each" if it fails.

    I see colleagues use Map.get and then either forget to check for null values or add an extra 1-2 lines of code. In Groovy we can do:

    def x = myMap[someString] ?: DEFAULT_VAL

    Another simple example, but the "elvis operator," ?: means "if the conditional statement to my left is truthy, return its value and assign to x otherwise use the value to my right."

    These are simplistic examples, but in Java they happen all the time.

    1. Re:It depends on how you get fewer by Anonymous Coward · · Score: 4, Informative

      As an interesting aside, replace def with val and both of your examples are valid Kotlin syntax.

    2. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      Your libraries seem to have poorly thought out interfaces. Given the language limitations things should return empty lists, not null.

    3. Re:It depends on how you get fewer by Anonymous Coward · · Score: 2, Informative

      Your Groovy examples in modern pure Java:

      Optional.ofNullable(someList).ifPresent(list -> list.forEach(item -> something(item)));

      String x = Optional.ofNullable(myMap) .map(map -> map.get(someString)) .orElse(DEFAULT_VAL);

    4. Re:It depends on how you get fewer by AuMatar · · Score: 4, Insightful

      Yeah, nobody writes Java write that. Its unreadable and unmaintainable. You write a freaking if statement and a loop. That way people can understand what you're trying to do, and can easily edit it if what the loop needs to do changes. You example would be immediately rejected in any code review.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    5. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      Yeah, nobody writes Java write that. Its unreadable and unmaintainable. You write a freaking if statement and a loop. That way people can understand what you're trying to do, and can easily edit it if what the loop needs to do changes. You example would be immediately rejected in any code review.

      I see python code like this at work, when I ask why, the dev says that it's 'pythonic'.

      At a prior job I saw the same thing from a php dev: while(someBoolean) for(someForParams) someFunctionCall()

      Why the fuck would you want to have 3 different things happening on the same line?

      What do you do when your log says: error on line 231? Start poking around until you figure out which part of your line caused it

    6. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      Because Kotlin got "inspired" by Groovy ;)

    7. Re:It depends on how you get fewer by Anonymous Coward · · Score: 1

      So? JetBrains freely admits it created Kotlin by taking the best features from multiple languages. It's a very pragmatic and polished language.
      Imo, the strong typing alone makes it much better than Groovy (compare for example the Kotlin variant of Gradle script with the Groovy one).

    8. Re:It depends on how you get fewer by Anonymous Coward · · Score: 1

      You write a freaking if statement and a loop.

      I hate people that write the if statement, if your code doesn't take null as valid input let it throw instead of hidding the callers error. I see null checks like I see empty catch blocks, they make it near impossible to find bugs in a larger codebase.

    9. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      def x = myMap[someString] ?: DEFAULT_VAL

      Another simple example, but the "elvis operator," ?: means "if the conditional statement to my left is truthy, return its value and assign to x otherwise use the value to my right."

      tbh, that operator's been in a lot of languages for ages. It's called the 'or' operator. Here's Ruby's:

      x = myMap[someString] || DEFAULT_VAL

      I hate languages such as Java that don't let me use the or operator that way...

    10. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      >What do you do when your log says: error on line 231? Start poking around until you figure out which part of your line caused it

      This can always happen - and it's a sign that your debugger/logger is a piece of shit. It should be counting expressions.

    11. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      I get expression counts in my stacktraces from the JVM

      Oh, wait, no I don't. What a fucktard to debug.

    12. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      Yeah, nobody writes Java write that. Its unreadable and unmaintainable.

      Impressive! You must know how everyone writes Java. God like you are (except when you type 'write' when you mean 'like').

      You write a freaking if statement and a loop.

      Manually written loops are fraught with bugs and unnecessary temporary variables. They are a thing of the past. I am sorry to inform you that the world moves forward. However, since you are clearly an authority, I will inform the Java community to replace all of their streams and lambdas back to the convoluted for/while/null/empty checking code circa 1995.

      That way people can understand what you're trying to do

      This is what unit tests are for. But you know that being omnipotent and all.

      You example would be immediately rejected in any code review.

      Again, God-like! (except the part where you meant 'Your') You have the authority to speak for all code reviewers!

    13. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      but, but it's FUNCTIONAL which some academic shithead has decided is the best thing ever despite always sucking in real life, like microkernels and any number of other dumb academic shit floated by shithead phds.

    14. Re:It depends on how you get fewer by azcoyote · · Score: 1

      Interesting--can somebody explain this? I have written Groovy before, and I'd like to know what the difference between Groovy and Kotlin is if Groovy syntax can be copied to Kotlin almost verbatim. Is there still a significant difference behind the scenes? Thanks!

      --
      Incipiamus, fratres, servire Domino Deo, quia hucusque vix vel parum in nullo profecimus.
    15. Re:It depends on how you get fewer by Anonymous Coward · · Score: 0

      Here is someone who's code crashes all the time

    16. Re:It depends on how you get fewer by AuMatar · · Score: 1

      Because I like my code to not crash in production. There are cases where null is unrecoverable and then letting it throw is acceptable. But it generally isn't the case.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    17. Re:It depends on how you get fewer by AuMatar · · Score: 2

      Manually written loops are fraught with bugs and unnecessary temporary variables. They are a thing of the past. I am sorry to inform you that the world moves forward. However, since you are clearly an authority, I will inform the Java community to replace all of their streams and lambdas back to the convoluted for/while/null/empty checking code circa 1995.

      Please do. I know every place I worked they were not allowed, because they led to higher maintenance cost and time lost in debugging. They're less readable, less alterable, and more fragile.

      >That way people can understand what you're trying to do

      This is what unit tests are for. But you know that being omnipotent and all.

      No, its not at all what unit tests are for. Unit tests have nothing to do with explaining the purpose even of functions, much less of a random block of code within one.

      --
      I still have more fans than freaks. WTF is wrong with you people?
  9. Very good tests are very good by raymorris · · Score: 3, Insightful

    Testing is a great thing. Unit tests typically can tell you that something seems to work under a particular set of conditions, with particular inputs, ignoring concurency and all those other annoying little real-life inconveniences. That's very useful.

    Most commonly, unit tests let you confirm that given normal, anticipated inputs that are supposed to work, under the normal, anticipated conditions that the programmer had in mind when he wrote the code and tests, it more or less works. What we frequently fail to test is failure. What if the input is empty? What of it has multiple values? What if the person's name is a million characters long? You CAN write unit tests for such cases; most people don't.

    A useful excercise is to make a table of all possible inputs to a small function, including empty or null inputs, with the expected result. Then test every possible set of inputs. Obviously, that's only feasible for functions with a small number of inputs, and ideally one output. That level.pf testing can guarantee correctness. Any less cannot. It can only ensure that what the programmer was thinking when they wrote the test matches with when they wrote the code.

    1. Re: Very good tests are very good by Anonymous Coward · · Score: 0

      overrated responese. a unit test is far superior to a smell. one is objective, the other subjective.

    2. Re: Very good tests are very good by mugnyte · · Score: 1

      Read about fuzz testing. Its been around since the late 1950â(TM)s.

  10. No jetbrains by Billly+Gates · · Score: 1

    Can you use this without Jetbrains?

    1. Re:No jetbrains by nyet · · Score: 2

      Absolutely.

    2. Re:No jetbrains by Anonymous Coward · · Score: 0

      Jetbrains a hell of a lot better than Oracle, ok. But best to skip JVM shit altogether if possible.

  11. "Scientists"? by Anonymous Coward · · Score: 0, Insightful

    Uh, computer scientists aren't scientists...

    (Source: Am a computer scientist.)

    1. Re:"Scientists"? by topology · · Score: 2

      Uh, computer scientists aren't scientists...

      (Source: Am a computer scientist.)

      Scientific Method
      1) Ask a Question: Will this program I just wrote compile?
      2) Background Research:
      2.1) Previous experience with programming language
      2.2) Previous experience with type of problem
      2,3) Quality of Understanding of CS concepts
      3) Form a hypothesis: First time to compile: no. Estimate X syntax errors and Z semantic errors per Y lines of code.
      4) Experiment: Perform compile.
      5) Analyze Results
      6) Iterate on Experiment. (Fix errors, refine understanding.)
      7) Present findings (Boss, it's going to be another 3 days for thorough testing)

      The scientific investigation in Computer Science is on many fronts, but the most empirical aspect of science is the study of how well you, the programmer, understand the problem at hand and the tools you have for tackling it.

      Perhaps you don't understand the Science aspect of Computer Science: The ongoing effort to refine our models of understanding about the world.

    2. Re:"Scientists"? by MrMr · · Score: 1

      Hm,
      Excercise for the student: Replace each of your bullets with a pornographic reference. Can we now conclude that porn is science?

    3. Re:"Scientists"? by Anonymous Coward · · Score: 0

      > Can we now conclude that porn is science?

      Why porn and not sex?

    4. Re:"Scientists"? by quintus_horatius · · Score: 1

      > Can we now conclude that porn is science?

      Why porn and not sex?

      Porn is research. Sex is applied engineering.

  12. Checked Exceptions. by NextApp · · Score: 5, Interesting

    Android app dev here. Learning Kotlin, I started off being thoroughly excited about it, especially the nullity checking and other general code safety features. Then I got to the bit about it not having checked exceptions and now have a very mixed opinion.

    The arguments against checked exceptions seem to be that 1.) most languages don't have them, 2.) bad programmers will just throw and catch the base "Exception" class everywhere, and 3.) bad programmers will screw up interfaces and the like by putting implementation-specific exceptions in the contract rather than writing appropriate exception classes.

    Bad programmers write bad code, and will continue to write bad code. I guess if we "fix" the problem by having good programmers write bad code too, it will technically make the bad programmers average.

    Going to try using it on a new project (that won't have checked exceptions as a key component of its design, like my existing stuff) and hope for the best. I still can't get over this seeming like two steps forward, three steps back. I hope I'm wrong, as it otherwise appears to be a great improvement compared to Java.

    1. Re: Checked Exceptions. by Anonymous Coward · · Score: 0

      You donâ(TM)t need them because you canâ(TM)t do anything useful with them, that you wouldnâ(TM)t be able to do with an unchecked exception

    2. Re:Checked Exceptions. by AuMatar · · Score: 0, Troll

      CheckedExceptions have been considered a language flaw in Java for a very long time by a large percentage of its users. Examples of problems with them:

      *Writing throws statements on each function causes propagation up the chain and leads to either being forced to catch Exception or have functions with a half dozen throws on it.

      *Removing the necessity of throwing on any function in the change causes massive changes to all callers, which is time consuming and causes unnecessary churn. Especially bad with libraries.

      *Having to declare your function throws an exception because something used 3 levels down throws it in a 1 in a million error case is not only annoying, but its confusing.

      *If you override a function with a checked exception, you must declare yourself as throws... even if you don't throw that exception in any condition. Which is just wrong, your function can't throw it.

      *Checked exceptiosn don't work well with lambdas.

      *Checked exceptions make some things like visitor patterns much more difficult.

      What annoys me more about Kotlin is that classes are final by default. I know more about my use case than you. If I decide that the best way of implementing something is to extend your class, I have a good reason for it. Preventing me just makes your code less usable.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    3. Re: Checked Exceptions. by Anonymous Coward · · Score: 0

      If checked exceptions were so great, why does NO language with exceptions use them except Java? Not a single one.

      I'll tell you why checked exceptions are a stupid idea: they pollute the method interface with irrelevant information (i.e., what checked exceptions might get thrown). That info has no impact on how you call a method. It's even dumber when you think of all the unchecked exceptions that a method could conceivably throw, but don't appear anywhere in the method declaration. And why not? Because you can't anticipate EVERY TYPE of error that could occur. This is actually the REASON exceptions were invented in the first place!

    4. Re: Checked Exceptions. by phantomfive · · Score: 1

      Those users are wrong, they are mainly people who don't want to think about errors, and deal with them by pretending they don't exist. If you want to write secure code you need to know if the function you are calling is going to throw an error or not. There is a better way to deal with the unwieldiness of exceptions: always throw "Exception" (with an appropriate human readable error message), unless there is something the programmer can do at runtime to handle a specific exception (like an interrupt exception). In that case, to increase flexibility you can throw "Exception" *and* "InterruptException" if you want to increase flexibility, but you need to deal with errors when they happen. Checked exceptions may be awkward, but unchecked exceptions are unusable for reliable code.

      --
      "First they came for the slanderers and i said nothing."
    5. Re:Checked Exceptions. by NextApp · · Score: 2

      Most of those complaints are due to developers being unwilling to write their own exceptions when they write code. If you tried to use checked exceptions without being willing to author your own, they would be an absolute nightmare.

      Let's say you're writing a library that transfers data from an XML file to a database. If you have client-facing methods that throw SAXException, IOException, and SQLException, you're doing it wrong. When you design your interface, you also need to write your own exceptions, e.g., "TransferException" which describes the failure in a meaningful way.

      I tend to have a high-level exception in my apps, call it "SystemException", which wraps the underlying failure (and contains a user-understandable error type, e.g., "network timed out", "access denied", "resource corrupt". )

    6. Re: Checked Exceptions. by jrumney · · Score: 2

      I'll tell you why checked exceptions are a stupid idea: they pollute the method interface with irrelevant information (i.e., what checked exceptions might get thrown).

      What is irrelevant about that? Do you prefer your interfaces to be undocumented and discoverable only by "trial and error and too bad if your test cases didn't cover enough unexpected use cases" in other ways as well, or just for the exceptions?

    7. Re: Checked Exceptions. by Anonymous Coward · · Score: 0

      +1

    8. Re: Checked Exceptions. by Anonymous Coward · · Score: 0

      Actually, C++ will likely be getting something like checked exceptions soon, perhaps in C++20. This is due to the high performance penalty for supporting unchecked exceptions combined with the desire not to avoid exceptions altogether in performance-critical codebases.

    9. Re: Checked Exceptions. by Anonymous Coward · · Score: 0

      That's why you catch throwable after you do the obvious stuff that you CAN handle (filenotfound, etc, etc)

      It's easier to parse, CLEAR and therefore easier to maintain. THATs one of the reasons why they exist.

      Of course if you're a shit coder and just use throwable without bothering about anything else then I'm not suprised.

    10. Re: Checked Exceptions. by lucasnate1 · · Score: 1

      Haskell uses checked exceptions. The clang code base also used them (error classes with destructor that asserts if they are not checked)

    11. Re:Checked Exceptions. by cen1 · · Score: 1

      I don't remember the last time I've read so much bullshit. Checked exceptions tell you that something is expected to go wrong and you should deal with it in some way. If that's not the case, use a runtime exception. I love the choice.

    12. Re:Checked Exceptions. by Anonymous Coward · · Score: 1

      I personally think checked exceptions have made me a better programmer, forcing me to think harder about all the things that could go wrong. The argument you hilighted about "bad programmers" abusing the exception handling with a catch-all is just dumb, grasping for an excuse and agree that bad programmers will always find ways to mess things up. It's not like exception handling is rocket science.

    13. Re: Checked Exceptions. by Anonymous Coward · · Score: 0

      No those users are not wrong. Exceptions should not be used for "expected" errors. A caller shouldn't need to know about and handle BobsException that may occur 10 layers down the call stack. Having a list of exceptions that are expected is contrary to the concept of an exception. If specific errors are a common enough occurrence then they should just be appended to the return set in some way so they can be handled in normal code flow.

    14. Re:Checked Exceptions. by Wookie+Monster · · Score: 1

      The only thing wrong with Java checked exceptions is that the mechanism is provided by the exception type definition instead of the usage of the exception. Declaring that an exception can be thrown from a method is an indication from the API designer that this is something important and should be considered by the caller. The caller should simply receive a warning from the compiler, which can be suppressed, or the caller should be able to throw the exception out as unchecked. The latter is possible today, using various utilities that take advantage of Java generics and type erasure. This is what I do nowadays, and I like that the compiler informed me that an important exception is possible and that I need to consider it. Considered and rethrown is perfectly fine sometimes.

    15. Re: Checked Exceptions. by Teckla · · Score: 1

      Throwable is usually reserved for very serious errors you shouldn't even try to recover from. You should catch Exception instead.

    16. Re: Checked Exceptions. by AuMatar · · Score: 1

      You didn't describe checked exceptions, you described typed exceptions. Nobody complains about exceptions having type that can be compared against. Checked exceptions are the list of exceptions in the throws argument that are checked against at compile time.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    17. Re:Checked Exceptions. by MtHuurne · · Score: 1

      How do unchecked exceptions fix the things you mentioned? Sure, it's a pain to do proper error handling, but I have never seen any programming language in which error handling is effortless. At least with checked exceptions, the compiler will alert you to unhandled situations.

      Deciding that you won't bother to do proper error handling is fine if you're working on some tool that you only use yourself. But if your code is going to be part of a large complex system, you're trading a bit of development speed now for a lot of pain later. "One in a million" events can happen several times a day, especially if the way your code is used changes over time.

    18. Re: Checked Exceptions. by phantomfive · · Score: 1

      You didn't describe checked exceptions, you described typed exceptions. Nobody complains about exceptions having type that can be compared against

      You obviously misunderstood. I was explaining how to solve your problems with checked exceptions.

      Checked exceptions are the list of exceptions in the throws argument that are checked against at compile time.

      There are people who don't like checked exceptions because they would rather pretend errors don't happen. You can't write reliable software if you live in this kind of fantasy world. You need to think about what happen if there's an error.

      --
      "First they came for the slanderers and i said nothing."
    19. Re: Checked Exceptions. by AuMatar · · Score: 1

      No, you were showing you didn't know what you were talking about. You tried to defend a feature while describing a totally different feature.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    20. Re: Checked Exceptions. by phantomfive · · Score: 1

      Are you going to attack a strawman, or are you going to address my main point? You can't write reliable software if you don't consider all possible exceptions when you are writing the software.

      --
      "First they came for the slanderers and i said nothing."
    21. Re: Checked Exceptions. by Raenex · · Score: 1

      You can't write reliable software if you don't consider all possible exceptions when you are writing the software.

      That's bullshit. Worst comes to worst the program crashes safely. with a nice stacktrace to tell you what happened. Checked exceptions are valid in a few, very few cases. In all other cases, all they add is clutter.

      Let's take something like SQLException. Ok, what are you supposed to do if your SQL is fucked up? You can't recover from it, so you either wrap it in a non-checked exception or you throw it up the chain, exasperating the crud code that needs to deal with it.

      What do you do if you get an IOException when writing to a file? Well something is fucked. The safest thing to do is end the program with a stracktrace and let the user figure it out.

      On and on it goes. Checked exceptions are one of the biggest sources of crud in the Java language, and they do not pay for themselves.

    22. Re: Checked Exceptions. by phantomfive · · Score: 1

      Yeah, I can already imagine how bad your software is. If you aren't considering what can go wrong when you write code, you better not put it on the internet either, because it's not going to be secure. Somone will hack you.

      --
      "First they came for the slanderers and i said nothing."
    23. Re: Checked Exceptions. by Raenex · · Score: 1

      Ok, I gave you the benefit of the doubt the first time when you mentioned security and then switched to reliability. But now here you are again talking about security. Java is not C. In Java, when you get an exception your program crashes. In C, if you don't check return codes your program silently continues running.

      You complained about the other poster ignoring your argument, and that's exactly what you did to me. I never said you should ignore what can go wrong. I said in the vast majority of cases, checked exceptions add no value and just create crud. I gave examples. Do you want to address that argument?

  13. Evaluation based on code smells? by Anonymous Coward · · Score: 0

    This approach where they evaluate code based on code smells sounds similar to what some people used to evaluate C++ code based on searching for void* pointer usage. Basically it's bullshit evaluation. They shouldn't declare some code bad simply because it uses some language primitive that the programming language is providing and then declare that another language is better when it _doesn't_ provide the feature at all. I.e. they declare that simply because people need to implement the feature differently, that the code would be somehow better.

    Lets declare any superficial code evaluation strategy as bullshit.

  14. Should program in "Donald J. Trump" by Anonymous Coward · · Score: 0

    He's got the best words and by principle never fails.

  15. Correlation != Causation by Anonymous Coward · · Score: 0

    Did they account for developer experience, skill, andage of the app? People adopting Kotlin are likely to be more interested in programming langugages than the average developer, and the applications likely to be newer,

  16. Kotlin - only a slight improvement by Anonymous Coward · · Score: 1

    Why not write in Haskell and eliminate ALL bugs?

  17. Make a phone with a 'smell generator'. by Anonymous Coward · · Score: 0

    So you can smell the goodness or badness of your apps.

  18. Can detect some crashes, true. Test oracle problem by raymorris · · Score: 1

    True, fuzzing can sometimes tell you that the program crashes, or does certain other things. It can't tell you that the program never crashes. It can't tell you if the program operates correctly. See the test oracle problem.

  19. Correlation does not imply causation by Anonymous Coward · · Score: 0

    Article is beyond dumb.

    Generally people who tend to pick up newer languages are more better and more confident of their coding skills (not always.... it's a generalisation)..... so the "scientists" (seriously???!?) are just jumping to conclusions on weak logic.