Java vs Kotlin Android book

Discussion in 'Tech Discussion' started by Jojo775, Nov 9, 2019.

  1. Jojo775

    Jojo775 Honorary Algae Knight

    Joined:
    Feb 13, 2018
    Messages:
    4,301
    Likes Received:
    2,569
    Reading List:
    Link
    I want to get a book Big Nerd Ranch Guide Android Programming but last Java edition is 2 years old, there is a new one which is in Kotlin. As a novice programmer I don't wish to get into another language without mastering Java first but android keeps changing so a new book would be more useful.
    Do you think I could understand Kotlin in this book? I already know how to make fragments, dialogs, services... but I need a recap from this book and to learn more.
    Or should I stick with Java book so who cares it will have a few deprecated functions and no any newest ones? Shouldn't matter really for a novice anyway as long as I can learn all the fundamentals right?
     
  2. Deleted member 155674

    Deleted member 155674 Guest

    Reading List:
    Link
    Do you like programming with java? if you do then stick to it, otherwise better change, choose the language with wich you feel at ease, what do you think?
    Well, I didn't use kotlin but they say it is better than java so I don't know :blobsweat_2:
     
    sapassde likes this.
  3. zekeinferno

    zekeinferno Well-Known Member

    Joined:
    Oct 20, 2015
    Messages:
    45
    Likes Received:
    32
    Reading List:
    Link
    As long as you learn the fundamentals, thats all that matters. Companies still use technology that’s a decade old so it’s not wasted time.
     
    Jojo775 likes this.
  4. sgrey

    sgrey Well-Known Member

    Joined:
    Jul 12, 2017
    Messages:
    1,206
    Likes Received:
    1,492
    Reading List:
    Link
    Stick with Java. No one uses Kotlin. Learn it in the language that the majority uses and you have educational materials for, then if you want, you can switch. Not that much will change in 2 years, and regardless of what book you buy, it will become outdated quickly with the way Android does things. Better find the book that has a proper explanation of philosophies in android api design because you will understand it better.
     
    sapassde, lohwengk and Jojo775 like this.
  5. Jojo775

    Jojo775 Honorary Algae Knight

    Joined:
    Feb 13, 2018
    Messages:
    4,301
    Likes Received:
    2,569
    Reading List:
    Link
    Well Kotlin is the official Android language but yeah it's used nowhere else I think, while with Java you can be all kinds of a dev.
     
    lohwengk likes this.
  6. TamaSaga

    TamaSaga Well-Known Member

    Joined:
    Oct 11, 2016
    Messages:
    1,726
    Likes Received:
    2,173
    Reading List:
    Link
    Honestly speaking, I haven't picked up a book on this stuff in years. Whatever questions I had, I found it using google...

    That said, books are definitely useful for giving you tips for things that you honestly wouldn't think about.

    And to answer your question, while I can vouch for the makers of Kotlin since I love using many of their products, just looking at Kotlin for a moment is enough for me to think that, unless you're very familiar with Javascript/Typescript/ and C, you're better off sticking with Java until Kotlin matures into something more functional.

    Otherwise you're going to get hit with a drastic learning curve when your time could be better spent coding.
     
    Jojo775 and lohwengk like this.
  7. jcochran

    jcochran Member

    Joined:
    Oct 16, 2019
    Messages:
    45
    Likes Received:
    75
    Reading List:
    Link
    Having been a programmer for over 30 years, your question indicates you lack a fundamental insight. That being:

    Language DOES NOT MATTER.

    To be a good program, you need to understand how to solve problems and express the solutions to those problems clearly and unambiguously. Once you have that fundamental down, then simply use whatever language is most convenient to problem, or system, that you're working on. And if you actually understand programming, you can pick up a new language extremely quickly. My own personal experience is that it takes me about a week to become competent in a new language, a month to become proficient, and couple of months to become near expert/expert. And the more languages you learn, the easier it becomes.

    As an example, here is a partial list of languages I've used.
    BASIC, FORTRAN, COBOL, PL/I, C, C++, C#, Ada, Rexx, CLIST, Java, PostScript, 370 Assembly, Z80 Assembly, 6502 Assembly, 680x0 Assembly, Forth, Lua, and Pascal, as well as multiple scripting languages.

    Once you have the fundamentals down and have a few languages under your belt, everything else becomes easy. Think of it like sitting down in front of a computer with a word processing program you've never seen before, a manual to the program is available that you can read, and you've been told to transcribe a paper in front of you. Right off the bat, you're going to assume that there's some command that will allow you to start entering keystrokes. You may not know exactly what that command is, but you know it exists. Also you have a general idea as to how such a command is described. So with that background, you can easily search the manual for keywords like "insert", "add", etc. to find the actual command that will enable what you want. Then as you enter your document, you notice that you made a mistake. Once again, you already know that there should be some command to delete or modify some preexisting part of your document and know some keywords to describe that operation. So you look in the manual again, discover the desired command or operation, then make your desired correction. As you iteratively repeat this cycle of "need some functionality that you know should exist", "search manual for functionality using known descriptions", "learn actual command for functionality", you learn more about how this mystery editor works and become more proficient in it. The same principle applies to learning new programming languages, programming paradigms, design methodologies, etc. So don't worry about learning a new language.
     
  8. wtrmute

    wtrmute Active Member

    Joined:
    Oct 24, 2017
    Messages:
    4
    Likes Received:
    1
    Reading List:
    Link
    I'll say the opposite of @sgrey: You only stick with Java if your employee demands you. Java was designed around 1993 (?), and the design philosophy of making things simple for the compiler developer at the expense of the compiler user is in full display. The big step ahead compared to C++ was using a garbage collector, and everybody knows that if a program is garbage collected, it is impossible for it to leak memory, right? </sarcasm>

    Now Kotlin has the null-safety ? operator, which is enough reason to prefer it over Java. The page ( appbrain [dot] com [slash] stats [slash] libraries [slash] details [slash] kotlin [slash] kotlin ) shows that around 7.7% of the apps in the Google Play Store use the Kotlin runtime, which is one in thirteen. Along with the null-safety features and the general conciseness of the language compared to Java, you're better off using it.
     
  9. Jojo775

    Jojo775 Honorary Algae Knight

    Joined:
    Feb 13, 2018
    Messages:
    4,301
    Likes Received:
    2,569
    Reading List:
    Link
    I know that but it still takes time to switch. I also programmed in C, JavaScript, PHP, Assembly for some Motorola chip... doesn't mean I'm experienced with them. I don't want to waste time on adapting but make applications fast and simple.
    Well it seems there isn't even a paperback Kotlin available so I'll stick with my order and learn Kotlin in the future if need be.
     
  10. sgrey

    sgrey Well-Known Member

    Joined:
    Jul 12, 2017
    Messages:
    1,206
    Likes Received:
    1,492
    Reading List:
    Link
    it has nothing to do with being official or not. I am talking about industry use and the amount of training resources available for it. You are more likely to find help and examples in Java, including educational videos, stack overflow and whatever other blogs you have for android. The language does not matter that much if you have experience and proper documentation, but if you are just starting, you are better off learning something more popular first. Other than that, there are plenty of frameworks that allow you to cross-compile things. You can even write for android in C# if you want to. But get your feet wet first before you start trying random things out.
     
    TamaSaga likes this.
  11. TamaSaga

    TamaSaga Well-Known Member

    Joined:
    Oct 11, 2016
    Messages:
    1,726
    Likes Received:
    2,173
    Reading List:
    Link
    Unless you understand the concept of null as a 3rd state, the null safety operator is rather useless. I mean, most beginners just use null to initialize a variable to empty, or as a signal to the garbage collection engine to collect.

    In order to actually start using the null-safety operator, beginners will need to be using the ternary operators first to understand how it's used. Then they need to realize and start programming with the idea that null can be used to indicate an uninitialized variable. To be initialized properly when it's needed. Otherwise, a null-safety operator becomes a glorified reminder that you forgot to initialize a variable instead of a dynamic construct.

    Mm...my point is that there should be other reasons to start with Kotlin. Basing an argument around an advanced feature isn't the best idea.
     
    Last edited: Nov 10, 2019
    Jojo775 likes this.
  12. wtrmute

    wtrmute Active Member

    Joined:
    Oct 24, 2017
    Messages:
    4
    Likes Received:
    1
    Reading List:
    Link
    There are several. The most important one is actually the ability to do away with boilerplate code like accessors and private members, but the null-safety operator, together with the nullable types, do help quite a bit and not just as a detector for uninitialised variables.

    The actual point is not that Kotlin is great, though it's good; the point is that Java itself is crap. You're better off using any of the other so-called "Java.next" languages, of which Kotlin is one. But if it's Clojure or Scala or Groovy or Jython that tickles your fancy, then the more power to you. But using plain Java is like using a less-nice C++.
     
  13. TamaSaga

    TamaSaga Well-Known Member

    Joined:
    Oct 11, 2016
    Messages:
    1,726
    Likes Received:
    2,173
    Reading List:
    Link
    Not really arguing with you since I really hate programming android just because of the Java, but I advocate the "use what you know" school of thought when you're under a time crunch or still learning the basics.

    I can cite example upon example where I've found that switching to a new technology generally wowed me for like an hour, and then the fine print comes back to bite me. After that, it's many hours of suffering as I search around and compare my code with how it's supposed to be done. That time searching for that tiny code-breaking difference could have been spent perfecting the craft.
     
    sgrey and Jojo775 like this.
  14. Jeebus

    Jeebus Well-Known Member

    Joined:
    Jun 20, 2017
    Messages:
    904
    Likes Received:
    780
    Reading List:
    Link
    I'll echo what a lot of others have said. You can program what you want in almost any language you want as long as you don't have restrictions set by your employer/client. As long as you can compile your code to work on the device you want it to run on, use whatever language you think will make coding as enjoyable for you as possible.

    Java is a more mature language than Kotlin, and you'll find a lot more help available for it online. So, if you're still learning how to code, then use the language that has the most resources available in case you hit a roadblock.

    As others have said, books aren't your only resource. In fact, I never buy coding books anymore. I find everything I need on StackExchange, Google, or learn-to-code sites, which are generally updated to match whatever the newest hotness is with the language they're trying to teach you.
     
  15. sgrey

    sgrey Well-Known Member

    Joined:
    Jul 12, 2017
    Messages:
    1,206
    Likes Received:
    1,492
    Reading List:
    Link
    There is a caveat there. Many of the "how to code" web sites post shit. I just had this problem with my students as most of the web sites that try to explain the material are factually wrong. With the published books you are a bit more safe from nonsense
    Yes, this is exactly why you should stick with more wide-spread technology while you are learning. It is pretty much always the case with the new stuff - you are all excited until you hit some corner case and cannot find the solution for it.

    to be honest, you are not really making a good case here. I am not a Java fan, but I would not call the language "crap". There are much worse languages out there. The only valid argument for Kotlin I see is arguably better type system while the rest seem to be stylistic preferences. So you get null-safety by default, but you will have the same problems if you declare variable nullable. It is also possible to do static checking on Java and figure out if you have potential null dereference somewhere. In a sense, Kotlin just makes the problem slightly better but does not really get rid of it. I have also ran into problems where having non-nullable objects cause bugs because of data model inconsistency between different parts of the pipeline. For example, if you call a web service or a database, and it has nullable types and returns nulls to you for every possible field, you are back to dealing with nulls and arguably have to do more work.
    Basically from what I see most of the problems you are arguing against can be avoided by just using good practices and good software design, and static code checking.

    I am not arguing that one language is better than the other. My point is that each language have their own caveats and if you are learning new technology, it is better to learn it using familiar language and the one that is more popular overall. Otherwise, you just increase you difficulty by a large margin.
     
    Last edited: Nov 13, 2019
    TamaSaga likes this.